web-dev-qa-db-ja.com

抽象メソッドエラー

Glassfish 3.1.2を使用して起動するとnetbeansでプロジェクトに取り組んでいます。すべてが正常に機能します。ただし、次のメソッドにマップされている/ invite urlを呼び出すと

@RequestMapping(value = "/invite", method = RequestMethod.POST)
    @ExceptionHandler(GenericException.class)
    public ModelAndView create(@ModelAttribute(value = "preRegister") @Valid PreRegister preRegister, BindingResult result, HttpServletRequest request) {
        mav = new ModelAndView();
        validator.validate(preRegister, result);
        List<Role> roleList = null;
        if (result.hasErrors()) {
            mav.setViewName("user_populate_create");
            try {
                roleList = roleDao.list();
            } catch (Exception ex) {
                logger.error("UserController: Unable to list Roles: ", ex);
                throw new GenericException("UserController: Unable to list Roles: " + ex.getMessage());
            }
            if (roleList == null || roleList.isEmpty()) {
                throw new GenericException("UserController: Unable to list Roles");
            } else {
                mav.addObject("roles", roleList);
            }

        } else {
            String uuid = RandomUuid.generate();
            preRegister.setUrlCode(uuid);
            preRegister.setCreatedOn(Helper.rightNow());
            List<PreRegister> p;

            try {
                p = preRegisterDao.findbyQuery("checkAvailability", preRegister.getLoginId());
                if (p == null || p.isEmpty()) {
                    preRegisterDao.saveOrUpdate(preRegister);
                } else {
                    throw new GenericException("User Email Id is Exist! try With another Email Id ");
                }
            } catch (Exception exception) {
                exception.printStackTrace();
                logger.error("Invite user: ", exception);
                throw new GenericException("Exception :: " + exception.getMessage());

            }



        }
        return mav;

    }

メソッドの最初の行も実行されず、このスタックトレースが表示されます

Java.lang.AbstractMethodError
    at javax.persistence.Persistence$PersistenceUtilImpl.isLoaded(Unknown Source)
    at org.hibernate.validator.engine.resolver.JPATraversableResolver.isReachable(JPATraversableResolver.Java:61)
    at org.hibernate.validator.engine.resolver.DefaultTraversableResolver.isReachable(DefaultTraversableResolver.Java:131)
    at org.hibernate.validator.engine.resolver.SingleThreadCachedTraversableResolver.isReachable(SingleThreadCachedTraversableResolver.Java:46)
    at org.hibernate.validator.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.Java:1242)
    at org.hibernate.validator.engine.ValidatorImpl.validateConstraint(ValidatorImpl.Java:448)
    at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.Java:397)
    at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.Java:361)
    at org.hibernate.validator.engine.ValidatorImpl.validateInContext(ValidatorImpl.Java:313)
    at org.hibernate.validator.engine.ValidatorImpl.validate(ValidatorImpl.Java:139)
    at org.springframework.validation.beanvalidation.SpringValidatorAdapter.validate(SpringValidatorAdapter.Java:86)
    at org.springframework.validation.DataBinder.validate(DataBinder.Java:692)
    at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doBind(HandlerMethodInvoker.Java:807)
    at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.Java:359)
    at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.Java:171)
    at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.Java:426)
    at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.Java:414)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.Java:790)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.Java:719)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.Java:644)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.Java:560)
    at javax.servlet.http.HttpServlet.service(HttpServlet.Java:688)
    at javax.servlet.http.HttpServlet.service(HttpServlet.Java:770)
    at org.Apache.catalina.core.StandardWrapper.service(StandardWrapper.Java:1542)
    at org.Apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.Java:343)
    at org.Apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.Java:217)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.Java:368)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.Java:109)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.Java:83)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.Java:380)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.Java:97)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.Java:380)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.Java:100)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.Java:380)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.Java:78)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.Java:380)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.Java:54)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.Java:380)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.Java:35)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.Java:380)
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.Java:177)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.Java:380)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.Java:187)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.Java:380)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.Java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.Java:380)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.Java:79)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.Java:380)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.Java:169)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.Java:237)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.Java:167)
    at org.Apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.Java:256)
    at org.Apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.Java:217)
    at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.Java:198)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.Java:76)
    at org.Apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.Java:256)
    at org.Apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.Java:217)
    at org.Apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.Java:279)
    at org.Apache.catalina.core.StandardContextValve.invoke(StandardContextValve.Java:175)
    at org.Apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.Java:655)
    at org.Apache.catalina.core.StandardPipeline.invoke(StandardPipeline.Java:595)
    at org.Apache.catalina.core.StandardHostValve.invoke(StandardHostValve.Java:161)
    at org.Apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.Java:331)
    at org.Apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.Java:231)
    at com.Sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.Java:317)
    at com.Sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.Java:195)
    at com.Sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.Java:849)
    at com.Sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.Java:746)
    at com.Sun.grizzly.http.ProcessorTask.process(ProcessorTask.Java:1045)
    at com.Sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.Java:228)
    at com.Sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.Java:137)
    at com.Sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.Java:104)
    at com.Sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.Java:90)
    at com.Sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.Java:79)
    at com.Sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.Java:54)
    at com.Sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.Java:59)
    at com.Sun.grizzly.ContextTask.run(ContextTask.Java:71)
    at com.Sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.Java:532)
    at com.Sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.Java:513)
    at Java.lang.Thread.run(Thread.Java:722)

