I have managed to setup the environment (Axis 2 is running via Tomcat servlet container), create and deploy the web service etc.
However, when it came to testing the web service using a simple client class (the last stage)...
(instructions from tutorial..)
/**
*Now go to E:\Axis2Tutorial\Examples\HelloWorld\client\client\src directory and with the help of javac command compile the code.
*E:\Axis2Tutorial\Examples\HelloWorld\client\client\src>javac net/roseindia/*.java
**/
I get the following compliation errors:
package javax.xml.stream does not exist
package org.apache.axis2.client does not exist
package org.apache.axis2.addressing does not exist
package org.apache.axiom.soap does not exist
package org.apache.axis2.context does not exist
package org.apache.axis2.client does not exist
package org.apache.axis2.description does not exist
I'm assuming I have missing libraries, if so what can I do? and where can I get them?
I have checked that the environment variables are set up correctly for AXIS2_HOME and JAVA_HOME
I'm using JDK1.6 and axis2-1.5.1
Thanks,
Ben
Shinelin Samuel
Ranch Hand
Joined: Mar 01, 2010
Posts: 55
posted
0
Hi,
double check if you have configured the build path to the 'axis2-1.5.1' library.
I have set AXIS2_HOME env variable to C:\axis2-1.5.1-bin\axis2-1.5.1 (this folder contains the lib folder)
This message was edited 1 time. Last update was at by Ulf Dittmer
Kevin Eddy
Ranch Hand
Joined: Feb 24, 2010
Posts: 74
posted
0
Add "%AXIS2_HOME%\bin" to the PATH environment variable
for windows.
Kevin Eddy
Ranch Hand
Joined: Feb 24, 2010
Posts: 74
posted
0
That is to say, You've made a system variable called AXIS2_HOME , now add it to the PATH. The PATH is a system variable that should exist in the same area as where you added AXIS2_HOME.
hope that helps
Ben Linus
Greenhorn
Joined: Mar 02, 2010
Posts: 15
posted
0
Hi Kevin,
I have already added "%AXIS2_HOME%\bin" in PATH system variable.
This was part 1 of the tutorial.
I'm thinking, maybe the variables are set correctly but i'm missing certain libraries?
For example from two of the errors...,
package javax.xml.stream does not exist - is this a missing java lib??
package org.apache.axis2.client does not exist - is this a missing axis2 lib??
I'm probably annoying you at this point, but is the axis2.war file in Tomcat\webapps directory?
Kevin Eddy
Ranch Hand
Joined: Feb 24, 2010
Posts: 74
posted
0
Ben Linus wrote:Hi Kevin,
I have already added "%AXIS2_HOME%\bin" in PATH system variable.
This was part 1 of the tutorial.
I'm thinking, maybe the variables are set correctly but i'm missing certain libraries?
For example from two of the errors...,
package javax.xml.stream does not exist - is this a missing java lib??
package org.apache.axis2.client does not exist - is this a missing axis2 lib??
Okay, the javax.xml.stream seems to be in jsr173_1.0_api.jar
org.apache.axis2.client seems to exist in axis2-kernel-1.5.jar
you should have those jar files in your axis2-1.5\lib directory
Ben Linus
Greenhorn
Joined: Mar 02, 2010
Posts: 15
posted
0
1) I just downloaded the file again, it contains the same libs etc etc.
2) yes the .war is in the Tomcat\webapps directory and it works because the web service is running fine, i'm having problems with compiling the client class
3)you're NOT annoying!! you're really helping...alot!!!
Shinelin Samuel
Ranch Hand
Joined: Mar 01, 2010
Posts: 55
posted
0
Did you restart your PC after setting the environment variable? I had a problem with this once.
Ben Linus
Greenhorn
Joined: Mar 02, 2010
Posts: 15
posted
0
Kevin,
I just checked the .jars in axis2\lib
i have axis2-kernel-1.5.jar - (so, now i'm really confused to why its not reading that package!)
but i dont have jsr173_1.0_api.jar - (this isn't in the axis\lib directory)
Shinelin,
yes i have tried that
Ben Linus
Greenhorn
Joined: Mar 02, 2010
Posts: 15
posted
0
I know this is a lot to ask, but can someone try the tutorial?
there are only two parts and the first part is setting up tomcat, axis and the env variables (which you have probably already done)
Ben Linus
Greenhorn
Joined: Mar 02, 2010
Posts: 15
posted
0
Kevin,
just curious, but how did you work out where to find the libraries?
Kevin Eddy
Ranch Hand
Joined: Feb 24, 2010
Posts: 74
posted
0
Ben Linus wrote:Kevin,
just curious, but how did you work out where to find the libraries?
I browsed around in the axis2 folder found the lib directory, saw the jar's and it was a combination of googling the packages you were missing and trial and error on opening up the jars with 7zip and browsing through the directories (packages) until I found where they were.
Sadly, I haven't had a lot of luck going through online java tutorials regarding web services of any kind, be it axis2 or jaxws. I'm currently going through the axis tutorial and am having problems making it through that. Axis seems to be completely different than Axis2. I know what a pain the tutorials can be.
Kevin Eddy
Ranch Hand
Joined: Feb 24, 2010
Posts: 74
posted
0
Ben Linus wrote:Kevin,
I just checked the .jars in axis2\lib
i have axis2-kernel-1.5.jar - (so, now i'm really confused to why its not reading that package!)
but i dont have jsr173_1.0_api.jar - (this isn't in the axis\lib directory)
I thought maybe i've missed a step in the tutorial, so I started again from scratch, but its the same!
I might have to find a different Axis2 tutorial.
Ben
Ben Linus
Greenhorn
Joined: Mar 02, 2010
Posts: 15
posted
0
Does anyone know of an Axis 2 tutorial that they have actually used (one that works) ??
Kevin Eddy
Ranch Hand
Joined: Feb 24, 2010
Posts: 74
posted
0
What IDE are you using?
Ben Linus
Greenhorn
Joined: Mar 02, 2010
Posts: 15
posted
0
I'm not using one, the point of the tutorial is to understand the workings and deployment of services and client.
compiling classes using javac cmd
yann bajard
Greenhorn
Joined: Mar 17, 2010
Posts: 2
posted
0
hi,
I was stuck on the same problem, and i fix it !
The classs org.apache.axis2.client is under axis2-1.5.1/bin/lib/axis2-kernel-1.5.1.jar.
The problem is you have to specify the classpath during the compilation and the execution (even if you set environment variables):
javac -extdirs ~/axis2-1.5.1-bin/lib/ net/roseindia/*.java
and
java -classpath axis2-1.5.1/bin/lib/axis2-kernel-1.5.1.jar [and all your jars] net/roseindia/Test
Hope that helps !
Ben Linus
Greenhorn
Joined: Mar 02, 2010
Posts: 15
posted
0
Hi Yann,
With your help, I used javac -extdirs and my cilent classes have now complied! thanks
but when i execute the Test.java i get the following error...
Exception in thread "main" java.lang.NoClassDefFoundError: 2
Caused by: java.lang.ClassNotFoundException: 2
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: 2. Program will exit.
Any Ideas where i have made a mistake?
yann bajard
Greenhorn
Joined: Mar 17, 2010
Posts: 2
posted
0
hi ben linus,
You have to specify the jars files in the -classpath option (all the jars located in Axis2-1.5.1-bin directory) and not the directory.
(i don't remember if the seperator between jar files is ':' or something else ! )
I guess, with -classpath option, if you specify a directory, the jvm is looking for .class files and not jars ???
hi Yann,
i have also faced the same issue. I resolved the compilation error as given above.
But now am unable to run the Test client. Tried incluing jars as well. but still the same error.
D:\Axis2Tutorial\Examples\HelloWorld\client\client\src>java net\roseindia\Test
Exception in thread "main" java.lang.NoClassDefFoundError: net\roseindia\Test
Caused by: java.lang.ClassNotFoundException: net\roseindia\Test
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: net\roseindia\Test. Program will exit.