Are your exceptions not being logged in SOA Server?

A couple of days back one of the developers I work with reported that it takes a long time to debug issues when some of the services we call from our BPM process throw exceptions, because he couldn’t find the stack trace of the service in any of the SOA server logs. In our Development environment we deploy our service endpoints on the SOA server as well . We use the 11.1.1.6 patch. We start our managed servers including the SOA server using Node manager.

Without the stack trace, of course,  it is difficult to know exactly which line of code in the service caused the issue. Just to confirm this behavior I wrote a simple service

package BPMExceptions.client;

import java.util.logging.Level;
import java.util.logging.Logger;

import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService(serviceName = “MyService”)
public class MyService {

private static final Logger logger = Logger.getLogger(MyService.class.getName());

public MyService() {

super();
}

public boolean doSomething () {
if (1 == 1) {
throw new RuntimeException (“Do Something Runtime Exception”);
}
return true;
}
}

Deployed this to the SOA Server and ran it from the EM Console. I got an error displayed on the EM Console as expected.

Then I looked at the log files.

So, while I can see a client-side exception being logged, I can’t see any stack trace logged by the service end-point to indicate which line caused the error. I used to think that as long as you don’t catch the exception and let it propagate , at some point the SOA Server ( WebLogic) should be logging the stack trace in one of the log files, but as this example shows, it doesn’t.

So how do we fix this?
If  you log the exception using java.util.logging.Logger (we haven’t tried with other logging frameworks yet like ADFLogger or Log4J, I would think you’d have the same results), the stack trace will show up in the SOA server log.

I changed my example to the following.

package BPMExceptions.client;

import java.util.logging.Level;
import java.util.logging.Logger;

import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService(serviceName = “MyService”)
public class MyService {

private static final Logger logger = Logger.getLogger(MyService.class.getName());

public MyService() {

super();
}

public boolean doSomething () {
try {
if (1 == 1) {
throw new RuntimeException (“Do Something Runtime Exception”);
}
return true;
} catch (RuntimeException e) {
logger.log(Level.SEVERE, e.getMessage(), e);
throw e;
}
}
}

After this change I do see my specific endpoint exception stack-trace in the server logs.

If I click on the ‘Do something Runtime Exception’ line, I now see the end-point stack trace.

Jaideep

Jaideep has more than 20 years of professional software development experience. He has delivered solutions for several domains including financial services, e-Government, criminal justice, and wireless application services. He is a Certified Scrum Master and has mentored several teams to use agile software development techniques. He has delivered several SOA/BPM solutions based on the BEA/Oracle SOA Suite over the last 6 years . His current focus is on helping customers build solutions using Oracle BPM, Webcenter, ADF and SOA Suite 11g and 12c. Jaideep also trains teams on using Oracle BPM and has developed several self paced online video training courses for Oracle BPM 11g and 12c.
Jaideep

Leave a Reply

avatar
  Subscribe  
Notify of