tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: JAX-WS without EJB (Stateless) but with CDI
Date Wed, 21 Aug 2013 08:44:05 GMT
Hi

for pojos you need to map them to a servlet in web.xml as the error states

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/8/21 Berner Martin <Martin.Berner@qualitasag.ch>

> Hi
> I have a Project for serving a JAX-WS Service.
> Data is stored in a Oracle Database 11g.
> In other Webprojects we discovered that it is a god Idea to have a
> EntityManager per Request and per Service.
>
> Simply annotate the Class BgsQualitas with @WebService produces the
> following Exception:
> java.lang.IllegalArgumentException: Could not find servlet
> ch.qualitasag.BgsQualitas.BgsQualitas in web application context
> /BgsQualitas
>        at
> org.apache.tomee.webservices.TomcatWsRegistry.setWsContainer(TomcatWsRegistry.java:107)
>        at
> org.apache.openejb.server.webservices.WsService.afterApplicationCreated(WsService.java:365)
>        at
> org.apache.tomee.webservices.TomeeJaxWsService.afterApplicationCreated(TomeeJaxWsService.java:54)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>        at java.lang.reflect.Method.invoke(Method.java:601)
>        at
> org.apache.openejb.observer.ObserverManager$Observer.invoke(ObserverManager.java:145)
>        at
> org.apache.openejb.observer.ObserverManager.fireEvent(ObserverManager.java:69)
>        at
> org.apache.openejb.loader.SystemInstance.fireEvent(SystemInstance.java:107)
>        at
> org.apache.tomee.catalina.TomcatWebAppBuilder.afterStart(TomcatWebAppBuilder.java:1241)
>        at
> org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:107)
>        at
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
>        at
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
>        at
> org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:401)
>        at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:168)
>        at
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
>        at
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
>        at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>        at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>        at java.lang.Thread.run(Thread.java:722)
>
> So I added @Stateles as mentioned in the TomEE documentation (
> http://tomee.apache.org/examples-trunk/simple-webservice/)
> But this makes it a EJB which I'm not familiar with.
>
> In BgsQualitas I inject a Bean "DataService" which is annotated
> @RequestScoped and has itself injected an EntityManager with
> @PersistenceContext to access the Database.
> Although DataService is every request an new Bean, EntityManager isn't.
>
> I think it has to do whit the EJB, where I don't really understand the
> Lifecycles of such a Beans and its Dependencies. But I can't get it work
> without the @Stateless.
> How do I do this. Or how do I influence the Lifetime of the injected
> EntityManager.
>
> A Way to do this, is to write my one Producer of EntityManager in which I
> inject a EntityManagerFactory and manage the Lifecycle myself.
> But if it is possible to do this in a simpler Way, I well preferred this.
>
> Best Regards
> Martin Berner
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message