Use WSRR web service outside a web application

270 Views Asked by At

I have a web application mostly written by others based on JSF 2, Mybatis, Spring 3 and tens of other libraries, running on Weblogic, it works and now I have to create a distinct command line application to schedule the running of some tasks already present in the web app.

I added a class with a main method in order to maintain only one codebase with a different build process to generate an executable JAR instead of a WAR. Using Spring's ClassPathXmlApplicationContext I managed to recreate the web application context, access the database beans and use them, but I'm stuck with a WSRR call which fails.

The commands:

GraphQuery graphQuery = 
                (GraphQuery)DataFactory.INSTANCE.create(TypeConstants.SR_URI, TypeConstants.TYPE_GRAPHQUERY);
            graphQuery.setQueryExpression("/WSRR/GenericObject[@CFT_APPLIC='DS" + param + "']");

fail with a long stack, having the root exception

Caused by: java.lang.NullPointerException
    at java.util.ResourceBundle.getBundle(ResourceBundle.java:960)
    at com.ibm.ws.webservices.engine.resources.ProjectResourceBundle$Context.loadBundle(ProjectResourceBundle.java:474)
    at com.ibm.ws.webservices.engine.resources.ProjectResourceBundle.getBundle(ProjectResourceBundle.java:372)
    at com.ibm.ws.webservices.engine.resources.ProjectResourceBundle.getBundle(ProjectResourceBundle.java:341)
    at com.ibm.ws.webservices.engine.resources.MessagesConstants.<clinit>(MessagesConstants.java:93)

I found that some classes and configurations are provided at runtime by the application server, and have no idea about how to replace them outside the application server.

The IBM redbook says (pages 120-121) that is possible to access a web service using a Java client, but requires a suitable EJB runtime.

How can I replicate needed EJB parameters outside the application server? I tried to use the Eclipse debugger to follow the execution of the application and extract them, but it fails, probably because the classes are loaded by Weblogic classloader.

0

There are 0 best solutions below