You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by exabrial12 <ex...@gmail.com> on 2013/05/29 06:16:20 UTC
JAX-RS and OpenEJB Standalone
I have an application that just gets/puts RESTful stuff all day, written
completely in CDI. I don't have a use for the JSF/JSP/EJB side of TomEE in
this particular app.
Here is what I've put into an EJB project, then included that in an EAR
that's being deployed /apps. The server starts fine, but it's not deploying
the JAX-RS Application.
@ApplicationPath("/api")
public class FormsApplication extends Application {
/**
* {@inheritDoc}
*/
@Override
public Set<Class<?>> getClasses() {
return new HashSet<Class<?>>(Arrays.asList(JSONEndpoint.class,
XMLEndpoint.class, RestExceptionMapper.class));
}
}
@Path("json/forms")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class JSONEndpoint extends FormsRestController {
}
@ApplicationScoped
public abstract class FormsRestController {
@Inject
private Logger log;
@Inject
private Event<LifeInsuranceForm> lifeBus;
@POST
@Path("lifeInsurance/submit")
public void submit(LifeInsuranceForm lifeInsuranceForm) throws Exception
{
log.debug("create() invoked LifeInsuranceForm:{}",
lifeInsuranceForm);
validate(lifeInsuranceForm, LifeInsuranceGroup.class);
lifeBus.fire(lifeInsuranceForm);
}
}
I feel like I'm missing something painfully obvious and stupid.
--
View this message in context: http://openejb.979440.n4.nabble.com/JAX-RS-and-OpenEJB-Standalone-tp4663308.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: JAX-RS and OpenEJB Standalone
Posted by exabrial12 <ex...@gmail.com>.
Ah nuts... the OpenEJB Server plugin for Eclipse doesn't allow you do add a
WAR to a server.
--
View this message in context: http://openejb.979440.n4.nabble.com/JAX-RS-and-OpenEJB-Standalone-tp4663308p4663320.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: JAX-RS and OpenEJB Standalone
Posted by Jean-Louis MONTEIRO <je...@gmail.com>.
+1 not sure it's specified for an EAR
2013/5/29 Romain Manni-Bucau <rm...@gmail.com>
> Hi
>
> does it work in a war (even in an ear)?
>
> JAXRS is not defined for ear IIRC so not sure it can be deployed from it.
> If it works from a war just declare it in your web.xml and all should be
> fine without modifying that much your packaging
>
> *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/5/29 exabrial12 <ex...@gmail.com>
>
> > I have an application that just gets/puts RESTful stuff all day, written
> > completely in CDI. I don't have a use for the JSF/JSP/EJB side of TomEE
> in
> > this particular app.
> >
> > Here is what I've put into an EJB project, then included that in an EAR
> > that's being deployed /apps. The server starts fine, but it's not
> deploying
> > the JAX-RS Application.
> >
> > @ApplicationPath("/api")
> > public class FormsApplication extends Application {
> > /**
> > * {@inheritDoc}
> > */
> > @Override
> > public Set<Class<?>> getClasses() {
> > return new HashSet<Class<?>>(Arrays.asList(JSONEndpoint.class,
> > XMLEndpoint.class, RestExceptionMapper.class));
> > }
> > }
> >
> > @Path("json/forms")
> > @Consumes(MediaType.APPLICATION_JSON)
> > @Produces(MediaType.APPLICATION_JSON)
> > public class JSONEndpoint extends FormsRestController {
> > }
> >
> > @ApplicationScoped
> > public abstract class FormsRestController {
> > @Inject
> > private Logger log;
> > @Inject
> > private Event<LifeInsuranceForm> lifeBus;
> >
> > @POST
> > @Path("lifeInsurance/submit")
> > public void submit(LifeInsuranceForm lifeInsuranceForm) throws
> > Exception
> > {
> > log.debug("create() invoked LifeInsuranceForm:{}",
> > lifeInsuranceForm);
> > validate(lifeInsuranceForm, LifeInsuranceGroup.class);
> > lifeBus.fire(lifeInsuranceForm);
> > }
> > }
> >
> > I feel like I'm missing something painfully obvious and stupid.
> >
> >
> >
> > --
> > View this message in context:
> >
> http://openejb.979440.n4.nabble.com/JAX-RS-and-OpenEJB-Standalone-tp4663308.html
> > Sent from the OpenEJB User mailing list archive at Nabble.com.
> >
>
--
Jean-Louis
Re: JAX-RS and OpenEJB Standalone
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi
does it work in a war (even in an ear)?
JAXRS is not defined for ear IIRC so not sure it can be deployed from it.
If it works from a war just declare it in your web.xml and all should be
fine without modifying that much your packaging
*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/5/29 exabrial12 <ex...@gmail.com>
> I have an application that just gets/puts RESTful stuff all day, written
> completely in CDI. I don't have a use for the JSF/JSP/EJB side of TomEE in
> this particular app.
>
> Here is what I've put into an EJB project, then included that in an EAR
> that's being deployed /apps. The server starts fine, but it's not deploying
> the JAX-RS Application.
>
> @ApplicationPath("/api")
> public class FormsApplication extends Application {
> /**
> * {@inheritDoc}
> */
> @Override
> public Set<Class<?>> getClasses() {
> return new HashSet<Class<?>>(Arrays.asList(JSONEndpoint.class,
> XMLEndpoint.class, RestExceptionMapper.class));
> }
> }
>
> @Path("json/forms")
> @Consumes(MediaType.APPLICATION_JSON)
> @Produces(MediaType.APPLICATION_JSON)
> public class JSONEndpoint extends FormsRestController {
> }
>
> @ApplicationScoped
> public abstract class FormsRestController {
> @Inject
> private Logger log;
> @Inject
> private Event<LifeInsuranceForm> lifeBus;
>
> @POST
> @Path("lifeInsurance/submit")
> public void submit(LifeInsuranceForm lifeInsuranceForm) throws
> Exception
> {
> log.debug("create() invoked LifeInsuranceForm:{}",
> lifeInsuranceForm);
> validate(lifeInsuranceForm, LifeInsuranceGroup.class);
> lifeBus.fire(lifeInsuranceForm);
> }
> }
>
> I feel like I'm missing something painfully obvious and stupid.
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/JAX-RS-and-OpenEJB-Standalone-tp4663308.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>