• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Exception in thread main

 
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which class is the exception complaining about? It should say so in the stack trace.
 
feda alshahwan
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Error is :
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis/client/AdminClient
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make sure that AXISCLASSPATH is correct and contains that class in one of its jar files.
 
feda alshahwan
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Execuse me could you explain more?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you solve my problem?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Only you can solve your problem. What have you investigated and/or tried since my last post?
 
feda alshahwan
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
dear,how can i know that jar files contain the class?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 JAXP implementation ( javax.xml.parsers.SAXParserFactory ) at an unknown location

Found Activation API ( javax.activation.DataHandler ) at C:\tomcat50-jwsdp\tomcat50-jwsdp\jwsdp-shared\lib\activation.jar

Optional Components
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
feda alshahwan
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
C:\Program Files\Java\jdk1.5.0_16\bin>java -cp $AXISCLASSPATH org.apache.axis.client.AdminClient deploy.wsdd

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis/client/AdminClient

[ UD: removed extraneous duplicated information ]
[ August 02, 2008: Message edited by: Ulf Dittmer ]
 
feda alshahwan
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
C:\Program Files\Java\jdk1.5.0_16\bin>echo %axisclasspath%
$AXIS_LIB/axis.jar:$AXIS_LIB/commons-discovery-0.2.jar:$AXIS_LIB/commons-logging
-1.0.4:$AXIS_LIB/log4j-1.2.8.jar:$AXIS_LIB?xml-apis.jar:$AXIS_LIB/xercesImpl.jar
:$AXIS_LIB/wsdl4j-1.5.1
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

C:\Program Files\Java\jdk1.5.0_16\bin>echo %AXISCLASSPATH%
$AXIS_LIB/axis.jar:$AXIS_LIB/commons-discovery-0.2.jar:$AXIS_LIB/commons-logging-1.0.4:$AXIS_LIB/log4j-1.2.8.jar:$AXIS_LIB?xml-apis.jar:$AXIS_LIB/xercesImpl.jar:$AXIS_LIB/wsdl4j-1.5.1


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
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear I fixed what you told me to but still same error!!!

C:\Program Files\Java\jdk1.5.0_16\bin>echo %AXISCLASSPATH%
C:\TOMCAT50-JWSDP\TOMCAT50-JWSDP\WEBAPPS\AXIS/WEB-INF/lib/axis.jar;C:\TOMCAT50-J
WSDP\TOMCAT50-JWSDP\WEBAPPS\AXIS/WEB-INF/lib/commons-discovery-0.2.jar;C:\TOMCAT
50-JWSDP\TOMCAT50-JWSDP\WEBAPPS\AXIS/WEB-INF/lib/commons-logging-1.0.4;C:\TOMCAT
50-JWSDP\TOMCAT50-JWSDP\WEBAPPS\AXIS/WEB-INF/lib/log4j-1.2.8.jar;C:\TOMCAT50-JWS
DP\TOMCAT50-JWSDP\WEBAPPS\AXIS/WEB-INF/lib/xml-apis.jar;C:\TOMCAT50-JWSDP\TOMCAT
50-JWSDP\WEBAPPS\AXIS/WEB-INF/lib/xercesImpl.jar;C:\TOMCAT50-JWSDP\TOMCAT50-JWSD
P\WEBAPPS\AXIS/WEB-INF/lib/wsdl4j-1.5.1.jar;C:\TOMCAT50-JWSDP\TOMCAT50-JWSDP\WEB
APPS\AXIS/WEB-INF/lib

C:\Program Files\Java\jdk1.5.0_16\bin>java -cp %AXISCLASSPATH% org.apache.axis.client.AdminClient deploy.wsdd
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/rpc/Service
Exception

[ UD: removed extraneous duplicated information ]
[ August 02, 2008: Message edited by: Ulf Dittmer ]
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.

Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.


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
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

MY WSDD FILE CONTENTS IS AS FOLLOWS:

deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="SilverService" provider="java:RPC">
<parameter name="className" value="SilverService"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Same error nothing changed!!!
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's with all the exclamations marks? It feels like you're yelling at us.

Post the complete WSDD file.
 
feda alshahwan
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the WSDD file:

deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="SilverService" provider="java:RPC">
<parameter name="className" value="SilverService"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For starters, put it into a package. Then make sure it is in the proper directory.
 
feda alshahwan
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic