I installed Axis with tomcat and jwsdp every thing is fine but when I deploy the service I got an error message using the following command java -cp $AXISCLASSPATH org.apache.axis.client.AdminClient deploy.wsdd
Exception in thread main java.lang.noclassdeffounderror
where the code is as follows: public class SilverService { public Object getIncrement(Object number) { if (number instanceof Integer) number = new Integer(((Integer)number).intValue()+1); return number; } } Can you tell me what is goig on and how to solve the problem Thanks
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35258
7
posted
0
Which class is the exception complaining about? It should say so in the stack trace.
Make sure that AXISCLASSPATH is correct and contains that class in one of its jar files.
feda alshahwan
Ranch Hand
Joined: Jul 26, 2008
Posts: 170
posted
0
Execuse me could you explain more?
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35258
7
posted
0
Explain what? Do you know what the "-cp" switch is and how it works? Are you familiar with the concept of classpaths? Do you know what the environment variable CLASSPATH contains? How did you set it?
feda alshahwan
Ranch Hand
Joined: Jul 26, 2008
Posts: 170
posted
0
Yes I know that cp will search in directory AXISCLASSPATH which I set it as environment variable but search for what jar files how to solve it
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35258
7
posted
0
A classpath is not a directory. Directories that are part of the classpath will be searched for loose class files, but not jar files. All jar files need to be listed explicitly in the classpath.
feda alshahwan
Ranch Hand
Joined: Jul 26, 2008
Posts: 170
posted
0
Can you solve my problem?
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35258
7
posted
0
Only you can solve your problem. What have you investigated and/or tried since my last post?
feda alshahwan
Ranch Hand
Joined: Jul 26, 2008
Posts: 170
posted
0
dear,how can i know that jar files contain the class?
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35258
7
posted
0
The "jar" tool will list all files in a jar file; the syntax is "jar tf myJarFile.jar".
But it's probably faster to include all jar files that come with Axis in your classpath; you'll probably need most of them anyway.
feda alshahwan
Ranch Hand
Joined: Jul 26, 2008
Posts: 170
posted
0
Thank you for your information but still I have same problem.And when I run Validate I got the following lines in the page Does this affect?: Axis Happiness Page Examining webapp configuration
Language: [en] [ja] Needed Components Found SAAJ API ( javax.xml.soap.SOAPMessage ) at C:\tomcat50-jwsdp\tomcat50-jwsdp\saaj\lib\saaj-api.jar
Found JAX-RPC API ( javax.xml.rpc.Service ) at C:\tomcat50-jwsdp\tomcat50-jwsdp\jaxrpc\lib\jaxrpc-api.jar
Found Apache-Axis ( org.apache.axis.transport.http.AxisServlet ) at C:\tomcat50-jwsdp\tomcat50-jwsdp\webapps\axis\WEB-INF\lib\axis.jar
Found Jakarta-Commons Discovery ( org.apache.commons.discovery.Resource ) at C:\tomcat50-jwsdp\tomcat50-jwsdp\webapps\axis\WEB-INF\lib\commons-discovery-0.2.jar
Found Jakarta-Commons Logging ( org.apache.commons.logging.Log ) at C:\tomcat50-jwsdp\tomcat50-jwsdp\bin\commons-logging-api.jar
Found Log4j ( org.apache.log4j.Layout ) at C:\tomcat50-jwsdp\tomcat50-jwsdp\webapps\axis\WEB-INF\lib\log4j-1.2.8.jar
Found IBM's WSDL4Java ( com.ibm.wsdl.factory.WSDLFactoryImpl ) at C:\tomcat50-jwsdp\tomcat50-jwsdp\webapps\axis\WEB-INF\lib\wsdl4j-1.5.1.jar
Found Activation API ( javax.activation.DataHandler ) at C:\tomcat50-jwsdp\tomcat50-jwsdp\jwsdp-shared\lib\activation.jar
Optional Components
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35258
7
posted
0
I have same problem.
Post the complete command line you're using, and all environment variables it may use (like AXISCLASSPATH).
And when I run Validate I got the following lines in the page Does this affect?
Whatever happens on the server does not affect applications on the client. Besides, all those messages indicate that files are being found; so no problems there. [ August 01, 2008: Message edited by: Ulf Dittmer ]
feda alshahwan
Ranch Hand
Joined: Jul 26, 2008
Posts: 170
posted
0
sorry for delay but the screen capture not working so I have to write it manually AXISCLASSPATH is :$AXIS_LIB/commons-logging.jar:$AXIS_LIB/jaxrpc.jar:$AXIS_LIB/saaj.jar: $AXIS_LIB/log4j-1.2.8.jar:$AXIS_LIB/xml-apis.jar: $AXIS_LIB/xercesImpl.jar
I see several problem here: #1 There's a question mark before "xml-apis" #2 Is AXIS_LIB defined correctly? #3 You're on Windows, yet you're using Unix-style "$AXIS_LIB" environment variables - Windows uses "%AXIS_LIB%", as you seem to be aware #4 You're on Windows, yet you're using Unix-style colons between path entries - Windows uses semicolons #5 There's a ".jar" missing at the of the list (after "wsdl4j-1.5.1")
You need to fix all of these before it can work.
feda alshahwan
Ranch Hand
Joined: Jul 26, 2008
Posts: 170
posted
0
Dear I fixed what you told me to but still same error!!!
[ UD: removed extraneous duplicated information ] [ August 02, 2008: Message edited by: Ulf Dittmer ]
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35258
7
posted
0
Please note that a single question mark is sufficient at the end of a sentence. It's also nicer.
Which version of Axis 1 are you using? The latest (1.4) includes files called saaj.jar and jaxrpc.jar, both of which are required.
By the way, "C:\TOMCAT50-JWSDP\TOMCAT50-JWSDP\WEBAPPS\AXIS/WEB-INF/lib" in the classpath doesn't accomplish anything, because it's a directory, and you shouldn't keep loose class files in the WEB-INF/lib directory.
feda alshahwan
Ranch Hand
Joined: Jul 26, 2008
Posts: 170
posted
0
Dear; Thank you very much I am really learning from you lots of things: First What you mean by "Doesnot accomplish anything and you shouldnot keep loose class files in web-inf\lib"?
Second I got the following error:
C:\Program Files\Java\jdk1.5.0_16\bin>java -cp %AXISCLASSPATH% org.apache.axis.client.AdminClient deploy.wsdd - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
Processing file deploy.wsdd Exception: deploy.wsdd (The system cannot find the file specified)
So where are those classes and how to set them?Still in Axisclasspath?
[ UD: removed extraneous and duplicated information ] [ August 02, 2008: Message edited by: Ulf Dittmer ]
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35258
7
posted
0
What you mean by "Does not accomplish anything and you should not keep loose class files in web-inf\lib"?
Having directories in the classpath is only useful if you have loose class files, and you should not have those in the WEB-INF/lib directory. Maybe you meant to use "classes" instead of "lib"; that would make sense. You may want to read up on the classpath concept before delving deeper into advanced stuff.
Those classes are part of JavaMail and the Java Activation Framework, respectively. You can download them from java.sun.com. But as the messages notes, they are only required if you're using attachments (which most WS don't use).
Exception: deploy.wsdd (The system cannot find the file specified)
Is that file in the directory from where you're running the client?
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35258
7
posted
0
Please also keep all the duplicated and unrelated stuff out of your posts. It's hard to find the important pieces amongst all that.
feda alshahwan
Ranch Hand
Joined: Jul 26, 2008
Posts: 170
posted
0
I copied deploy.wsdd to same directory of the client and I got the following errors :
C:\Program Files\Java\jdk1.5.0_16\bin>java -cp %AXISCLASSPATH% org.apache.axis.c lient.AdminClient %AXISCLASSPATH%\deploy.wsdd3 - Unable to find required classes (javax.activation.DataHandler and javax.mail.i nternet.MimeMultipart). Attachment support is disabled. Processing file C:\TOMCAT50-JWSDP\TOMCAT50-JWSDP\WEBAPPS\AXIS/WEB-INF/lib/axis.j ar - Exception: org.xml.sax.SAXException: Fatal Error: URI=null Line=1: Content is not allowed i n prolog. at org.apache.axis.utils.XMLUtils$ParserErrorHandler.fatalError(XMLUtils .java:723) at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source) at org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispat ch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un known Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:369) at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:388) at org.apache.axis.message.SOAPBodyElement.getDocumentElement(SOAPBodyEl ement.java:90) at org.apache.axis.message.SOAPBodyElement.<init>(SOAPBodyElement.java:7 9) at org.apache.axis.client.AdminClient.process(AdminClient.java:438) at org.apache.axis.client.AdminClient.process(AdminClient.java:404) at org.apache.axis.client.AdminClient.process(AdminClient.java:410) at org.apache.axis.client.AdminClient.process(AdminClient.java:328) at org.apache.axis.client.AdminClient.main(AdminClient.java:463) Exception: org.xml.sax.SAXException: Fatal Error: URI=null Line=1: Content is no t allowed in prolog.
Assuming that you're not actually missing an opening "<" in the first line, you're missing "<?xml version="1.0" ?>" as the first thing in the XML file.
feda alshahwan
Ranch Hand
Joined: Jul 26, 2008
Posts: 170
posted
0
Same error nothing changed!!!
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35258
7
posted
0
What's with all the exclamations marks? It feels like you're yelling at us.
So you haven't actually added the XML declaration, nor fixed the missing "<"?
Then what did you change after my last post?
feda alshahwan
Ranch Hand
Joined: Jul 26, 2008
Posts: 170
posted
0
I didnot change deploy.wsdd and it is processed but when I went to Axis server and checked the deployed service I got the following:
And now... Some Services AXIS error Sorry, something seems to have gone wrong... here are the details:
Fault - Could not find class for the service named: C:\tomcat50-jwsdp\tomcat50-jwsdp\webapps\axis\WEB-INF\classes\SilverService Hint: you may need to copy your class files/tree into the right location (which depends on the servlet system you are using).; nested exception is: java.lang.ClassNotFoundException: C:\tomcat50-jwsdp\tomcat50-jwsdp\webapps\axis\WEB-INF\classes\SilverService AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException faultSubcode: faultString: Could not find class for the service named: C:\tomcat50-jwsdp\tomcat50-jwsdp\webapps\axis\WEB-INF\classes\SilverService Hint: you may need to copy your class files/tree into the right location (which depends on the servlet system you are using).; nested exception is: java.lang.ClassNotFoundException: C:\tomcat50-jwsdp\tomcat50-jwsdp\webapps\axis\WEB-INF\classes\SilverService faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}hostname:moon-
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35258
7
posted
0
That should be easy to fix. The error message actually says what you need to check. I'd strongly advise to put all your classes in packages; that may actually be the reason it's not working.
feda alshahwan
Ranch Hand
Joined: Jul 26, 2008
Posts: 170
posted
0
It is only one class file which is silverservice.java and I put it under Axis class files.
here is the code :
public class SilverService { public Object getIncrement(Object number) { if (number instanceof Integer) number = new Integer(((Integer)number).intValue()+1); return number; } } How I can fix it?
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35258
7
posted
0
For starters, put it into a package. Then make sure it is in the proper directory.
feda alshahwan
Ranch Hand
Joined: Jul 26, 2008
Posts: 170
posted
0
I did what you told me craeted it using netbeans and placed the whole package in C:\tomcat50-jwsdp\tomcat50-jwsdp\webapps\axis\WEB-INF\classes but still same error?
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35258
7
posted
0
Come to think of it, the way to deploy services in Axis 2 is really to use an Axis service archive (an *.aar file), not to copy loose files into the WEB-INF/classes directory. Where would you have the services.xml file that determines which class to use for the service?