在单独的jar中调用ejb方法时出现invalidAccessError

时间:2018-07-04 07:19:57

标签: java jvm jboss7.x java-ee-6 ejb-3.1

我在代码中具有以下调用:

EJB1-Method ---> LocalEJB2(Local interface)-> LocalEJB2-getEmail()

  • 注意:如果有帮助,则EJB1位于jar1中,而EJB2本地接口位于jar2中。

LocalEJB2中的此方法具有以下用于对对象列表进行排序的匿名类:

 Collections.sort(list, new Comparator<MyOBJ>() {

                @Override
                public int compare(MyOBJ o1, MyOBJ o2)
                {
                    if(o1 == null || o1.getValue() == null) return 1;
                    if(o2 == null || o2.getValue() == null) return -1;

                    return o1.getValue().compareTo(o2.getValue());
                }
            });

调用此代码时,我从jvm收到以下错误消息:

   at java.lang.Thread.run(Thread.java:748) [rt.jar:1.7.0_171]
        at org.jboss.threads.JBossThread.run(JBossThread.java:122) Caused by: java.lang.IllegalAccessError: com/test/LocalEJB2$1
        at com.test.LocalEJB2.getEmail(LocalEJB2.java:378) [myjar.jar:]
        at sun.reflect.GeneratedMethodAccessor2057.invoke(Unknown Source) [:1.7.0_171]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_171]
        at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_171]
        at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at

0 个答案:

没有答案