You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Alys <al...@gmail.com> on 2011/03/16 15:55:02 UTC

java.lang.Exception: Could not load...

Hello,

I have an old project, built in Java 1.4, EJB 2.1 and Struts 1, and I'm
trying to migrate it to OpenEJB, but I'm facing some problems.

The environment is configured with:
	Apache Tomcat 6.0.32
	OpenEJB  3.1.4
	Windows XP Professional
	
I was using the bundle version (download file tomee-6.0.29.314.zip), but,
with the errors I was getting, I tried to upgrade Tomcat's version. Since
the application is old, it have a tradicional build.xml file, we don't use
an IDE or Maven to do the deploy.

The application has several EJBs and WEB modules (inside JARs and WARs
files), and everything is packed inside an EAR file. First, I tried to
deploy this EAR, but, it didn't worked. I kept getting some errors in Struts
(just like this post: 
http://openejb.979440.n4.nabble.com/OpenEJB-has-encountered-a-fatal-error-and-cannot-be-started-javax-servlet-jsp-jstl-core-ConditionalT-tp3071912p3071912.html
http://openejb.979440.n4.nabble.com/OpenEJB-has-encountered-a-fatal-error-and-cannot-be-started-javax-servlet-jsp-jstl-core-ConditionalT-tp3071912p3071912.html
) and, even changing Tomcat's version didn't solved it.

So, I changed my approach and removed the WARs from the EAR, and now I'm
putting then direct on Tomcat's webapp folder (so that Tomcat will be
responsible for validating the struts-config file inside the WARs, and not
OpenEJB). This worked well, at least for the web modules, but now I'm
getting errors while deploying my EJBs.

The server starts ok, with no errors. But, when it starts deploying the
EJBs, I get a thousand errors like this:

java.lang.Exception: Could not load package/path/NameOfTheClass.class
        at
org.apache.xbean.finder.ClassFinder.readClassDef(ClassFinder.java:270)
        at org.apache.xbean.finder.ClassFinder.(ClassFinder.java:125)
        at org.apache.xbean.finder.ClassFinder.(ClassFinder.java:97)
        at
org.apache.openejb.config.AnnotationDeployer$DiscoverAnnotatedBeans.deploy(AnnotationDeployer.java:426)
        at
org.apache.openejb.config.AnnotationDeployer$DiscoverAnnotatedBeans.deploy(AnnotationDeployer.java:257)
        at
org.apache.openejb.config.AnnotationDeployer.deploy(AnnotationDeployer.java:192)
        at
org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:248)
        at
org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:626)
        at
org.apache.openejb.tomcat.catalina.TomcatWebAppBuilder.checkHost(TomcatWebAppBuilder.java:499)
        at
org.apache.openejb.tomcat.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:74)
        at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
        at
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1385)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1649)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1658)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1638)
        at java.lang.Thread.run(Thread.java:619)
	
No other error appears, just that, many times, with many different classes.
	
Checking on Google, I found on this link a mail about this same problem:
http://osdir.com/ml/users.openejb.apache.org/2009-06/msg00046.html,
regarding a problem in xbean-finder-shaded. Even the topic being a little
old, I tried to do that, downloaded the JAR and replaced it inside OpenEJB
lib folder. But, now I get the problem:

org.apache.openejb.OpenEJBException: Unable to load bean class:
package.path.UserDelegateBean: package.path.UserDelegateBean
	at
org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:1066)
	at
org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:684)
	at
org.apache.openejb.config.AnnotationDeployer.deploy(AnnotationDeployer.java:194)
	at
org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:248)
	at
org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:626)
	at
org.apache.openejb.tomcat.catalina.TomcatWebAppBuilder.checkHost(TomcatWebAppBuilder.java:499)
	at
org.apache.openejb.tomcat.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:74)
	at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
	at
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1385)
	at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1649)
	at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1658)
	at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1638)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: package.path.UserDelegateBean
	at
org.apache.openejb.core.TempClassLoader.loadClass(TempClassLoader.java:100)
	at
org.apache.openejb.core.TempClassLoader.loadClass(TempClassLoader.java:66)
	at
org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:1064)
	... 12 more
	
But, when I look on my JARs (inside the EAR), I can see the user_bean.jar,
which, inside, has the class package.path.UserDelegateBean. Then, I checked
the ejb-jar.xml, to see if the definition was ok, and, there it is:

&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!doctype ejb-jar public "-//sun microsystems, inc.//dtd enterprise
javabeans 2.0//en" "http://java.sun.com/dtd/ejb-jar_2_0.dtd"&gt;
&lt;ejb-jar&gt;
  &lt;enterprise-beans&gt;
	...
    &lt;session&gt;
      &lt;display-name&gt;UserDelegate&lt;/display-name&gt;
      &lt;ejb-name&gt;UserDelegate&lt;/ejb-name&gt;
      &lt;home&gt;package.path.UserDelegateHome&lt;/home&gt;
      &lt;remote&gt;package.path.UserDelegate&lt;/remote&gt;
      &lt;ejb-class&gt;package.path.UserDelegateBean&lt;/ejb-class&gt;
      &lt;session-type&gt;Stateless&lt;/session-type&gt;
      &lt;transaction-type&gt;Container&lt;/transaction-type&gt;
      &lt;ejb-local-ref&gt;
        &lt;ejb-ref-name&gt;ejb/UserFacade&lt;/ejb-ref-name&gt;
        &lt;ejb-ref-type&gt;Session&lt;/ejb-ref-type&gt;
        &lt;local-home&gt;package.path.UserLocalHome&lt;/local-home&gt;
        &lt;local&gt;package.path.UserFacadeLocal&lt;/local&gt;
      &lt;/ejb-local-ref&gt;
    &lt;/session&gt;
	...
  &lt;/enterprise-beans&gt;
