wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Package doesnot exist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Package doesnot exist" Watch "Package doesnot exist" New topic
Author

Package doesnot exist

feda alshahwan
Ranch Hand

Joined: Jul 26, 2008
Posts: 170
I am creatig a small client java program and i am importing some classes but i had errors during compilation, the error is that cannot find the package! How to find it ?where to put it?This is my code:

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;

public class Client {
public static void main(String [] args) {
try {
String endpointURL =
"http://localhost:8080/axis/services/SilverService";

Integer in = new Integer(10);
Service service = new Service();
Call call = (Call) service.createCall();

call.setTargetEndpointAddress(
new java.net.URL(endpointURL) );
call.setOperationName(
new QName("SilverService", "getIncrement") );

Object ret = call.invoke( new Object[] { in } );

System.out.println("Object = " + ret.getClass().getName());
System.out.println("Number Returned : " + ret.toString());
} catch (Exception e) {
System.err.println(e.toString());
}
}
}
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

It would be helpful if you could post the full error message. (And it is generally a good idea to do such when posting questions. - See the TellTheDetails tip for more information.)

Most likely your issue is that the package that is not being found in not on your classpath. So most likely you need to adjust your classpath. If its the org.apache.axis.client package not being found, you need to add the Apache Axis JAR to your classpath. (If you are not sure how to do that, let us know and we can show you.) But depending on the error message you are getting, there may be other things you may need to do.
[ August 04, 2008: Message edited by: Mark Vedder ]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19654
    
  18

You need to include the Axis JAR file in the classpath when compiling. javax.xml.namespace.QName won't be a problem if you're using Java 5.0 or higher.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
feda alshahwan
Ranch Hand

Joined: Jul 26, 2008
Posts: 170
Dear
Thank you for your response.I am using NetBeans. How to include a classpath using NetBeans?
When I used JDK1.5.0_16 from command line I got the following:


C:\tomcat50-jwsdp\tomcat50-jwsdp\webapps\axis\WEB-INF\classes>javac -cp %AXISCLA
SSPATH% %AXIS_HOME%\web-inf\classes\Client\src\client\Client.java
C:\TOMCAT50-JWSDP\TOMCAT50-JWSDP\WEBAPPS\AXIS\web-inf\classes\Client\src\client\
Client.java:10: java.security.Provider.Service is already defined in a single-ty
pe import
import org.apache.axis.client.Service;
^
C:\TOMCAT50-JWSDP\TOMCAT50-JWSDP\WEBAPPS\AXIS\web-inf\classes\Client\src\client\
Client.java:20: cannot find symbol
symbol : constructor Service()
location: class java.security.Provider.Service
Service service = new Service();
^
C:\TOMCAT50-JWSDP\TOMCAT50-JWSDP\WEBAPPS\AXIS\web-inf\classes\Client\src\client\
Client.java:21: cannot find symbol
symbol : method createCall()
location: class java.security.Provider.Service
Call call = (Call) service.createCall();
^
3 errors

C:\tomcat50-jwsdp\tomcat50-jwsdp\webapps\axis\WEB-INF\classes>
 
jQuery in Action, 2nd edition
 
subject: Package doesnot exist
 
Similar Threads
Non JSP client for Web Service
Invoking a webservice from a servlet
Unable to receive result from Web Service Method
axis and attachments
NullPointerException returned from webservice