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

Failure executing javac

There's nothing quite so deflating as seeing a message like the following

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
Failure executing javac, but could not parse the error:
An exception has occurred in the compiler (1.5.0_06). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
com.sun.tools.javac.code.Symbol$CompletionFailure: file javax\xml\ws\WebServiceClient.class not found


You really begin to wonder if you're doing something very wrong.
Fortunately you're not, and there is a quick and easy workaround.
This it turns out is a bug with javac on windows

My quick solution. Compile using cygwin. (If you haven't got cygwin, simply download setup.exe, and install)

This worked fine. My details was using jdk 1.5.0_06 (the bug has been reported on 1.5.0_04, and seen on 1.6 as well), on windows xp building using maven 2.0.8. Running my maven script in a cygwin bash window worked fine.

Tuesday, June 10, 2008

spring versions

Beware of mixing tools with different Spring versions.

I was using spring ws 1.5.3, and getting the following error

java.lang.NoSuchMethodError: org.springframework.util.ResourceUtils.toURI(Ljava/net/URL;)Ljava/net/URI;
....

Problem is that I had spring 2.0.x on my path, but spring-ws requires spring 2.5.x

Once I updated to using spring 2.5.x the problem was solved.

Could be a nasty problem, since the error message could easily lead you on a wild goose chase

Friday, June 06, 2008

GSM Codes

GSM codes.

These can be saved in you phonebook/ contacts list for fast access.

Most are obviously selectable by going through your phones menu, but these are much quicker, and I can never find some of them, like call waiting and call hold

Call Divert (all call types)

All
Set: **21*destination#[SEND]
Cancel: ##21#[SEND]
Query: *#21#[SEND]
No Answer
Delay nn seconds: max 30 seconds, in 5 second increments
Set: **61*destination*nn#[SEND]
Cancel: ##61#[SEND]
Query: *#61#[SEND]
Unreachable
Set: **62*destination#[SEND]
Cancel: #62#[SEND]
Query: *#62#[SEND]
Busy
Set: **67*destination#[SEND]
Cancel: ##67#[SEND]
Query: *#67#[SEND]
Cancel All
##002#[SEND]

Divert Voice Calls

All
Set: **21*destination*11#[SEND]
Cancel: ##21*11#[SEND]
Query: *#21*11#[SEND]
No Answer
Delay nn seconds: max 30 seconds, in 5 second increments
Set: **61*destination*11*nn#[SEND]
Cancel: ##61*11#[SEND]
Query: *#61*11#[SEND]
Unreachable
Set: **62*destination*11#[SEND]
Cancel: ##62*11#[SEND]
Query: *#62*11#[SEND]
Busy
Set: **67*destination*11#[SEND]
Cancel: ##67*11#[SEND]
Query: *#67*11#[SEND]

Divert Data Calls

All
Set: **21*destination*25#[SEND]
Cancel: ##21*25 [SEND]
Query: *#21*25#[SEND]
No Answer
Delay nn seconds: max 30 seconds, in 5 second increments
Set: **61*destination*25*nn#[SEND]
Cancel: ##61*25#[SEND]
Query: *#61*25#[SEND]
Unreachable
Set: **62*destination*25#[SEND]
Cancel: ##62*25#[SEND]
Query: *#62*25#[SEND]
Busy
Set: **67*destination*25#[SEND]
Cancel: ##67*25#[SEND]
Query: *#67*25#[SEND]

Divert Fax Calls

All
Set: **21*destination*13#[SEND]
Cancel: ##21*13#[SEND]
Query: *#21*13#[SEND]
No Answer
Delay nn seconds: max 30 seconds, in 5 second increments
Set: **61*destination*13*nn#[SEND]
Cancel: #61*13#[SEND]
Query: *#61*13#[SEND]
Unreachable
Set: **62*destination*13#[SEND]
Cancel: #62*13#[SEND]
Query: *#62*13#[SEND]
Busy
Set: **67*destination*13#[SEND]
Cancel: ##67*13#[SEND]
Query: *#67*13#[SEND]

Divert Line 2 Calls

All
Set: **21*destination*89#[SEND]
Cancel: #21*89#[SEND]
Query: *#21*89#[SEND]
No Answer
Delay nn seconds: max 30 seconds, in 5 second increments
Set: **61*destination*89*nn#[SEND]
Cancel: ##61*89#[SEND]
Query: *#61*89#[SEND]
Unreachable
Set: **62*destination*89#[SEND]
Cancel: ##62*89#[SEND]
Query: *#62*89#[SEND]
Busy
Set: **67*destination*89#[SEND]
Cancel: ##67*89#[SEND]
Query: *#67*89#[SEND]

Call Barring

You use call barring to control what calls can be made or received by your account.

The barring code is specific to the network. Ask your service provider.

Note that Call Barring can't work if call diverts are active, even the autodivert set by the network.

All calls
Set: **330*barring code#[SEND]
Cancel: ##330*barring code#[SEND]
Query: *#330#[SEND]

Outgoing calls
Set: **333*barring code#[SEND]
Cancel: ##333*barring code#[SEND]
Query: *#333#[SEND]

Incoming calls
Set: **35*barring code#[SEND]
Cancel: ##35*barring code#[SEND]
Query: *#35#[SEND]

Outgoing international calls
Set: **331*barring code#[SEND]
Cancel: ##331*barring code#[SEND]
Query: *#331#[SEND]

Outgoing international calls except to home country
Set: **332*barring code#[SEND]
Cancel: ##332*barring code#[SEND]
Query: *#332#[SEND]

Incoming calls when outside home country
Set: *351*barring code#[SEND]
Cancel: #351*barring code#[SEND]
Query: *#351#[SEND]
Cancel All Call Barring
#330*barring code#[SEND]

SMS

There is no provision in the GSM specification for diverting SMS messages

Bar incoming SMS messages
Set: *35*barring code*16#[SEND]
Cancel: #35*barring code*16#[SEND]

Call waiting

Set: *43#[SEND]
Cancel: #43#[SEND]
Query: *#43#[SEND]

Incoming call waiting

Reject: 0 [SEND]
Drop current call and answer: 1 [SEND]
Hold current call and answer: 2 [SEND]

Calling line identity

Outgoing CLI Release (recipient sees your number)
Release: *31# destination [SEND]
Withhold: #31# destination [SEND]
Query default: *#31#[SEND]

Incoming CLI Presentation (you see the caller's number)
Allow: *30#[SEND]
Prevent: #30#[SEND]
Query default: *#30#[SEND]

Dial number from memory

Where nnn is the memory location number
nnn#[SEND]

Change PIN codes

Change Call Barring pin code
**03*oldpin*newpin*newpin#

Change SIM pin code
**04*oldpin*newpin*newpin#

Change SIM pin2 code
**042*oldpin*newpin*newpin#

Unblock SIM pin code
**05*PUK*newpin*newpin#

Unblock SIM pin code
**06*PUK2*newpin*newpin#