私はSpring MVC 3.0 Hibernate 3を使用していますが、最近、jdkバージョンをjdk6からjdk7に更新し、使用しています- IBMジェネリックDAO 。これについてインターネットで何時間も検索しましたが、解決策が見つかりませんでした。

更新:私が使用したJARファイルのリスト。

file: dwr.jar
file: gson-2.2.1.jar
file: javaee-api-6.0.jar
file: ejb3-persistence.jar
file: hibernate-annotations.jar
file: hibernate-commons-annotations.jar
file: hibernate-entitymanager.jar
file: hibernate-validator.jar
file: hibernate3.jar
file: persistence.jar
file: Jhove-final.jar
file: jhove-handler.jar
file: jhove-module.jar
file: jhove.jar
file: json-org.jar
file: json-taglib-0.4.1.jar
file: antlr-2.7.6.jar
file: antlr-runtime-3.0.jar
file: aspectjrt.jar
file: aspectjweaver.jar
file: commons-beanutils-1.8.0.jar
file: commons-collections-3.1.jar
file: commons-dbcp.jar
file: commons-digester-2.0.jar
file: dom4j-1.6.1.jar
file: ehcache-1.2.3.jar
file: javassist-3.9.0.GA.jar
file: jstl-1.2.jar
file: jta-1.1.jar
file: log4j-1.2.14.jar
file: mysql-connector-Java-5.1.18-bin.jar
file: servlet-api-2.3.jar
file: slf4j-api-1.5.8.jar
file: slf4j-log4j12-1.5.8.jar
file: cas-client-core-3.1.10.jar
file: ldapsdk-4.1.jar
file: spring-ldap-core-1.3.0.RELEASE.jar
file: spring-security-acl-3.0.5.RELEASE.jar
file: spring-security-cas-client-3.0.5.RELEASE.jar
file: spring-security-config-3.0.5.RELEASE.jar
file: spring-security-core-3.0.5.RELEASE.jar
file: spring-security-ldap-3.0.5.RELEASE.jar
file: spring-security-openid-3.0.5.RELEASE.jar
file: spring-security-taglibs-3.0.5.RELEASE.jar
file: spring-security-web-3.0.5.RELEASE.jar
file: com.springsource.net.sf.cglib-2.2.0.jar
file: com.springsource.org.aopalliance-1.0.0.jar
file: com.springsource.org.Apache.commons.logging-1.1.1.jar
file: com.springsource.org.Apache.commons.pool-1.5.3.jar
file: com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar
file: org.springframework.aop-3.0.5.RELEASE.jar
file: org.springframework.asm-3.0.5.RELEASE.jar
file: org.springframework.aspects-3.0.5.RELEASE.jar
file: org.springframework.beans-3.0.5.RELEASE.jar
file: org.springframework.context-3.0.5.RELEASE.jar
file: org.springframework.context.support-3.0.5.RELEASE.jar
file: org.springframework.core-3.0.5.RELEASE.jar
file: org.springframework.expression-3.0.5.RELEASE.jar
file: org.springframework.instrument-3.0.5.RELEASE.jar
file: org.springframework.instrument.Tomcat-3.0.5.RELEASE.jar
file: org.springframework.jdbc-3.0.5.RELEASE.jar
file: org.springframework.orm-3.0.5.RELEASE.jar
file: org.springframework.test-3.0.5.RELEASE.jar
file: org.springframework.transaction-3.0.5.RELEASE.jar
file: org.springframework.web-3.0.5.RELEASE.jar
file: org.springframework.web.servlet-3.0.5.RELEASE.jar
file: tiles-api-2.2.2.jar
file: tiles-compat-2.2.2.jar
file: tiles-core-2.2.2.jar
file: tiles-el-2.2.2.jar
file: tiles-extras-2.2.2.jar
file: tiles-freemarker-2.2.2.jar
file: tiles-jsp-2.2.2.jar
file: tiles-mvel-2.2.2.jar
file: tiles-ognl-2.2.2.jar
file: tiles-servlet-2.2.2.jar
file: tiles-servlet-wildcard-2.2.2.jar
file: tiles-template-2.2.2.jar
file: tiles-velocity-2.2.2.jar
file: UUID-Parser.jar
file: SafeCommons.jar
file: safe_commons_v2.jar
file: FileUtillsDoc.jar
file: SAFE_MS2_V1_FILEUTILLS.jar
file: jackson-annotations-2.0.4.jar
file: jackson-core-2.0.4.jar
file: jackson-databind-2.0.4.jar
file: jai_codec-1.1.3.jar
file: jai_core-1.1.3.jar
file: pdfbox-app-1.3.1.jar
file: sanselan-0.97-incubator.jar
file: jai_codec-1.1.3.jar
file: jai_core-1.1.3.jar
file: pdfbox-app-1.3.1.jar
file: sanselan-0.97-incubator.jar
13
Dangling Piyush

