You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@olingo.apache.org by "Poindexter, Miles" <Mi...@condenast.com> on 2014/09/25 17:07:11 UTC

Olingo OData service on TomEE

Hi,

We are looking to go in the direction of Apache Olingo for our ODATA
services on TomEE, vs Odata4J.
http://tomee.apache.org/

So I have now begun investigating by trying to run a Maven Archetype
available from the project site:
http://olingo.apache.org/doc/odata2/sample-setup



This sample service runs in Tomcat8, but not in TomEE
mvn archetype:generate \
  -DinteractiveMode=false \
  -Dversion=1.0.0-SNAPSHOT \
  -DgroupId=com.sample \
  -DartifactId=my-car-service \
  -DarchetypeGroupId=org.apache.olingo \
  -DarchetypeArtifactId=olingo-odata2-sample-cars-service-archetype \
  -DarchetypeVersion=RELEASE \


Exception is:
WARNING: Interceptor for
{http://rest.core.odata2.olingo.apache.org/}ODataRootLocator has thrown
exception, unwinding now
java.lang.reflect.UndeclaredThrowableException

Caused by: javax.naming.NameNotFoundException: Name
[comp/env/org.apache.olingo.odata2.core.rest.ODataRootLocator/app] is not
bound in this Context. Unable to find [comp].
at org.apache.naming.NamingContext.lookup(NamingContext.java:819)

This is the 2.0 version of Apache Olingo.

We don¹t need the 4.0 version of Odata at all yet, since some of our
clients can only use Odata 2.0 and lower.  But I am will to try that too as soon as a maven archetype becomes available.


Is there a fix/workaround for this to get it working? Does the Olingo team think they will test their sample services on both TomEE and Tomcat in the future?

miles

--
Miles Poindexter
Condé Nast
Service Oriented Architecture
miles_poindexter@condenast.com<ma...@condenast.com>
347-967-8944 / 212-790-6692


Re: Olingo OData service on TomEE

Posted by mibo <mi...@apache.org>.
Hi Miles,

the problem is that TomEE try to load the JAX-RS annotated "ODataRootLocator" in combination with a not supported CXF version.
The prevent this you have to disable this in TomEE system configuration:
{tomee}/conf/system.properties:
openejb.jaxrs.application = false

And in addition change to Olingos own "ODataServlet" through following change in the "web.xml" and "pom.xml" in your project (also documented here: http://olingo.apache.org/doc/odata2/tutorials/servlet.html).

web.xml:
    <servlet-class>org.apache.olingo.odata2.core.servlet.ODataServlet</servlet-class>
    <!--<servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class>--> 
    <!--<init-param>-->
          <!--<param-name>javax.ws.rs.Application</param-name>-->
	  <!--<param-value>org.apache.olingo.odata2.core.rest.app.ODataApplication</param-value>-->
    <!--</init-param>-->

pom.xml:
   <!-- removed CXF dependency -->
   <!-- and exclude jax-rs -->
    <dependency>
      <groupId>org.apache.olingo</groupId>
      <artifactId>olingo-odata2-core</artifactId>
      <version>${project.version}</version>
      <exclusions>
        <exclusion>
          <groupId>javax.ws.rs</groupId>
          <artifactId>javax.ws.rs-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

With those steps the Olingo Sample work together with TomEE (1.6.x).
If you encounter more/other problems please give feedback.

Kind regards,
Michael 


Am 25.09.2014 um 17:07 schrieb Poindexter, Miles <Mi...@condenast.com>:

> Hi,
> 
> We are looking to go in the direction of Apache Olingo for our ODATA
> services on TomEE, vs Odata4J.
> http://tomee.apache.org/
> 
> So I have now begun investigating by trying to run a Maven Archetype
> available from the project site:
> http://olingo.apache.org/doc/odata2/sample-setup
> 
> 
> 
> This sample service runs in Tomcat8, but not in TomEE
> mvn archetype:generate \
>   -DinteractiveMode=false \
>   -Dversion=1.0.0-SNAPSHOT \
>   -DgroupId=com.sample \
>   -DartifactId=my-car-service \
>   -DarchetypeGroupId=org.apache.olingo \
>   -DarchetypeArtifactId=olingo-odata2-sample-cars-service-archetype \
>   -DarchetypeVersion=RELEASE \
> 
> 
> Exception is:
> WARNING: Interceptor for
> {http://rest.core.odata2.olingo.apache.org/}ODataRootLocator has thrown
> exception, unwinding now
> java.lang.reflect.UndeclaredThrowableException
> 
> Caused by: javax.naming.NameNotFoundException: Name
> [comp/env/org.apache.olingo.odata2.core.rest.ODataRootLocator/app] is not
> bound in this Context. Unable to find [comp].
> at org.apache.naming.NamingContext.lookup(NamingContext.java:819)
> 
> This is the 2.0 version of Apache Olingo.
> 
> We don¹t need the 4.0 version of Odata at all yet, since some of our
> clients can only use Odata 2.0 and lower.  But I am will to try that too as soon as a maven archetype becomes available.
> 
> 
> Is there a fix/workaround for this to get it working? Does the Olingo team think they will test their sample services on both TomEE and Tomcat in the future?
> 
> miles
> 
> -- 
> Miles Poindexter
> Condé Nast
> Service Oriented Architecture
> miles_poindexter@condenast.com
> 347-967-8944 / 212-790-6692
>