• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Exception java.lang.NoClassDefFoundError, EJB threw an unexpected exception during invocation

 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have 2 projects in my Rational Application Developer (RAD), neddsWeb and neddsEJB, I have 2 files NEListenerBean.java in neddsEJB, and HandleTransaction.java in neddsWeb. Below is the code from NEListenerBean.java



I am trying to access the code in HandleTransaction.java from NEListenerBean.java, although I do not get any compile time error, I am getting the following run time exceptions. Please suggest.



[7/29/15 17:16:10:975 CDT] 000000a5 LocalExceptio E CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "onMessage" on bean "BeanId(nedds#neddsEJB.jar#NEListenerBean, null)". Exception data: java.lang.reflect.InvocationTargetException
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.jms.listener.ServerSessionDispatcher.dispatch(ServerSessionDispatcher.java:47)
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:100)
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:132)
at com.ibm.ejs.jms.listener.ServerSession.run(ServerSession.java:581)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)
Caused by: java.lang.NoClassDefFoundError: ne.dds.java.HandleTransaction
at ne.dds.efi.ejb.NEListenerBean.onMessage(NEListenerBean.java:37)
at com.ibm.ejs.jms.listener.MDBWrapper$PriviledgedOnMessage.run(MDBWrapper.java:309)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:63)
at com.ibm.ejs.jms.listener.MDBWrapper.callOnMessage(MDBWrapper.java:266)
at com.ibm.ejs.jms.listener.MDBWrapper.onMessage(MDBWrapper.java:235)
at com.ibm.mq.jms.MQSession$FacadeMessageListener.onMessage(MQSession.java:125)
at com.ibm.msg.client.jms.internal.JmsSessionImpl.run(JmsSessionImpl.java:2747)
at com.ibm.msg.client.jms.internal.JmsXAQueueSessionImpl$1.run(JmsXAQueueSessionImpl.java:1000)
at com.ibm.mq.jms.MQSession.run(MQSession.java:950)
at com.ibm.ejs.jms.JMSSessionHandle.run(JMSSessionHandle.java:1058)
at com.ibm.ejs.jms.listener.ServerSession.connectionConsumerOnMessage(ServerSession.java:1090)
at com.ibm.ejs.jms.listener.ServerSession.onMessage(ServerSession.java:760)
at com.ibm.ejs.jms.listener.ServerSession.dispatch(ServerSession.java:726)
... 9 more
Caused by: java.lang.ClassNotFoundException: ne.dds.java.HandleTransaction
at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:204)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:688)
at java.lang.ClassLoader.loadClass(ClassLoader.java:667)
at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:119)
at java.lang.ClassLoader.loadClass(ClassLoader.java:650)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:584)
at java.lang.ClassLoader.loadClass(ClassLoader.java:650)
... 22 more

Thank you.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you add the JAR file that includes class ne.dds.java.HandleTransaction in your EAR?
 
Luke Zechariah
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks for your reply Rob. I checked in the WebSphere Application Server installation directory for installed apps:

C:\Program Files\IBM\WebSphereAppServer\profiles\AppSrv01\installedApps\SD0001Node01Cell\nedds.ear

where I see the following folders:
META-INF
neddsWeb.war
neddsEJB.jar
other property files and folders

The ne.dds.java.HandleTransaction.class file is in the /nedds.ear/neddsWeb.war/WEB-INF/classes,

So how would the file in neddsEJB access the files in WEB-INF. I know WEB-INF cannot be accessed from outside projects, so there should be some another way for it? Does that answer your question? or should I be looking for a .jar file somewhere? Please suggest.

Thanks.


 
Rob Spoor
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Put the class in your EJB JAR file instead. If I recall correctly, WAR files can access classes in EJB JAR files that are located in the same EAR (but not the other way around).
 
Luke Zechariah
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Good idea, but the problem is the HandleTransaction file calls for many other class files. Do you have other suggestions?
 
Rob Spoor
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you can't move all those classes to the EJB JAR file, create a separate project with shared code, include that as a non-EJB JAR file inside your EAR, and add it as a dependency for both the EJB-JAR file and the WAR file.
 
Luke Zechariah
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

As suggested I created a Java project in my RAD and named it neddsWmq, I am getting compile time exceptions:

A cycle was detected in the build path of project 'neddsEJB'. The cycle consists of projects {neddsEJB, neddsWeb, neddsWmq}
A cycle was detected in the build path of project 'neddsWeb'. The cycle consists of projects {neddsEJB, neddsWeb, neddsWmq}
A cycle was detected in the build path of project 'neddsWmq'. The cycle consists of projects {neddsEJB, neddsWeb, neddsWmq}


Here is the classpath of all the 3 projects:
neddsWmq


neddsEJB


neddsWeb
 
Rob Spoor
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why does neddsWmq have any dependencies?
 
Don't count your weasels before they've popped. And now for a mulberry bush related tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic