You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by jayleg <jl...@lenovo.com> on 2016/05/26 14:12:28 UTC

Error with TomeeJaxRsService when deploy application as .ear, but not when it is simply a .war

When deploying an application that contains a REST service as a .war, it
starts and runs fine.  However, when the same application is deployed as an
.ear, the following error occurs at startup.

org.apache.openejb.server.rest.OpenEJBRestRuntimeException: can't load class
com.test.Class1
        at
org.apache.openejb.server.rest.RESTService.afterApplicationCreated(RESTService.java:259)
        at
org.apache.tomee.webservices.TomeeJaxRsService.afterApplicationCreated(TomeeJaxRsService.java:53)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at
org.apache.openejb.observer.ObserverManager$MethodInvocation.invoke(ObserverManager.java:400)
        at
org.apache.openejb.observer.ObserverManager$InvocationList.invoke(ObserverManager.java:515)
        at
org.apache.openejb.observer.ObserverManager.doFire(ObserverManager.java:111)
        at
org.apache.openejb.observer.ObserverManager.fireEvent(ObserverManager.java:100)
        at
org.apache.openejb.loader.SystemInstance.fireEvent(SystemInstance.java:135)
        at
org.apache.tomee.catalina.TomcatWebAppBuilder.afterStart(TomcatWebAppBuilder.java:1661)
        at
org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:116)
        at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
        at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
        at
org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
        at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:168)
        at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
        at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.test.Class1
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1722)
        at
org.apache.tomee.catalina.LazyStopWebappClassLoader.loadWithDelegate(LazyStopWebappClassLoader.java:178)
        at
org.apache.tomee.catalina.LazyStopWebappClassLoader.loadClass(LazyStopWebappClassLoader.java:168)
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1573)
        at
org.apache.openejb.server.rest.RESTService.afterApplicationCreated(RESTService.java:246)
        ... 22 more

The .ear is simple and only contains the .war.  

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/application_6.xsd" id="Application_ID"
version="6">
  <display-name>TestApp</display-name>
  <module>
    <web>
      <web-uri>Test.war</web-uri>
      <context-root>Test</context-root>
    </web>
  </module>
</application>

Is this a bug or did I overlook something trivial?  Also, the MANIFEST.MF
only contains "Manifest-Version: 1.0".




--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Error-with-TomeeJaxRsService-when-deploy-application-as-ear-but-not-when-it-is-simply-a-war-tp4678607.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Error with TomeeJaxRsService when deploy application as .ear, but not when it is simply a .war

Posted by Romain Manni-Bucau <rm...@gmail.com>.
is it with tomee 7M3? if not you should give it a try, if yes can you put
it together with tomee-maven-plugin to start your sample project on github
to let us check/reproduce please?


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-05-26 16:24 GMT+02:00 jayleg <jl...@lenovo.com>:

> When testing the app as an .ear, I deployed it in the apps directory, and
> as
> a .war, I deployed it to the webapps directory.  Both the .ear and .war
> versions of the app were not deployed at the same time.  The extracted
> directories were removed between tests.
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Error-with-TomeeJaxRsService-when-deploy-application-as-ear-but-not-when-it-is-simply-a-war-tp4678607p4678609.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: Error with TomeeJaxRsService when deploy application as .ear, but not when it is simply a .war

Posted by jayleg <jl...@lenovo.com>.
When testing the app as an .ear, I deployed it in the apps directory, and as
a .war, I deployed it to the webapps directory.  Both the .ear and .war
versions of the app were not deployed at the same time.  The extracted
directories were removed between tests.



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Error-with-TomeeJaxRsService-when-deploy-application-as-ear-but-not-when-it-is-simply-a-war-tp4678607p4678609.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Error with TomeeJaxRsService when deploy application as .ear, but not when it is simply a .war

Posted by Romain Manni-Bucau <rm...@gmail.com>.
how did you deploy it? in apps/?


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-05-26 16:12 GMT+02:00 jayleg <jl...@lenovo.com>:

