You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Kent Närling <ke...@seamless.se> on 2008/11/11 22:17:28 UTC

Creating CXF war file... how to get proper dependencies??

Hi!
I am trying to make a CXF webservice package in maven.

But it seems SO darn difficult to get the right dependencies!

Either classes are missing or I get stupid collissions...

Anyone have tips what dependencies to declare to be able to deploy a CXF war
file on a fresh installed tomcat (5.5.27)?

Currently we have the following declared in a "webservices deps" POM project
(which we then depend on):
<properties>
<cxf.version>2.1.1</cxf.version>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-core</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-simple</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-databinding-aegis</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-local</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-jms</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-management</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-common-utilities</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<version>6.1.11</version>
</dependency>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>2.0.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.0.3</version>
</dependency>
  </dependencies>


And with that I get the following error in tomcat:
[java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory]
Oddly enough, this class IS included in the war inside
WEB-INF\lib\jaxb-impl-2.1.3.jar ??

Anyone have ideas?

Also, anyone have recommendations regarding what dependencies to bundle
inside a war file?

It seems you either include almost nothing (depend on the container) or you
include all.
Naturally, the latter leads to bigger WAR files... but that should be offset
by simpler installs and easier to manage dependencies?

Re: Creating CXF war file... how to get proper dependencies??

Posted by Daniel Kulp <dk...@apache.org>.

> <dependency>
> <groupId>javax.xml</groupId>
> <artifactId>jaxb-api</artifactId>
> <version>2.1</version>
> </dependency>
> <dependency>
> <groupId>com.sun.xml.bind</groupId>
> <artifactId>jaxb-xjc</artifactId>
> <version>2.0.3</version>
> <scope>compile</scope>
> </dependency>
> <dependency>
> <groupId>com.sun.xml.bind</groupId>
> <artifactId>jaxb-impl</artifactId>
> <version>2.0.3</version>
> </dependency>
>   </dependencies>

Umm...   jaxb-api is 2.1, but you are including 2.0.x versions of jaxb-impl 
and xjc....   That definitely won't work.

I would recommend 2.1 api jar and 2.1.7 versions for jaxb-impl and jaxb-xjc.  
(there are bugs in 2.1.8 that may prevent it from working with CXF)   Either 
that or remove those deps from your pom and let maven resolve them 
transitively from the cxf deps.  (and update to cxf 2.1.3 while you are at 
it)


Dan



On Tuesday 11 November 2008 4:17:28 pm Kent Närling wrote:
> Hi!
> I am trying to make a CXF webservice package in maven.
>
> But it seems SO darn difficult to get the right dependencies!
>
> Either classes are missing or I get stupid collissions...
>
> Anyone have tips what dependencies to declare to be able to deploy a CXF
> war file on a fresh installed tomcat (5.5.27)?
>
> Currently we have the following declared in a "webservices deps" POM
> project (which we then depend on):
> <properties>
> <cxf.version>2.1.1</cxf.version>
> </properties>
>
> <dependencies>
> <dependency>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-core</artifactId>
> <version>${cxf.version}</version>
> </dependency>
> <dependency>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-frontend-simple</artifactId>
> <version>${cxf.version}</version>
> </dependency>
> <dependency>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-frontend-jaxws</artifactId>
> <version>${cxf.version}</version>
> </dependency>
> <dependency>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-databinding-aegis</artifactId>
> <version>${cxf.version}</version>
> </dependency>
> <dependency>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-transports-local</artifactId>
> <version>${cxf.version}</version>
> </dependency>
> <dependency>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-transports-http</artifactId>
> <version>${cxf.version}</version>
> </dependency>
> <dependency>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-transports-http-jetty</artifactId>
> <version>${cxf.version}</version>
> </dependency>
> <dependency>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-transports-jms</artifactId>
> <version>${cxf.version}</version>
> </dependency>
> <dependency>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-management</artifactId>
> <version>${cxf.version}</version>
> </dependency>
> <dependency>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-common-utilities</artifactId>
> <version>${cxf.version}</version>
> </dependency>
> <dependency>
> <groupId>javax.servlet</groupId>
> <artifactId>servlet-api</artifactId>
> <version>2.4</version>
> </dependency>
> <dependency>
> <groupId>org.mortbay.jetty</groupId>
> <artifactId>jetty</artifactId>
> <version>6.1.11</version>
> </dependency>
> <dependency>
> <groupId>javax.xml</groupId>
> <artifactId>jaxb-api</artifactId>
> <version>2.1</version>
> </dependency>
> <dependency>
> <groupId>com.sun.xml.bind</groupId>
> <artifactId>jaxb-xjc</artifactId>
> <version>2.0.3</version>
> <scope>compile</scope>
> </dependency>
> <dependency>
> <groupId>com.sun.xml.bind</groupId>
> <artifactId>jaxb-impl</artifactId>
> <version>2.0.3</version>
> </dependency>
>   </dependencies>
>
>
> And with that I get the following error in tomcat:
> [java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory]
> Oddly enough, this class IS included in the war inside
> WEB-INF\lib\jaxb-impl-2.1.3.jar ??
>
> Anyone have ideas?
>
> Also, anyone have recommendations regarding what dependencies to bundle
> inside a war file?
>
> It seems you either include almost nothing (depend on the container) or you
> include all.
> Naturally, the latter leads to bigger WAR files... but that should be
> offset by simpler installs and easier to manage dependencies?



