• 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

Lazy instantiation/loading of EJB classes

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings,

I have an ear file whcih contains a jar, war and an application.xml file. Some of my web components(servlets) access ejbs. In normal circumstances it works fine. But, while starting the server, if I send a request to a servlet which delegates the invocation to ejb I am getting a class not found error because the ejb classes are yet to be loaded.

Can anyone tell how to block an incoming requests to a web module till the entire ear and other components inside it load and be ready to take request?

Does the order of specification in application.xml effecs class loading? Like, if war is specifed aloof of jar, will the AS load the war first?

Please help me. Following is the trace of the error that I am getting :

2006-02-02 18:46:35,713 ERROR [org.jboss.ejb.plugins.LogInterceptor] Unexpected Error:
java.lang.NoClassDefFoundError
at com.transerainc.cdp.manager.EventsManager.parseXMLFile(EventsManager.java:82)
at com.transerainc.cdp.ejb.ProcessEventMDB.onMessage(ProcessEventMDB.java:83)
at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:458)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:62)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:282)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:148)
at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:90)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:372)
at org.jboss.ejb.Container.invoke(Container.java:723)
at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:914)
at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1208)
at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:276)
at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:871)
at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:159)
at org.jboss.mq.SpySession.run(SpySession.java:347)
at org.jboss.jms.asf.StdServerSession.run0(StdServerSession.java:200)
at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748)
at java.lang.Thread.run(Thread.java:595)


Thank you,
Kala.
[ February 03, 2006: Message edited by: kala praveen ]
 
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This seems odd. I thought JBoss deployed the wars after the ejb-jars anyways. Even if that weren't the case, spec-compliant beans don't take long to deploy, and your stack trace suggests the bean is deployed because the container was willing to pull a message of the queue and deliver it to your MDB.

Do you maybe have something non-spec-compliant going on in your ejb-jars that is causing problems or unusual delays with their deployment? You might be chasing the wrong problem. Particularly the NoClassDefFound error may have nothing to do with timing of class loading. It may indicate an attempt to load a file as a resource and failing, or the use of something made static which shouldn't be static in EJB (like an XML parser). One way or another something clearly odd is happening.
[ February 03, 2006: Message edited by: Reid M. Pinchback ]
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you have errors in your build files when you create the ear file. Are you using ant? , some paths are wrong.., are you using eclipse? ... if not using that with xdoclet is the easiest way on earth ...
 
kala praveen
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whatever Mr.Reid told is right. I had some static variables and references in the EJB. I have removed them all and made the EJB very small and light.

I am using Ant to build my ear and I am using eclipse for development.

Hi Wiley: Will there be any classpath or reference problems with ant?

Thanks,
Kala.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic