Part 1 of this blog gives an overview of the geometry-based Web Services we developed. Part 2 dives into some of the interesting details for the implementation of such Web Services. This part discusses the deployment specifics of such Web Services.
Deployment
There is a catch to deploying an application to WebLogic that uses the EclipseLink StructConverter to convert geographical data into JGeometry objects. When packaging the dependent JAR files sdoapi.jar en sdoutl.jar into the application (e.g. WAR or EAR file) you get the following error when running the application:java.lang.NoClassDefFoundError: oracle/spatial/geometry/JGeometry at org.eclipse.persistence.platform.database.oracle.converters.JGeometryConverter.<clinit>(JGeometryConverter.java:33)
This issue is caused by classloading specifics of EclipseLink on Oracle WebLogic. You can resolve this by adding the sdoapi.jar and sdoutl.jar files to the system classpath of WebLogic:
- Copy the JAR files to the [WEBLOGIC_HOME]/wlserver_10.3/server/lib directory;
- Add these JAR files to the WEBLOGIC_CLASSPATH variable in the commEnv.cmd or commEnv.sh file located in [WEBLOGIC_HOME]/wlserver_10.3/common/bin;
- Restart the WebLogic Managed Server after these steps.
Also see the following OTN forum post for the NoClassDefFoundError error.
We use Maven to build the Web Service. For EclipseLink you can add the following repository to the pom.xml file:
<repository>
<id>EclipseLink</id> <url>http://download.eclipse.org/rt/eclipselink/maven.repo</url>
</repository>
For the Oracle Java Spatial libraries you can add the following dependencies. You can place the associated JAR files into your local Maven repository:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>sdoutl</artifactId>
<version>11.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>sdoapi</artifactId>
<version>11.2.0</version>
<scope>compile</scope>
</dependency>
No comments:
Post a Comment