You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Nick Khamis <sy...@gmail.com> on 2013/07/20 17:30:26 UTC

Tomee + JAX-RS 2.0

Ello Everyone!

Looking to pair Tomee Web Profile with JAX-RS 2.0. Non maven, copied
(javax.annotation-api-1.2.jar,
javax.ws.rs-api-2.0.jar), to lib folder, and have the rest of the libraries
in WEB-INF. The eclipse project compiles and runs with not errors or
warning however, nada, nothing, zilch, seepar!

I suspect it's using another rs implementation hidden somewhere in
javaee-api? I know that tomee targets jee6 however, it is a servlet 3.0
compliant as therefore, should make a nice home in terms of deployment.

Question, what is the best way to pair the two together, and would it be
stable for production?

Kind regards,

Nick from Toronto.

Re: Tomee + JAX-RS 2.0

Posted by Romain Manni-Bucau <rm...@gmail.com>.
well if you use 1.5.2 i think you can't, on trunk if you set a
servlet-class instance of a HttpServlet it will work.

*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/7/21 Nick Khamis <sy...@gmail.com>

> Hello Romain,
>
> Thanks again for your response. Just to clarify, am I not able to
> declaring root resource and provider classes and/or singleton
> instances using "javax.ws.rs.core.Application"? Maybe I am using the
> term "servlet" too loosely....
>
> We have quite a complex application and would like the flexibility of
> not having jersey seek out all the services automatically using:
> <param-name> jersey.config.server.provider.packages</param-name>"
>
> Kind Regards,
>
> N.
>

Re: Tomee + JAX-RS 2.0

Posted by Nick Khamis <sy...@gmail.com>.
Hello Romain,

Thanks again for your response. Just to clarify, am I not able to
declaring root resource and provider classes and/or singleton
instances using "javax.ws.rs.core.Application"? Maybe I am using the
term "servlet" too loosely....

We have quite a complex application and would like the flexibility of
not having jersey seek out all the services automatically using:
<param-name> jersey.config.server.provider.packages</param-name>"

Kind Regards,

N.

Re: Tomee + JAX-RS 2.0

Posted by Romain Manni-Bucau <rm...@gmail.com>.
maybe i'm mistaken (i didnt check last jersey) but that's not servlet 3.0
but JavaEE 6.

not sure you can define a servlet which is not a servlet (no servlet class)
;) + in last tomee versions we removed these servlets to avoid issues in
tomcat backbone since we were handling it in cxf integration

*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/7/21 Nick Khamis <sy...@gmail.com>

> correction: I was looking at 4.6 of
> https://jersey.java.net/documentation/latest/deployment.html#d0e2175.
> It was for JAX-RS 1.1 and "javax.ws.rs.Application" vs.
> "javax.ws.rs.core.Application".
>
> N.
>

Re: Tomee + JAX-RS 2.0

Posted by Nick Khamis <sy...@gmail.com>.
correction: I was looking at 4.6 of
https://jersey.java.net/documentation/latest/deployment.html#d0e2175.
It was for JAX-RS 1.1 and "javax.ws.rs.Application" vs.
"javax.ws.rs.core.Application".

N.

Re: Tomee + JAX-RS 2.0

Posted by Nick Khamis <sy...@gmail.com>.
Hello Romain,

Thank you so much for your response. It works fine when using standard
2.5 servlet:

<servlet>
	<servlet-name>CartService</servlet-name>
	<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
	<init-param>
		<param-name>jersey.config.server.provider.packages</param-name>
		<param-value>com.example.service</param-value>
	</init-param>
	<load-on-startup>1</load-on-startup>	
</servlet>
<servlet-mapping>
	<servlet-name>CartService</servlet-name>
	<url-pattern>/rs/*</url-pattern>
</servlet-mapping>
</web-app>

However, when trying to update to 3.0 servlet, and defining "
javax.ws.rs.core.Application" I am unable to fire the rs:

<servlet>
	<servlet-name>com.example.OrderApplication</servlet-name>	
     <load-on-startup>1</load-on-startup>
</servlet>	
<servlet-mapping>
	<servlet-name>com.example.OrderApplication</servlet-name>		
	<url-pattern>/rs/</url-pattern>		
</servlet-mapping>
</web-app>


public class OrderApplication extends Application {
    @Override
    public Set<Class<?>> getClasses() {
        Set<Class<?>> classes = new HashSet<Class<?>>();
        classes.add(OrderService.class);
        return classes;
    }
}

One note, in Example 4.5 of
https://jersey.java.net/documentation/latest/deployment.html#d0e2175,
they mention "javax.ws.rs.Application" but i
think they mean "com.example.OrderApplication".

I always struggle with servlets!!!

Thanks in Advance,

Nick.

Re: Tomee + JAX-RS 2.0

Posted by Romain Manni-Bucau <rm...@gmail.com>.
No we dont have javaee 7 spec jars.

The zip is here
http://repo1.maven.org/maven2/org/apache/openejb/javaee-api/6.0-5/
Le 21 juil. 2013 03:44, "Nick Khamis" <sy...@gmail.com> a écrit :

> Hello Romain,
>
> Thank you for your time. I did not want to assume however, the latest
> javaee-api in Maven is 6.0.5.
> Aren't you guys up to 7?
> http://mvnrepository.com/artifact/org.apache.openejb/javaee-api/6.0-5
> Also, I could not find a zip, only jar.
>
> Kind Regards,
>
> Nick.
>
>

Re: Tomee + JAX-RS 2.0

Posted by Nick Khamis <sy...@gmail.com>.
Hello Romain,

Thank you for your time. I did not want to assume however, the latest
javaee-api in Maven is 6.0.5.
Aren't you guys up to 7?
http://mvnrepository.com/artifact/org.apache.openejb/javaee-api/6.0-5
Also, I could not find a zip, only jar.

Kind Regards,

Nick.


Re: Tomee + JAX-RS 2.0

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Replace javaee-api jar by the jars in javaee-api zip (on maven repo),
remove geronimo jaxrs api and it should be fine
Le 20 juil. 2013 17:30, "Nick Khamis" <sy...@gmail.com> a écrit :

> Ello Everyone!
>
> Looking to pair Tomee Web Profile with JAX-RS 2.0. Non maven, copied
> (javax.annotation-api-1.2.jar,
> javax.ws.rs-api-2.0.jar), to lib folder, and have the rest of the libraries
> in WEB-INF. The eclipse project compiles and runs with not errors or
> warning however, nada, nothing, zilch, seepar!
>
> I suspect it's using another rs implementation hidden somewhere in
> javaee-api? I know that tomee targets jee6 however, it is a servlet 3.0
> compliant as therefore, should make a nice home in terms of deployment.
>
> Question, what is the best way to pair the two together, and would it be
> stable for production?
>
> Kind regards,
>
> Nick from Toronto.
>