0

I am trying to deploy an MDB in WAS 8.5. The session Factory is being initialized in ejbCreate method. When I try to deploy the application ejb loads successfully and then it shuts down the Queue Activation and gives the following exceptions- I am not using any framework or MAven for built so all the jars and config files have been added to the classpath as in a Standalone Java Application.

Here are the Hibernate and JAVAEE Jars I am using-

antlr-2.7.7
c3p0-0.9.1
commons-collections-3.2.1
commons-logging-api-1.1.3
dom4j-1.6.1
hibernate-c3p0-4.1.5.Final
hibernate-commons-annotations-4.0.1.Final
hibernate-core-4.1.5.Final
hibernate-entitymanager-4.1.5.Final
hibernate-envers-4.1.5.Final
hibernate-jpa-2.0-api-1.0.1.Final
javassist-3.15.0GA.jar
jboss-logging-3.1.0.GA.jar
jboss-transaction-api_1.1_spec-1.0.0.Final
jms-1.1
log4j-1.2.15
MySQL-connector-java-5.1.22
slf4j-api-1.6.1
javaee.jar
javaee-api-6.0

Here is the exception stacktrace from system logs

EJB threw an unexpected (non-declared) exception during invocation of  method "onMessage".Exception data: 
          javax.ejb.EJBException: MDB PostConstruct failure; nested exception is: 
          java.lang.Exception: See nested Throwable
    at com.ibm.ejs.container.util.ExceptionUtil.EJBException(ExceptionUtil.java:472)
    at com.ibm.ejs.container.MessageDrivenBeanO.initialize(MessageDrivenBeanO.java:427)
    at com.ibm.ejs.container.BeanOFactory.create(BeanOFactory.java:147)
    at com.ibm.ejs.container.EJSHome.createBeanO(EJSHome.java:1238)
    at com.ibm.ejs.container.EJSHome.createBeanO(EJSHome.java:1356)
    at com.ibm.ejs.container.activator.UncachedActivationStrategy.atActivate 
          (UncachedActivationStrategy.java:88)
    at com.ibm.ejs.container.activator.Activator.preInvokeActivateBean(Activator.java:615)
    at com.ibm.ejs.container.EJSContainer.preInvokeActivate(EJSContainer.java:4205)
    at com.ibm.ejs.container.EJSContainer.preInvokeMdbActivate(EJSContainer.java:3709)
    at com.ibm.ejs.container.MessageEndpointHandler.beforeDelivery
          (MessageEndpointHandler.java:1449)
    at com.ibm.ejs.container.MessageEndpointHandler.invokeMessageEndpointMethod
          (MessageEndpointHandler.java:866)
    at com.ibm.ejs.container.MessageEndpointHandler.invoke(MessageEndpointHandler.java:832)
    at $Proxy50.beforeDelivery(Unknown Source)
    at com.ibm.mq.connector.inbound.AbstractWorkImpl.run(AbstractWorkImpl.java:188)
    at com.ibm.ejs.j2c.work.WorkProxy.run(WorkProxy.java:608)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1783)
          Caused by: java.lang.Exception: See nested Throwable
    at com.ibm.ejs.container.util.ExceptionUtil.EJBException(ExceptionUtil.java:470)
    ... 15 more
          Caused by: java.lang.NoClassDefFoundError: org.hibernate.HibernateException
    at java.lang.J9VMInternals.verifyImpl(Native Method)
    at java.lang.J9VMInternals.verify(J9VMInternals.java:85)
    at java.lang.J9VMInternals.initialize(J9VMInternals.java:162)
    at com.hps.superenrollment.ejbmodule.SuperEnrollmentRequestMDB.ejbCreate
          (SuperEnrollmentRequestMDB.java:42)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
    at java.lang.reflect.Method.invoke(Method.java:611)
    at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor
          (InterceptorProxy.java:232)
    at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed
          (InvocationContextImpl.java:559)
    at com.ibm.ejs.container.interceptors.InvocationContextImpl.doLifeCycle  
          (InvocationContextImpl.java:273)
    at com.ibm.ejs.container.MessageDrivenBeanO.initialize(MessageDrivenBeanO.java:411)

Please help me as I am completely lost on what is going wrong here .

4

1 回答 1

1

NoClassDefFoundError 表示某些 Hibernate 类不在您的类路径中。您确定您的类路径中有所有依赖项 jar(包括运行时需要的 jar)吗?

指示您应该使用 PostConstructor 方法而不是 bean 类构造函数的异常指示您应该使用 ejbCreate() 方法。这是初始化和加载 MDB 依赖项的推荐位置,因为它由 ejb 容器的单个线程调用,并确保在执行 ejbCreate() 中的配置之前已完全构建 MDB。它有点类似于 servlet 中的 init 方法,它也保证被 servlet 容器以单线程方式调用。

于 2013-08-05T17:31:53.370 回答