-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Re: Creating CXF war file... how to get proper dependencies??

Posted by Daniel Kulp <dk...@apache.org>.
Hmm....

Probably a good idea.   The stuff I KNOW about:

Sun JDK's:
JDK's 1.5.0   07-12 have a bug in it that prevents the JAX-WS TCK from 
passing.   If you get some "operation is wrong with respect to namespaces" 
type of error, it's due to that bug.   

JDK's 1.6  updates 0 - 3 use JAXB 2.0 and JAXWS API 2.0.   Thus, you cannot 
use CXF 2.1.x with these versions without endorsing those api jars.    CXF 
2.0.x should work fine.

JDK's 1.6 updates 4 and newer use JAXB 2.1 and JAXWS API 2.1.   CXF 2.0.x 
doess NOT work with these (unless you endorse the 2.0 versions of those 
jars).  CXF 2.1.x and 2.2 should work fine.


IBM JDK's -  the CORBA binding is known to have issues with the ORB in the IBM 
JDK's.   Haven't had time to look into it.

With IBM JDK 1.5.x - you need to include Sun's JAXP parser jar in order for 
the saaj-impl jar we ship to work. 

With IBM JDK 1.6.x - you can either use the Sun's jaxp parser, or just remove 
the saaj-impl we ship and use the saaj implementation built into the JDK.

CXF doesn't currently build with IBM's 1.6.x JDK (on AIX or Linux).   Many of 
the tests fail, but it's due to some keep-alive thing with the jetty sockets.   
They don't seem to be closing all the way before the next test needs them and 
the socket-reuse flag doesn't seem to work.   Haven't had time to really 
investigate how to workaround that.   For normal operation where you aren't 
open/closing a server socket really fast, you shouldn't be impacted.


In all cases, you currently MUST use the jaxb-impl and jaxb-xjc that we ship.  
There is some work done on trunk (for 2.2) to allow some use of the in-jdk 
jaxb-impl at runtime, but that is not complete yet.   No work has started on 
the tooling (wsdl2java, java2ws, etc...) to allow it to work with the in-jdk 
jaxb.

As far as tomcat goes, I run the TCK with apache-tomcat-5.5.23.tar.gz.  That 
was just the current version when I setup the TCK's and I really haven't had 
the time to figure out what is needed to update it.


What other issues have come up?   What enumeration issue are you talking 
about?  


Dan



On Wednesday 12 November 2008 10:24:16 am Brad O'Hearne wrote:
> All,
>
> I neglected to mention something relevant to dependencies, equally
> important, we need to get documented what JDK versions are valid with
> what releases of CXF. The three common issues I've encountered over
> the last couple of years in the 1.5 - 1.6 transition is first, issues
> with enumerations (supported in 1.6 but not in 1.5), and Tomcat
> compatibility. Since Tomcat is so common to our typical use cases, it
> would be good to have some information relevant to JDK compatibility,
> as I believe there are JDK version compatibility issues there too. One
> additional thing, which I'm sure many beyond myself are in the same
> boat, is that a year ago I moved all my development to OS X, which
> still supports only a 1.5 JDK (I recently had to rip all the
> enumerations out of a project for the purposes of developing there).
>
> it would be good to have a table of JDK compatibility to CXF release.
> At some point, I'm sure that CXF is going to want to leverage native
> 1.6 features, and it would be nice at a glance to be able to see where
> the CXF version cutoff is for those bound to JDK 1.5 for some reason.
>
> Brad
>
> On Nov 12, 2008, at 8:13 AM, Brad O'Hearne wrote:
> > All,
> >
> > What's the odds of us being able to compile the 3-5 most common use
> > cases for configuring CXF, and then being able to outline
> > dependencies for each? If we are going to improve our documentation,
> > then this seems like low-hanging fruit. Everyone can benefit from
> > having this documented.
> >
> > My configuration has been simply a web application using jax-rs
> > configured with Spring. Anyone else want to volunteer their
> > configurations? Perhaps we can see some usage patterns and document
> > the common ones first.
> >
> > Cheers,
> >
> > Brad
> >
> > On Nov 11, 2008, at 2:51 PM, Glen Mazza wrote:
> >> Perhaps my Maven POM files might be something you can use:
> >>
> >> http://www.jroller.com/gmazza/date/20080417#WFstep3
> >>
> >> HTH,
> >> Glen
> >>
> >> Kent Narling wrote:
> >>> Hi!
> >>> I am trying to make a CXF webservice package in maven.
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Creating-CXF-war-file...-how-to-get-proper-depende
> >>ncies---tp20448632p20448944.html Sent from the cxf-user mailing list
> >> archive at Nabble.com.



