1

我有一个在包含 ejb 的 WebLogic 上运行的耳朵。一切运行良好,直到 ejb 尝试实例化 ServiceFactory 的对象——我们自己的类之一。

在我的单元测试中,我可以在本地创建一个类的对象。错误发生在服务器上。

我猜这要么是构建/打包问题,要么是 WebLogic 10.3.6 的怪癖,但鉴于依赖项存在于耳朵中(在 APP-INF/lib 中),我不知道从哪里开始。我还尝试将包含该类的依赖项移动到耳朵的根部。“Class-Path:” 在 ejb 和 ear 的 MANIFEST.MF 文件中是空白的,但是在没有它们的情况下,产品到目前为止运行良好。我正在使用 Maven 构建。

javax.ejb.EJBException: what do i do: seems an odd quirk of the EJB spec.  The exception is:java.lang.NoClassDefFoundError: Could not initialize class com.company.ts.management.icm.service.ServiceFactory
at com.oracle.pitchfork.intercept.MethodInvocationInvocationContext.proceed(MethodInvocationInvocationContext.java:110)
at com.company.it.techservices.aae.service.CommonService.bizLog(CommonService.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at com.oracle.pitchfork.intercept.JeeInterceptorInterceptor.invoke(JeeInterceptorInterceptor.java:68)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.oracle.pitchfork.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:34)
at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
at com.oracle.pitchfork.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:42)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy476.calculateRoles(Unknown Source)
at com.company.it.techservices.aae.autheng.AuthorizationEngineBean_t79b4w_AuthorizationEngineBeanRemoteImpl.__WL_invoke(Unknown Source)
at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
at com.company.it.techservices.aae.autheng.AuthorizationEngineBean_t79b4w_AuthorizationEngineBeanRemoteImpl.calculateRoles(Unknown Source)
at com.company.it.techservices.aae.autheng.AuthorizationEngineBean_t79b4w_AuthorizationEngineBeanRemoteImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:667)
at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:522)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:518)
at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
4

2 回答 2

3

通常NoClassDefFoundError意味着该类可能已找到但无法初始化。因此,该类的代码中的某些内容在实例化时会引发错误(这可能意味着完全缺少另一个类)。

检查您班级的代码。专门查找使用 ClassLoader 未找到的类的静态块或成员。

于 2013-07-23T16:00:27.983 回答
1

在我的情况下,抛出 NoClassDefFoundError 仅仅是因为我的 make 文件没有将它包含在 ear 文件中,所以当 jboss 需要加载它时,类文件不存在。我修复了make文件并且没有进一步的问题。

于 2014-03-04T19:01:34.483 回答