> When deploying an application that contains a REST service as a .war, it
> starts and runs fine.  However, when the same application is deployed as an
> .ear, the following error occurs at startup.
>
> org.apache.openejb.server.rest.OpenEJBRestRuntimeException: can't load
> class
> com.test.Class1
>         at
>
> org.apache.openejb.server.rest.RESTService.afterApplicationCreated(RESTService.java:259)
>         at
>
> org.apache.tomee.webservices.TomeeJaxRsService.afterApplicationCreated(TomeeJaxRsService.java:53)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:497)
>         at
>
> org.apache.openejb.observer.ObserverManager$MethodInvocation.invoke(ObserverManager.java:400)
>         at
>
> org.apache.openejb.observer.ObserverManager$InvocationList.invoke(ObserverManager.java:515)
>         at
>
> org.apache.openejb.observer.ObserverManager.doFire(ObserverManager.java:111)
>         at
>
> org.apache.openejb.observer.ObserverManager.fireEvent(ObserverManager.java:100)
>         at
> org.apache.openejb.loader.SystemInstance.fireEvent(SystemInstance.java:135)
>         at
>
> org.apache.tomee.catalina.TomcatWebAppBuilder.afterStart(TomcatWebAppBuilder.java:1661)
>         at
>
> org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:116)
>         at
>
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
>         at
>
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
>         at
>
> org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
>         at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:168)
>         at
>
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
>         at
>
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>         at
>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>         at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>         at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.ClassNotFoundException: com.test.Class1
>         at
>
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1722)
>         at
>
> org.apache.tomee.catalina.LazyStopWebappClassLoader.loadWithDelegate(LazyStopWebappClassLoader.java:178)
>         at
>
> org.apache.tomee.catalina.LazyStopWebappClassLoader.loadClass(LazyStopWebappClassLoader.java:168)
>         at
>
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1573)
>         at
>
> org.apache.openejb.server.rest.RESTService.afterApplicationCreated(RESTService.java:246)
>         ... 22 more
>
> The .ear is simple and only contains the .war.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/application_6.xsd" id="Application_ID"
> version="6">
>   <display-name>TestApp</display-name>
>   <module>
>     <web>
>       <web-uri>Test.war</web-uri>
>       <context-root>Test</context-root>
>     </web>
>   </module>
> </application>
>
> Is this a bug or did I overlook something trivial?  Also, the MANIFEST.MF
> only contains "Manifest-Version: 1.0".
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Error-with-TomeeJaxRsService-when-deploy-application-as-ear-but-not-when-it-is-simply-a-war-tp4678607.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: Error with TomeeJaxRsService when deploy application as .ear, but not when it is simply a .war

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Without a sample hard to say

FYI tested such an ear on 7.0.0 and it works. I suspect it is linked to
something else than the packaging (like the configuration or code
dependencies)


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-06-15 19:27 GMT+02:00 jayleg <jl...@lenovo.com>:

> The same problem occurs after upgrading to 1.7.4.
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Error-with-TomeeJaxRsService-when-deploy-application-as-ear-but-not-when-it-is-simply-a-war-tp4678607p4678900.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: Error with TomeeJaxRsService when deploy application as .ear, but not when it is simply a .war

Posted by jayleg <jl...@lenovo.com>.
The same problem occurs after upgrading to 1.7.4.



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Error-with-TomeeJaxRsService-when-deploy-application-as-ear-but-not-when-it-is-simply-a-war-tp4678607p4678900.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Error with TomeeJaxRsService when deploy application as .ear, but not when it is simply a .war

Posted by Romain Manni-Bucau <rm...@gmail.com>.
maybe give it a try at least on 1.7.4 if you cant use the 7 but otherwise
we would need a project to reproduce.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-05-26 16:32 GMT+02:00 jayleg <jl...@lenovo.com>:

> Sorry...forgot to post version.
>
> I'm using TomEE Plus 1.7.3
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Error-with-TomeeJaxRsService-when-deploy-application-as-ear-but-not-when-it-is-simply-a-war-tp4678607p4678611.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: Error with TomeeJaxRsService when deploy application as .ear, but not when it is simply a .war

Posted by jayleg <jl...@lenovo.com>.
Sorry...forgot to post version.

I'm using TomEE Plus 1.7.3



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Error-with-TomeeJaxRsService-when-deploy-application-as-ear-but-not-when-it-is-simply-a-war-tp4678607p4678611.html
Sent from the TomEE Users mailing list archive at Nabble.com.