You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Ingo Mahnke <in...@quvion.org> on 2016/12/15 10:35:48 UTC

TomEE and Rest

Hallo,
currenty I try to use Rest-Services with tomee (1.7.4) and have a problem.
Does anybody know a good tuotrial for this (for tomee)?

During deployment I always get this exception:
error invoking org.apache.openejb.server.cxf.rs.CxfRSService@733037
java.lang.IllegalStateException: Invalid context 'qvn-server'.  Cannot find context in host localhost
	at org.apache.tomee.webservices.TomcatRsRegistry.createRsHttpListener(TomcatRsRegistry.java:103)
	at org.apache.openejb.server.rest.RESTService.deployApplication(RESTService.java:461)


"qvn-server" is the name of the ear-file. This file contains three ejb-modules and one ejb module contains a class
like this:



.................
@Stateless
@LocalBean
@Path("/subscriber")
public class SubscriberService {


    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @Path("{id}")
    public MailingListSubscriber read(@PathParam("id") long id) {
   .....

        return new MailingListSubscriber();
    }


} 
...................

Is it nessesary to make some setup within tomee (context.xml)? 
I tried this but with no success?


Thank you
Ingo




Aw: Re: TomEE and Rest

Posted by Ingo Mahnke <in...@quvion.org>.
Thank you!!


> Gesendet: Donnerstag, 15. Dezember 2016 um 11:53 Uhr
> Von: "Andy Gumbrecht" <ag...@tomitribe.com>
> An: "users@tomee.apache.org" <us...@tomee.apache.org>
> Betreff: Re: TomEE and Rest
>
> Here's a good resource project:
> 
> http://www.tomitribe.com/blog/2014/06/apache-tomee-jax-rs-and-arquillian-starter-project/
> 
> You might also want to add something like this to give you a path context
> for rest calls:
> 
> https://github.com/tomitribe/rest-example/blob/master/src/main/java/org/superbiz/rest/ApplicationConfig.java
> 
> TomEE logging is usually pretty good, so scan the log files for other
> issues or warnings.
> 
> Andy.
> 
> On 15 December 2016 at 11:35, Ingo Mahnke <in...@quvion.org> wrote:
> 
> > Hallo,
> > currenty I try to use Rest-Services with tomee (1.7.4) and have a problem.
> > Does anybody know a good tuotrial for this (for tomee)?
> >
> > During deployment I always get this exception:
> > error invoking org.apache.openejb.server.cxf.rs.CxfRSService@733037
> > java.lang.IllegalStateException: Invalid context 'qvn-server'.  Cannot
> > find context in host localhost
> >         at org.apache.tomee.webservices.TomcatRsRegistry.
> > createRsHttpListener(TomcatRsRegistry.java:103)
> >         at org.apache.openejb.server.rest.RESTService.
> > deployApplication(RESTService.java:461)
> >
> >
> > "qvn-server" is the name of the ear-file. This file contains three
> > ejb-modules and one ejb module contains a class
> > like this:
> >
> >
> >
> > .................
> > @Stateless
> > @LocalBean
> > @Path("/subscriber")
> > public class SubscriberService {
> >
> >
> >     @GET
> >     @Produces(MediaType.APPLICATION_JSON)
> >     @Path("{id}")
> >     public MailingListSubscriber read(@PathParam("id") long id) {
> >    .....
> >
> >         return new MailingListSubscriber();
> >     }
> >
> >
> > }
> > ...................
> >
> > Is it nessesary to make some setup within tomee (context.xml)?
> > I tried this but with no success?
> >
> >
> > Thank you
> > Ingo
> >
> >
> >
> >
> 
> 
> -- 
>   Andy Gumbrecht
>   https://twitter.com/AndyGeeDe
>   http://www.tomitribe.com
> 

Re: TomEE and Rest

Posted by Andy Gumbrecht <ag...@tomitribe.com>.
Here's a good resource project:

http://www.tomitribe.com/blog/2014/06/apache-tomee-jax-rs-and-arquillian-starter-project/

You might also want to add something like this to give you a path context
for rest calls:

https://github.com/tomitribe/rest-example/blob/master/src/main/java/org/superbiz/rest/ApplicationConfig.java

TomEE logging is usually pretty good, so scan the log files for other
issues or warnings.

Andy.

On 15 December 2016 at 11:35, Ingo Mahnke <in...@quvion.org> wrote:

> Hallo,
> currenty I try to use Rest-Services with tomee (1.7.4) and have a problem.
> Does anybody know a good tuotrial for this (for tomee)?
>
> During deployment I always get this exception:
> error invoking org.apache.openejb.server.cxf.rs.CxfRSService@733037
> java.lang.IllegalStateException: Invalid context 'qvn-server'.  Cannot
> find context in host localhost
>         at org.apache.tomee.webservices.TomcatRsRegistry.
> createRsHttpListener(TomcatRsRegistry.java:103)
>         at org.apache.openejb.server.rest.RESTService.
> deployApplication(RESTService.java:461)
>
>
> "qvn-server" is the name of the ear-file. This file contains three
> ejb-modules and one ejb module contains a class
> like this:
>
>
>
> .................
> @Stateless
> @LocalBean
> @Path("/subscriber")
> public class SubscriberService {
>
>
>     @GET
>     @Produces(MediaType.APPLICATION_JSON)
>     @Path("{id}")
>     public MailingListSubscriber read(@PathParam("id") long id) {
>    .....
>
>         return new MailingListSubscriber();
>     }
>
>
> }
> ...................
>
> Is it nessesary to make some setup within tomee (context.xml)?
> I tried this but with no success?
>
>
> Thank you
> Ingo
>
>
>
>