-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Re: Creating CXF war file... how to get proper dependencies??

Posted by Brad O'Hearne <br...@bighillsoftware.com>.
Ack -- my bad. I was getting wires crossed with some other projects of  
mine, and particularly some problems I had with Axis. Axis has a  
package naming issue as it uses the reserved word "enum" as one of its  
package names, which causes hair pulling in JDK versions that support  
enums.

Brad

On Nov 12, 2008, at 8:35 AM, Ian Roberts wrote:

> Brad O'Hearne wrote:
>> enumerations (supported in 1.6 but not in 1.5)
>
> I'm sure I've used enumerations in 1.5...?
>
> Ian
>
> -- 
> Ian Roberts               | Department of Computer Science
> i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK


Re: Creating CXF war file... how to get proper dependencies??

Posted by Ian Roberts <i....@dcs.shef.ac.uk>.
Brad O'Hearne wrote:
> enumerations (supported in 1.6 but not in 1.5)

I'm sure I've used enumerations in 1.5...?

Ian

-- 
Ian Roberts               | Department of Computer Science
i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK

Re: Creating CXF war file... how to get proper dependencies??

Posted by Brad O'Hearne <br...@bighillsoftware.com>.
All,

I neglected to mention something relevant to dependencies, equally  
important, we need to get documented what JDK versions are valid with  
what releases of CXF. The three common issues I've encountered over  
the last couple of years in the 1.5 - 1.6 transition is first, issues  
with enumerations (supported in 1.6 but not in 1.5), and Tomcat  
compatibility. Since Tomcat is so common to our typical use cases, it  
would be good to have some information relevant to JDK compatibility,  
as I believe there are JDK version compatibility issues there too. One  
additional thing, which I'm sure many beyond myself are in the same  
boat, is that a year ago I moved all my development to OS X, which  
still supports only a 1.5 JDK (I recently had to rip all the  
enumerations out of a project for the purposes of developing there).

it would be good to have a table of JDK compatibility to CXF release.  
At some point, I'm sure that CXF is going to want to leverage native  
1.6 features, and it would be nice at a glance to be able to see where  
the CXF version cutoff is for those bound to JDK 1.5 for some reason.

Brad

On Nov 12, 2008, at 8:13 AM, Brad O'Hearne wrote:

> All,
>
> What's the odds of us being able to compile the 3-5 most common use  
> cases for configuring CXF, and then being able to outline  
> dependencies for each? If we are going to improve our documentation,  
> then this seems like low-hanging fruit. Everyone can benefit from  
> having this documented.
>
> My configuration has been simply a web application using jax-rs  
> configured with Spring. Anyone else want to volunteer their  
> configurations? Perhaps we can see some usage patterns and document  
> the common ones first.
>
> Cheers,
>
> Brad
>
> On Nov 11, 2008, at 2:51 PM, Glen Mazza wrote:
>
>>
>> Perhaps my Maven POM files might be something you can use:
>>
>> http://www.jroller.com/gmazza/date/20080417#WFstep3
>>
>> HTH,
>> Glen
>>
>>
>> Kent Narling wrote:
>>>
>>> Hi!
>>> I am trying to make a CXF webservice package in maven.
>>>
>>
>> -- 
>> View this message in context: http://www.nabble.com/Creating-CXF-war-file...-how-to-get-proper-dependencies---tp20448632p20448944.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>


Re: Creating CXF war file... how to get proper dependencies??

Posted by Brad O'Hearne <br...@bighillsoftware.com>.
All,

What's the odds of us being able to compile the 3-5 most common use  
cases for configuring CXF, and then being able to outline dependencies  
for each? If we are going to improve our documentation, then this  
seems like low-hanging fruit. Everyone can benefit from having this  
documented.

My configuration has been simply a web application using jax-rs  
configured with Spring. Anyone else want to volunteer their  
configurations? Perhaps we can see some usage patterns and document  
the common ones first.

Cheers,

Brad

On Nov 11, 2008, at 2:51 PM, Glen Mazza wrote:

>
> Perhaps my Maven POM files might be something you can use:
>
> http://www.jroller.com/gmazza/date/20080417#WFstep3
>
> HTH,
> Glen
>
>
> Kent Narling wrote:
>>
>> Hi!
>> I am trying to make a CXF webservice package in maven.
>>
>
> -- 
> View this message in context: http://www.nabble.com/Creating-CXF-war-file...-how-to-get-proper-dependencies---tp20448632p20448944.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>


Re: Creating CXF war file... how to get proper dependencies??

Posted by Glen Mazza <gl...@gmail.com>.
Perhaps my Maven POM files might be something you can use:

http://www.jroller.com/gmazza/date/20080417#WFstep3

HTH,
Glen


Kent Narling wrote:
> 
> Hi!
> I am trying to make a CXF webservice package in maven.
> 

-- 
View this message in context: http://www.nabble.com/Creating-CXF-war-file...-how-to-get-proper-dependencies---tp20448632p20448944.html
Sent from the cxf-user mailing list archive at Nabble.com.