&lt;/ejb-jar&gt;
...

The only other related topic I found was this one: 
http://www.mail-archive.com/users@openejb.apache.org/msg02448.html
http://www.mail-archive.com/users@openejb.apache.org/msg02448.html , but,
from what I understood, it appears to be a problem related to Glassfish
libraries.

What is intriguing me is that this same application is running fine (and in
production) on a different application server (it's BES, from Borland, and
we are trying to get rid of it ).

(Please apologize for any misspelling, English is not my native language).

Thanks


--
View this message in context: http://openejb.979440.n4.nabble.com/java-lang-Exception-Could-not-load-tp3381979p3381979.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: java.lang.Exception: Could not load...

Posted by AndyG <an...@orprovision.com>.
 I was kind of wondering if the code had been generated or something to get
that in there.

Anyway, it does not help your situation. Are you in a position to check out,
compile and test using the svn trunk? 

Also have a look at
http://openejb.apache.org/3.0/embedded-configuration.html and
http://openejb.apache.org/3.0/system-properties.html, then progressively
turn up the level of debugging and verbosity to try and squeeze more
information out of the system:

log4j.category.OpenEJB.options=debug
log4j.category.OpenEJB.startup=debug
log4j.category.OpenEJB.startup.config=debug

openejb.descriptors.output=true
openejb.validation.output.level=verbose

--
View this message in context: http://openejb.979440.n4.nabble.com/java-lang-Exception-Could-not-load-tp3381979p3383872.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: java.lang.Exception: Could not load...

Posted by Alys <al...@gmail.com>.
Hi Andy,