-- 
  Andy Gumbrecht
  https://twitter.com/AndyGeeDe
  http://www.tomitribe.com

Aw: Re: TomEE and Rest

Posted by Ingo Mahnke <in...@quvion.org>.
Thank you Romain!
I tried the and got an other exception:

Dez 15, 2016 11:49:55 AM org.apache.openejb.assembler.DeployerEjb deploy
SCHWERWIEGEND: Can't deploy C:\Development\Projects\QuvionSystem\quvion\qvn-server\target\intellij_build\qvn-server-1.0.ear
java.lang.ClassCastException: java.net.URL cannot be cast to java.util.List
	at org.apache.openejb.config.DeploymentLoader.addWebModule(DeploymentLoader.java:800)
	at org.apache.openejb.config.DeploymentLoader.addWebModule(DeploymentLoader.java:789)
	at org.apache.openejb.config.DeploymentLoader.createAppModule(DeploymentLoader.java:596)

The EAR now contains one web module and tree ejb modules?

Is this a kown bug? 

I found something like this in a message in 2013: 
http://tomee-openejb.979440.n4.nabble.com/java-lang-ClassCastException-java-net-URL-cannot-be-cast-to-java-util-List-td4666501.html


Best regards
Ingo








> Gesendet: Donnerstag, 15. Dezember 2016 um 11:42 Uhr
> Von: "Romain Manni-Bucau" <rm...@gmail.com>
> An: "users@tomee.apache.org" <us...@tomee.apache.org>
> Betreff: Re: TomEE and Rest
>
> Hi
> 
> maybe just move the rest endpoint to a web module
> 
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
> 
> 2016-12-15 11:35 GMT+01:00 Ingo Mahnke <in...@quvion.org>:
> 
> > Hallo,
> > currenty I try to use Rest-Services with tomee (1.7.4) and have a problem.
> > Does anybody know a good tuotrial for this (for tomee)?
> >
> > During deployment I always get this exception:
> > error invoking org.apache.openejb.server.cxf.rs.CxfRSService@733037
> > java.lang.IllegalStateException: Invalid context 'qvn-server'.  Cannot
> > find context in host localhost
> >         at org.apache.tomee.webservices.TomcatRsRegistry.
> > createRsHttpListener(TomcatRsRegistry.java:103)
> >         at org.apache.openejb.server.rest.RESTService.
> > deployApplication(RESTService.java:461)
> >
> >
> > "qvn-server" is the name of the ear-file. This file contains three
> > ejb-modules and one ejb module contains a class
> > like this:
> >
> >
> >
> > .................
> > @Stateless
> > @LocalBean
> > @Path("/subscriber")
> > public class SubscriberService {
> >
> >
> >     @GET
> >     @Produces(MediaType.APPLICATION_JSON)
> >     @Path("{id}")
> >     public MailingListSubscriber read(@PathParam("id") long id) {
> >    .....
> >
> >         return new MailingListSubscriber();
> >     }
> >
> >
> > }
> > ...................
> >
> > Is it nessesary to make some setup within tomee (context.xml)?
> > I tried this but with no success?
> >
> >
> > Thank you
> > Ingo
> >
> >
> >
> >
> 

Re: TomEE and Rest

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

maybe just move the rest endpoint to a web module


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

2016-12-15 11:35 GMT+01:00 Ingo Mahnke <in...@quvion.org>:

> Hallo,
> currenty I try to use Rest-Services with tomee (1.7.4) and have a problem.
> Does anybody know a good tuotrial for this (for tomee)?
>
> During deployment I always get this exception:
> error invoking org.apache.openejb.server.cxf.rs.CxfRSService@733037
> java.lang.IllegalStateException: Invalid context 'qvn-server'.  Cannot
> find context in host localhost
>         at org.apache.tomee.webservices.TomcatRsRegistry.
> createRsHttpListener(TomcatRsRegistry.java:103)
>         at org.apache.openejb.server.rest.RESTService.
> deployApplication(RESTService.java:461)
>
>
> "qvn-server" is the name of the ear-file. This file contains three
> ejb-modules and one ejb module contains a class
> like this:
>
>
>
> .................
> @Stateless
> @LocalBean
> @Path("/subscriber")
> public class SubscriberService {
>
>
>     @GET
>     @Produces(MediaType.APPLICATION_JSON)
>     @Path("{id}")
>     public MailingListSubscriber read(@PathParam("id") long id) {
>    .....
>
>         return new MailingListSubscriber();
>     }
>
>
> }
> ...................
>
> Is it nessesary to make some setup within tomee (context.xml)?
> I tried this but with no success?
>
>
> Thank you
> Ingo
>
>
>
>