Java.lang.AbstractMethodErrorは、アプリケーションが抽象メソッドを呼び出そうとしたときにスローされます。通常、このエラーはコンパイラーによってキャッチされます。このエラーは、現在実行中のメソッドが最後にコンパイルされてから一部のクラスの定義に互換性のない変更が加えられた場合にのみ実行時に発生します。

この問題は、一部のjarファイルのバージョンの非互換性が原因であると思われます。私はあなたのコードからそれを理解することができません。 このスレッド を確認してください。

36

このエラーは、実際の実装なしで抽象メソッドが呼び出されるために発生します。これは通常、一部のライブラリがアップグレードされていないときにアップグレードされた後に発生します。依存関係がどういうわけか欠落しています。

したがって、すべてのライブラリのアップグレードが正常に完了したかどうかを確認してください。

ここ は、AbstractMethodErrorがどのように発生するかについての良い例とデモンストレーションです。

3
PixelsTech

ここに記載されていない原因からこのエラーが発生しました。

私はプロガードを使用していて、それによってクラスが難読化され、その結果、AbstractMethodErrorが発生しました。ただそのクラスを警戒し続けなければなりませんでした。

2
Fred Andrews

これは、NetBeansでJava 8を実行し、ラムダを使用してインターフェースを実装し、インターフェースの署名を変更しているときに発生する可能性があります。

簡単な解決策:Clean and buildShift+F11 デフォルトでは)*

1
Zar

私の場合も同じ問題がありました。問題は、2つの異なるjarファイルに同じ名前の2つの.classファイルがあることでした.pom.xmlからjarファイルを除外して動作し始めました!

0
Narendra

これは、スプリング依存関係とスプリングブートを混在させている場合にも発生する可能性があります。すべての依存関係を確認し、sping-boot依存関係があるかどうかを確認します。 Spring-Bootを使用している場合は、Spring-Bootがすでにすべてを提供しているため、Springの依存関係をインポートしないでください。 Springを使用する場合は、Spring-Bootを使用しないでください。逆も同様です。

0
HackerRaj

私はこれで少し時間を失いました。

Pom.xmlで、依存関係についてLATESTを設定している場合は、それが原因である可能性があります。そこに正しいバージョンを指定しないでください。これもベストプラクティスです。

0
Nazeel

例外(または発生している行)にブレークポイントを設定して、問題の原因となっているクラス/メソッドを正確に特定し、クラスパスでこのクラスのすべての発生を検索します。クラスパスにクラスのバージョンが複数ある場合は、間違ったバージョンを削除してください。

0
koljaTM