Thanks for the answer. But, actually, that was my bad. By contract, I am not
allowed to divulge any code of the application, and, by extension, no names
of classes or packages (yeah, this really doesn't help). So, I used
"package.path" as an alias for the real package, but I was dumb enough not
to explain it. 

The real package does not have reserved words on it (its something like
com.name_of_project.name_of_application.module.type).

I'm really sorry for that. My apologies.

--
View this message in context: http://openejb.979440.n4.nabble.com/java-lang-Exception-Could-not-load-tp3381979p3382900.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: java.lang.Exception: Could not load...

Posted by Andy <an...@orprovision.com>.
On 16.03.2011 15:55, Alys wrote:
> Hello,
>
> I have an old project, built in Java 1.4, EJB 2.1 and Struts 1, and I'm
> trying to migrate it to OpenEJB, but I'm facing some problems.
>
> The environment is configured with:
> 	Apache Tomcat 6.0.32
> 	OpenEJB  3.1.4
> 	Windows XP Professional
> 	
> I was using the bundle version (download file tomee-6.0.29.314.zip), but,
> with the errors I was getting, I tried to upgrade Tomcat's version. Since
> the application is old, it have a tradicional build.xml file, we don't use
> an IDE or Maven to do the deploy.
>
> The application has several EJBs and WEB modules (inside JARs and WARs
> files), and everything is packed inside an EAR file. First, I tried to
> deploy this EAR, but, it didn't worked. I kept getting some errors in Struts
> (just like this post:
> http://openejb.979440.n4.nabble.com/OpenEJB-has-encountered-a-fatal-error-and-cannot-be-started-javax-servlet-jsp-jstl-core-ConditionalT-tp3071912p3071912.html
> http://openejb.979440.n4.nabble.com/OpenEJB-has-encountered-a-fatal-error-and-cannot-be-started-javax-servlet-jsp-jstl-core-ConditionalT-tp3071912p3071912.html
> ) and, even changing Tomcat's version didn't solved it.
>
> So, I changed my approach and removed the WARs from the EAR, and now I'm
> putting then direct on Tomcat's webapp folder (so that Tomcat will be
> responsible for validating the struts-config file inside the WARs, and not
> OpenEJB). This worked well, at least for the web modules, but now I'm
> getting errors while deploying my EJBs.
>
> The server starts ok, with no errors. But, when it starts deploying the
> EJBs, I get a thousand errors like this:
>
> java.lang.Exception: Could not load package/path/NameOfTheClass.class
>          at
> org.apache.xbean.finder.ClassFinder.readClassDef(ClassFinder.java:270)
>          at org.apache.xbean.finder.ClassFinder.(ClassFinder.java:125)
>          at org.apache.xbean.finder.ClassFinder.(ClassFinder.java:97)
>          at
> org.apache.openejb.config.AnnotationDeployer$DiscoverAnnotatedBeans.deploy(AnnotationDeployer.java:426)
>          at
> org.apache.openejb.config.AnnotationDeployer$DiscoverAnnotatedBeans.deploy(AnnotationDeployer.java:257)
>          at
> org.apache.openejb.config.AnnotationDeployer.deploy(AnnotationDeployer.java:192)
>          at
> org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:248)
>          at
> org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:626)
>          at
> org.apache.openejb.tomcat.catalina.TomcatWebAppBuilder.checkHost(TomcatWebAppBuilder.java:499)
>          at
> org.apache.openejb.tomcat.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:74)
>          at
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
>          at
> org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1385)
>          at
> org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1649)
>          at
> org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1658)
>          at
> org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1638)
>          at java.lang.Thread.run(Thread.java:619)
> 	
> No other error appears, just that, many times, with many different classes.
> 	
> Checking on Google, I found on this link a mail about this same problem:
> http://osdir.com/ml/users.openejb.apache.org/2009-06/msg00046.html,
> regarding a problem in xbean-finder-shaded. Even the topic being a little
> old, I tried to do that, downloaded the JAR and replaced it inside OpenEJB
> lib folder. But, now I get the problem:
>
> org.apache.openejb.OpenEJBException: Unable to load bean class:
> package.path.UserDelegateBean: package.path.UserDelegateBean
> 	at
> org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:1066)
> 	at
> org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:684)
> 	at
> org.apache.openejb.config.AnnotationDeployer.deploy(AnnotationDeployer.java:194)
> 	at
> org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:248)
> 	at
> org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:626)
> 	at
> org.apache.openejb.tomcat.catalina.TomcatWebAppBuilder.checkHost(TomcatWebAppBuilder.java:499)
> 	at
> org.apache.openejb.tomcat.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:74)
> 	at
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
> 	at
> org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1385)
> 	at
> org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1649)
> 	at
> org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1658)
> 	at
> org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1638)
> 	at java.lang.Thread.run(Thread.java:619)
> Caused by: java.lang.ClassNotFoundException: package.path.UserDelegateBean
> 	at
> org.apache.openejb.core.TempClassLoader.loadClass(TempClassLoader.java:100)
> 	at
> org.apache.openejb.core.TempClassLoader.loadClass(TempClassLoader.java:66)
> 	at
> org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:1064)
> 	... 12 more
> 	
> But, when I look on my JARs (inside the EAR), I can see the user_bean.jar,
> which, inside, has the class package.path.UserDelegateBean. Then, I checked
> the ejb-jar.xml, to see if the definition was ok, and, there it is:
>
> &lt;?xml version="1.0" encoding="utf-8"?&gt;
> &lt;!doctype ejb-jar public "-//sun microsystems, inc.//dtd enterprise
> javabeans 2.0//en" "http://java.sun.com/dtd/ejb-jar_2_0.dtd"&gt;
> &lt;ejb-jar&gt;
>    &lt;enterprise-beans&gt;
> 	...
>      &lt;session&gt;
>        &lt;display-name&gt;UserDelegate&lt;/display-name&gt;
>        &lt;ejb-name&gt;UserDelegate&lt;/ejb-name&gt;
>        &lt;home&gt;package.path.UserDelegateHome&lt;/home&gt;
>        &lt;remote&gt;package.path.UserDelegate&lt;/remote&gt;
>        &lt;ejb-class&gt;package.path.UserDelegateBean&lt;/ejb-class&gt;
>        &lt;session-type&gt;Stateless&lt;/session-type&gt;
>        &lt;transaction-type&gt;Container&lt;/transaction-type&gt;
>        &lt;ejb-local-ref&gt;
>          &lt;ejb-ref-name&gt;ejb/UserFacade&lt;/ejb-ref-name&gt;
>          &lt;ejb-ref-type&gt;Session&lt;/ejb-ref-type&gt;
>          &lt;local-home&gt;package.path.UserLocalHome&lt;/local-home&gt;
>          &lt;local&gt;package.path.UserFacadeLocal&lt;/local&gt;
>        &lt;/ejb-local-ref&gt;
>      &lt;/session&gt;
> 	...
>    &lt;/enterprise-beans&gt;
> &lt;/ejb-jar&gt;
> ...
>
> The only other related topic I found was this one:
> http://www.mail-archive.com/users@openejb.apache.org/msg02448.html
> http://www.mail-archive.com/users@openejb.apache.org/msg02448.html , but,
> from what I understood, it appears to be a problem related to Glassfish
> libraries.
>
> What is intriguing me is that this same application is running fine (and in
> production) on a different application server (it's BES, from Borland, and
> we are trying to get rid of it ).
>
> (Please apologize for any misspelling, English is not my native language).
>
> Thanks
>
>
> --
> View this message in context: http://openejb.979440.n4.nabble.com/java-lang-Exception-Could-not-load-tp3381979p3381979.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
>
Hi Alys,

It should not be possible to use the 'package' keyword in a name space.
Try a different namespace such as pack.path.UserDelegateBean

Andy.