Jaxrs and jaxws are for sure but for jaxws you need to map them in web.xml Le 5 mars 2013 22:56, "James Green" <james.mk.gr...@gmail.com> a écrit :
> The only producers I have our POJO Factories for my Mongo DAOs. They all > @Inject an @ApplicationScoped datasource which itself holds the Mongo > client connection. > > So web-tier.war depending-on service-tier.jar depending-on > persistence-tier.jar each with beans.xml. > > Should I expect JAX-RS and JAX-WS web tier POJOs to be scanned for without > being EJB annotated? I ask as I'm pretty sure Glassfish does "notice" them > - what I don't recall is whether any CDI scope such as @RequestScoped is > needed. > > James > > > > On 5 March 2013 21:23, Romain Manni-Bucau <rmannibu...@gmail.com> wrote: > > > Yes a jar without a beans.xml is not a cdi one. About webservices maybe > you > > hit the fact a pojo one (not ejb) should be defined in web.xml. finally > you > > are right about pooling (but a lot of mongo stuff is thread safe. > Producers > > with scopes (reauest?) can be another answer > > Le 5 mars 2013 22:13, "James Green" <james.mk.gr...@gmail.com> a écrit : > > > > > I only added @Stateless to my @WebService classes because of deployment > > > errors in TomEE. They worked fine in Glassfish. Figured perhaps CDI > > wasn't > > > as mature in TomEE? > > > > > > Didn't realise beans.xml had to go into each jar. Will add. > > > > > > If I'm reading this right, POJOs @Injected into a SLSB will share the > > scope > > > of the SLSB. So if the EJB container pools the SLSBs (my web tier), it > > will > > > also pool the POJOs? I'm balancing the need for thread safety with new > > > instances everywhere, and memory churn with GC pauses. > > > > > > James > > > > > > > > > > > > On 5 March 2013 20:45, Romain Manni-Bucau <rmannibu...@gmail.com> > wrote: > > > > > > > Hi > > > > > > > > It works, ensure you have a beans.xml in each jar + about annotations > > > check > > > > your need but @applicationscoped is tempting. > > > > > > > > Finally sharing your exception can help too > > > > Le 5 mars 2013 21:39, "James Green" <james.mk.gr...@gmail.com> a > > écrit : > > > > > > > > > I've spent the past year developing a Java EE 6 application with > > JAX-RS > > > > and > > > > > JAX-WS endpoints. Each of these are annotated @Stateless. > > > > > > > > > > The project exists currently as a single maven project of war > > packaging > > > > > type. I would like to split this up by tier - web, service, > database > > - > > > > as I > > > > > suspect many other people do things this way to spread workload > > between > > > > > staff. > > > > > > > > > > My "service" layer is currently a set of POJOs. They are @Injected > > into > > > > the > > > > > web service layer. Similarly, the database layer is @Injected into > > the > > > > > service layer. > > > > > > > > > > Two questions emerge and I'd like some experienced voices on the > > > matter. > > > > > > > > > > 1. Should I be able to push the service and database classes down > > into > > > a > > > > > separate jar file, and have the existing war project depend on > that? > > > > > > > > > > 2. Should the service and database (DAO) layers have any container > > > > > annotations? > > > > > > > > > > This is a bit of a loaded question since I tried to push down the > > > service > > > > > and database tiers of one of my java packages but it blew up during > > > > > deployment with the likes of > > > > > > > > > > > > > > > > > > > > http://docs.oracle.com/javaee/6/api/javax/enterprise/inject/IllegalProductException.html > > > > > > > > > > Bear in mind that our database is MongoDB, so I have no need for > EJBs > > > for > > > > > transaction and I'm not using EJB for security either, hence beyond > > the > > > > web > > > > > tier everything is CDI. > > > > > > > > > > Thanks for your time in advance. > > > > > > > > > > James > > > > > > > > > > > > > > >