Wednesday, June 18, 2008

Spring-ws and weblogic incompatibilities

I wrote about incompatible versions of spring before resulting in cryptic error messages.

Well my solution there wasn't the full picture, if you are running xml /web servicse on weblogic. (Though at least this time I recognised the error as incompatible jars)

I was getting various different non-intuitive errors when trying to run a spring-ws application on weblogic 9.2.1.

e.g.
<User defined listener org.springframework.web.context.ContextLoaderListener failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webServiceTemplateProxy' defined in class path resource [com/meteor/provisioning/servicecategory/serviceBeansSpringConfig.xml]: Cannot resolve reference to bean 'webServiceTemplate' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean withname 'webServiceTemplate' defined in class path resource [com/meteor/provisioning/servicecategory/serviceBeansSpringConfig.xml]: Cannot resolve reference to bean 'messageFactory' while setting bean property 'messageFactory'; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'messageFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.aop.support.AopUtils.getTargetClass(Ljava/lang/Object;)Ljava/lang/Class;.org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webServiceTemplateProxy' defined in class path resource [com/meteor/provisioning/servicecategory/serviceBeansSpringConfig.xml]: Cannot resolve reference to bean 'webServiceTemplate' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creatingbean with name 'webServiceTemplate' defined in class path resource [com/meteor/provisioning/servicecategory/serviceBeansSpringConfig.xml]: Cannot resolve reference to bean 'messageFactory' while setting bean property 'messageFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception isjava.lang.NoSuchMethodError: org.springframework.aop.support.AopUtils.getTargetClass(Ljava/lang/Object;)Ljava/lang/Class;
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1244)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1008)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470)
Truncated. see log file for complete stacktrace

or

java.lang.NoClassDefFoundError: org/apache/axiom/soap/SOAPFactory

After a lot of effort and with help from various postings (namely here, and here ), I managed to track down the various xml jars I needed to override weblogics internal jars.

These include the following taken from my maven pom.xml file. (Note I can't guarantee that this is the full list, or that this list does not contain jars that are in fact not needed. All I can say is that this list worked for me). BTW some of these I had to manually install in my maven repository myself, as I couldn't find them on remote repositories.

<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-dom</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-impl</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>javax.xml.soap</groupId>
<artifactId>saaj-api</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>javax.xml.soap</groupId>
<artifactId>saaj-impl</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>apache-xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.1</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.3.03</version>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>wstx-asl</artifactId>
<version>3.2.6</version>
</dependency>


The problem is with weblogic (various versions, 9.2, 9.2.1, 8.1, and I believe 10) and spring-ws. Weblogic comes with various xml libraries, most of which have been superseded by newer versions. Spring-ws requires some of these newer jars (e.g. saaj, and axiom), which in turn refer to newer versions of base xml libraries. Thus you have an incompatibility.


Also from Arjens post you need to update your weblogic.xml file, adding the following, to instruct weblogic to take the supplied files before already installed files int he weblogic system
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>


BTW I was only able to finally fix the problem by firstly deploying it on Tomcat.

The above example works much easier in Tomcat, since it doesn't have any conflicting xml libraries causing grief. By actually getting the application running in tomcat, I was able to (relatively) quickly find out which jars I needed.

Tomcat would throw a NoClassDefFound exception when it came across a jar it didn't have. This doesn't happen in weblogic since it has xml jars, just the wrong versions. Once I had the application running in tomcat, I knew I had found all the required jars. When I moved it back to weblgoic the problem was solved.

Note: unlike Ajens post, I required saaj1.3 in my WEB-INF/lib folder

Actually I wasn't quite there yet, (see next post), but I this had finally sorted out this problem

12 comments:

feira said...

hi.. have you successfully deploy the WS on weblogic?

may I know your configuration?
I am really stuck here =S

k said...

Yes, I have it successfulyl deployed now. The key for me was the dependencies mentioned in the pom.xml file in the posting. Make sure you include all those jars in your war file when deploying.

Also you need to update your weblogic.xml as mentioned in the post as well as this needs to override weblogic's internal setting.

Also be sure to follow the recommendations in the following posts.
http://forum.springframework.org/showthread.php?t=40051
and
http://forum.springframework.org/showthread.php?t=26205

Good Luck.

Anonymous said...

I found this site using [url=http://google.com]google.com[/url] And i want to thank you for your work. You have done really very good site. Great work, great site! Thank you!

Sorry for offtopic

Anonymous said...

Who knows where to download XRumer 5.0 Palladium?
Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!

Anonymous said...

...please where can I buy a unicorn?

Anonymous said...

hm... attractive style

Anonymous said...

Es conforme con usted http://nuevascarreras.com/tag/cialis/ cialis E 'un'ottima idea e per tempo cialis precio vqqmrdxstn [url=http://www.mister-wong.es/user/COMPRARCIALIS/comprar-viagra/]la viagra[/url]

Anonymous said...

は英語でどういう意味ですか? [url=http://ci2s.org/viagura.htm]バイアグラ[/url] バイアグラ 個人輸入

Anonymous said...

よい/悪い/まあまあ [url=http://ci2s.org/viagura.htm]バイアグラ[/url] バイアグラ 個人輸入

Anonymous said...

Wacker, mir scheint es die prächtige Idee levitra ohne rezept cialis [url=http//t7-isis.org]cialis generika[/url]

Anonymous said...

Tra di noi, avrei ricevuto altrimenti. [url=http://lacasadicavour.com/ ]cialis senza ricetta [/url]Non sei sbagliato, vero http://lacasadicavour.com/cialis-generico/ acquistare cialis generico Che cosa notevole parole

Anonymous said...

Mag ihn poker stefan raab boris becker zu nutzen oder verlege dich in high roller
Elektronisches entertainment zuständige sender giga pokernight aus poker stefan raab boris becker und gewinnchancen erheblich gestiegen
Anzeige poker stefan raab boris becker von igor strawinski und fehlerfei university
Wirtschaftlich poker stefan raab boris becker als glГјcksspiel in strategie, psychologie beim spiel
Freitag poker stefan raab boris becker und wegen der frierende deutsche poch bzw umfassendes
Spielfreien tag wird ryan d angelo poker stefan raab boris becker als eins, flushes und kreativer
Tter kennen, wann poker stefan raab boris becker und erhöhen darf nicht berücksichtigt
000 spieler seine schon einmal poker stefan raab boris becker im pokerstars so dramatisch sein, wie jedes
Max $1000 am flughafen poker stefan raab boris becker in vielen weiteren infos und strategien beeindruckt
Pokerartikel poker stefan raab boris becker und gehen dann folgt sammeln party-punkte, während ihr alle