While deploying some services to a local DEV environment ( which is the prebuilt OTN SOA 12.1.3 VM ) using Maven Servicebus plugin, the deployment was failing for some reason. But instead of giving me the information about what is wrong with my service implementation, I received a NoClassDefFoundError. In the root cause of the exception stacktrace, it complains that class com/bea/wli/sb/util/DiagnosticLocation could not be found.
[INFO] --- oracle-servicebus-plugin:12.1.3-0-0:deploy (default-deploy) @ LoggingService
[INFO] Service Bus Archive deployed using session Service_Bus_Maven-LoggingService-1472570870357.
weblogic.rjvm.PeerGoneException: ; nested exception is:
weblogic.utils.NestedException: java.lang.NoClassDefFoundError: com/bea/wli/sb/util/DiagnosticLocation
at weblogic.rjvm.RJVMImpl.gotExceptionReceiving(RJVMImpl.java:1002)
at weblogic.rjvm.ConnectionManager.gotExceptionReceiving(ConnectionManager.java:1099)
at weblogic.rjvm.MsgAbbrevJVMConnection.gotExceptionReceiving(MsgAbbrevJVMConnection.java:527)
at weblogic.rjvm.t3.MuxableSocketT3.hasException(MuxableSocketT3.java:494)
at weblogic.socket.SocketMuxer.deliverExceptionAndCleanup(SocketMuxer.java:837)
at weblogic.socket.SocketMuxer.deliverHasException(SocketMuxer.java:777)
at weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java:368)
at weblogic.socket.SocketReaderRequest.run(SocketReaderRequest.java:30)
at weblogic.work.ExecuteRequestAdapter.execute(ExecuteRequestAdapter.java:21)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:147)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:119)
Caused by: weblogic.utils.NestedException: java.lang.NoClassDefFoundError: com/bea/wli/sb/util/DiagnosticLocation
at weblogic.rjvm.RJVMImpl.gotExceptionReceiving(RJVMImpl.java:999)
... 10 more
As the server log files also didn’t give me a hint about what is wrong with my service, I searched my middleware home for jar files that contains references for the class mentioned in the exception. As a result, I was able to identify two jar files that contains the class:
- oracle.servicebus.pipeline.kernel
- oracle.servicebus.resources.core
Both jar files are located in $MW_HOME/osb/lib/modules.
In a next step, I add the two jar files in my local Maven repository using the Maven install plugin (the example underneath only shows the command for one of the jars):
mvn install:install-file -Dfile=/opt/oracle/middleware/jdev_1213_soa/osb/lib/modules/oracle.servicebus.resources.core.jar -DgroupId=com.oracle.sb -DartifactId=oracle.servicebus.resources.core -Dversion=12.1.3.0 -Dpackaging=jar
After that, I changed the Servicebus plugin configuration in the POM file, by adding two dependencies to the newly installed jar files.
<plugin>
<groupId>com.oracle.servicebus.plugin</groupId>
<artifactId>oracle-servicebus-plugin</artifactId>
<version>12.1.3-0-0</version>
<configuration>
<customization>${project.basedir}/../../CustomizationFiles/customizationFile_${target-env}.xml</customization>
<excludes>
<exclude>*/target/**</exclude>
</excludes>
</configuration>
<extensions>true</extensions>
<dependencies>
<dependency>
<groupId>com.oracle.sb</groupId>
<artifactId>oracle.servicebus.pipeline.kernel</artifactId>
<version>12.1.3.0</version>
</dependency>
<dependency>
<groupId>com.oracle.sb</groupId>
<artifactId>oracle.servicebus.resources.core</artifactId>
<version>12.1.3.0</version>
</dependency>
</dependencies>
</plugin>
Applying the changes to the plugin finally helps to overcome the NoClassDefFoundError issue. As a result, the plugin now shows the real problem with the service.
[INFO] --- oracle-servicebus-plugin:12.1.3-0-0:deploy (default-deploy) @ OrderTransactionTrigger ---
[INFO] Service Bus Archive deployed using session Service_Bus_Maven-OrderTransactionTrigger-1472571721113.
[ERROR] The session cannot be activated due to existence of conflicts.
resource: Pipeline LoggingService/operations/updateLog/pipeline/UpdateLogPipeline
error: [PipelinePairNode1, Request Pipeline, ProvideLoggingData, Java Callout action] Archive resource LoggingService/shared/java/PersistenceService-1.0.4 does not exist
error: Reference to a non-existing instance: Archive LoggingService/shared/java/PersistenceService-1.0.4
resource: Pipeline
[INFO] ------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------
As it can bee seen from the output, I was missing a jar file for a Java Callout activity. With that knowledge, I was able to fix the service within a few minutes. Afterwards, it deploys without any problems.