• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3202
  • Last Modified:

How do I add javax.jws.WebMethod to my Java project?

I am new to Java and am trying to work through a webservice tutorial.  The tutorial instructs me to "import" javax.jws.WebMethod.  I have done so at the top of my java class file but notes...

"Access restriction: The type WebMethod is not accessible due to restriction on required library C:\Program Files\Java\jre6\lib\rt.jar"
0
Bruce
Asked:
Bruce
2 Solutions
 
BruceAuthor Commented:
Also, javax.jws.WebMethod does not appear in the rt.jar in the package explorer tree.  Should it?

Can I somehow add this to rt.jar?

Sorry, I am really really new to this...
0
 
mccarlIT Business Systems Analyst / Software DeveloperCommented:
Do you have other libraries included in your project? One of these may also be providing the WebMethod annotation. I assume you are using Eclipse, if so you can check by pressing Ctrl + Shift + T  (or whatever your shortcut for "Open Type..." is) and then type WebMethod into the input text box. It should list all the libraries that it can see that annotation in.

Also, javax.jws.WebMethod does not appear in the rt.jar in the package explorer tree.  Should it?
Yes it should. And no you can't just add it somehow. I actually doubt that it isn't there. Do you at least have the "javax.jws" package? Can you send a screenshot of what you are looking at and where you expect to see it?
0
 
Mahesh BhutkarCommented:
You are using JAX-WS webservices.  
You may refer,  https://javaee-spec.java.net/nonav/javadocs/index.html?javax/jws/WebMethod.html

You can download jws-api.jar as well.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now