Tag Archives: Apache Maven

Using .NET v2.0 generated WSDLs with JAX-WS: How to resolve “A class/interface with the same name “XXXX” is already in use. Use a class customization to resolve this conflict”?

I’ve noticed an issue in WSDLs generated by .NET 2.0 apps: some of the element(s) and their corresponding complextype definitions have same name. If you happen to generate JAX-WS portable artifacts (see below) from one such WSDL for your project (during technology migration etc. and you don’t want the consumers who use this WSDL to […]

How to run Java services (or background daemon processes) in an application server or web container?

I’ve presented here a simple example to illustrate how to convert stand-alone java programs (mostly, JARs) to WARs which can then be deployed in full-blown application servers (JBoss, WebSphere, etc.) or light weight web containers (Tomcat, Jetty, etc.). This’s generally done to avoid the hassle of managing background daemon processes separately. Also, deploying all of […]

How to deploy/test a web application using tomcat-maven-plugin?

To quickly test your maven web application using an embedded tomcat instance, you just need to include this xml snippet in your Maven POM file, and post compilation, execute the command: mvn tomcat:run. You can play around with the <port>, <path>, and <warFile> options as you need.

java.lang.ClassCastException: [ServletName] cannot be cast to javax.servlet.Servlet: How to resolve?

When I was using tomcat-maven-plugin to test an app I worked on in embedded tomcat , it was erroring out with the following message: INFO: Marking servlet TestWebServiceServlet as unavailable Jun 17, 2011 4:01:48 PM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /cxf threw load() exception java.lang.ClassCastException: test.ws.TestWebServiceServlet cannot be cast to javax.servlet.Servlet at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1104) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981) at […]

Maven: Packaging all dependencies in a single JAR

Add maven-assembly-plugin to your pom.xml and bind it to the package lifecycle event. mvn clean package will do the trick.