Friday, November 21, 2008

Debugging Mule Application in Eclipse

Two ways to debug a Mule application:

First, Mule user guide has this page, Remote Debugging a Mule Server. Free registration is required to access this page. The page lists all the default steps, but that's all unnecessary as you only need to follow instructions at the top of the page, i.e., launch Mule with a -debug switch. Default debug port is 5005. Just go ahead and attach to the Mule instance using Eclipse's Remote Java Application configuration. What's good with this approach is remote Mule instances can be attached to and debugged.

Alternatively you can choose to launch Mule from inside Eclipse. Follow the section "Create a Run Configuration and Run the Application" in this page Setting Up Eclipse - Mule 2.x Getting Started Guide, basically set up a Java Application run configuration using org.mule.MuleServer, specify -config argument, then simply launch it in debug mode.


Monday, November 17, 2008

JAX-WS 2.1.3 runtime with Jetty

So I had the need to make a web service call out from a web application using JAX-WS 2.1.3 runtime. To do this in WebLogic 10.0.1, one has to resort to WebLogic-specific classpath manipulations, i.e., putting the runtime jars inside APP-INF/lib folder of the EAR that contains the .war file. One would also need to put the following in application-weblogic.xml:


<prefer-application-packages>
<package-name>javax.activation.*</package-name>
<package-name>javax.annotation.*</package-name>
<package-name>javax.jws.*</package-name>
<package-name>javax.xml.bind.*</package-name>
<package-name>javax.xml.soap.*</package-name>
<package-name>javax.xml.stream.*</package-name>
<package-name>javax.xml.ws.*</package-name>

<package-name>com.sun.activation.registries.*</package-name>
<package-name>com.sun.activation.viewers.*</package-name>
<package-name>com.sun.istack.*</package-name>
<package-name>com.sun.org.apache.xml.internal.resolver.*</package-name>
<package-name>com.sun.xml.bind.*</package-name>
<package-name>com.sun.xml.messaging.*</package-name>
<package-name>com.sun.xml.stream.*</package-name>
<package-name>com.sun.xml.txw2.*</package-name>
<package-name>com.sun.xml.ws.*</package-name>

<package-name>org.jvnet.mimepull.*</package-name>
<package-name>org.jvnet.staxex.*</package-name>

<package-name>weblogic.xml.saaj.*</package-name>
</prefer-application-packages>


So, not the easiest way around.

Well, turns out it's much easier to do this in Jetty, all one has to do is to package the following jars from JAX-WS 2.1.3 distribution into WEB-INF/lib and everything is golden:

activation-1.1.jar
jaxb-api-2.1.jar
jaxb-impl-2.1.6.jar
jaxws-api-2.1.jar
jaxws-rt-2.1.3.jar
jsr181-api-1.0.jar
jsr250-api-1.0.jar
mimepull-1.1.jar
resolver-20050927.jar
saaj-api-1.3.jar
saaj-impl-1.3.jar
sjsxp-1.0.jar
stax-api-1.0-2.jar
stax-ex-1.2.jar
streambuffer-0.7.jar

If you are using maven 2, the following dependencies should do the trick:

<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.1</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.1.3</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.jws</groupId>
<artifactId>jsr181-api</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.1</version>
<scope>compile</scope>
</dependency>