Oracle SB12c QuickTip: Fix HTTP 403 on calling SOAP/REST Proxy Services

A few days ago, I faced a strange behaviour when I tried to test SOAP and REST services deployed to a fresh SOA Suite 12c (12.2.1.1) installation. Using SOAP UI for testing the services always gave me an response in a HTML format, which says ” Error 403 Forbidden”, like it is displayed in the screenshot below:

screen-shot-2017-01-29-at-15-04-03Going through all log files of the corresponding Managed Server, where Servicebus was installed to, I didn’t find any hint that even the request was delivered to the servers. The requests simply had no footprint in the access.log or the server’s diagnostics.log – which seemed to be very strange to me. Assuming that the behaviour might have been something to do with the security policies applied to the services, I disabled all security policies as a next step – without any success.

After testing the services successfully in another environment, it was quite clear to me that something was wrong with the domain setup and after some investigations, I found the root cause for the “Error 403 Forbidden” message: Using the deployments view in Weblogic Console, I noticed that “API Manager Starter Application” was targeted to the Servicebus Cluster. Like described in MOS Note 2087277.1, I un-targeted this application from the Cluster, restarted the corresponding Managed Servers and afterwards, I was able to test the services without receiving the mentioned exception. Like the MOS note described this behaviour might happen, if the wrong Template (Oracle API Manager Template) is chosen for Servicebus, when setting up a domain.

Since it took me some time to understand the behaviour and to fix it accordingly, I hope this short post will preserve you from running into the same issue.

Oracle SB 12c QuickTip: Resolve NoClassDefFoundError during Maven deployment

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.