Pages

Showing posts with label Websphere. Show all posts
Showing posts with label Websphere. Show all posts

Thursday, October 20, 2011

The jaxws-maven-plugin

For sometime, I've been encountering an error in my JAX-WS application in Maven when deploying it to Websphere. The error occurs when your web service's return type is a List. Here's the exact error:

[javax.xml.bind.JAXBException: java.util.List is not known to this context]

Exporting the war file using IBM RAD will not let you encounter this problem. Unfortunately, RAD does not have a Maven plugin so we are using the native Eclipse IDE. So we've come up to a solution using the jaxws-maven-plugin to make sure the application will run properly in Websphere. Add this into your pom.xml :

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-compiler-plugin</artifactId>
   <version>2.2</version>
   <executions>
       <execution>
           <phase>generate-sources</phase>
           <goals>
               <goal>compile</goal>
           </goals>
      </execution>
   </executions>
   <configuration>
       <target>1.6</target>
       <source>1.6</source>
   </configuration>
</plugin>

<plugin>
    <groupid>org.codehaus.mojo</groupId>
    <artifactid>jaxws-maven-plugin</artifactId>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <goals>
                <goal>wsgen</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <destdir>src/main/java</destDir>     
        <sei>ph.com.src.endpoint.WsEndpoint</sei>     
        <keep>true</keep>      
        <verbose>true</verbose>
    </configuration>
</plugin>

The <sei> should be the location & name of your service endpoint interface. It will I think sort of override it so that no error will occur. :)

Tuesday, August 23, 2011

WAS 7, JSF RI and Richfaces Compatibility

Last week, I learned how to avoid the error in GlassFishConfigureListener occuring when deploying a JSF + Richfacess-driven application in WebSphere. Here is the example stack trace:

E com.ibm.ws.webcontainer.webapp.WebApp notifyServletContextCreated SRVE0283E: Exception caught while initializing context: {0}
                                 java.lang.NoSuchMethodError: com/sun/faces/config/GlassFishConfigureListener.scanWebXml(Z)V
	at com.sun.faces.config.GlassFishConfigureListener.contextInitialized(GlassFishConfigureListener.java:46)
	at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1667)
	at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:368)
	at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:294)
	at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:100)
	at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:166)


I found out that there's a bug in Richfaces or higher with JSF 1.2_07 or lower when deploying to WAS 7. I reverted my Richfaces to 3.3.1.GA instead of 3.3.3.Final, upgraded my web app's JSF reference implementation to JSF-1.2_12 and it worked.