Solved

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

Posted on 2014-02-01
3
2,841 Views
Last Modified: 2014-02-21
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
Comment
Question by:Bruce
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Author Comment

by:Bruce
ID: 39826934
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
 
LVL 36

Accepted Solution

by:
mccarl earned 250 total points
ID: 39828663
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
 
LVL 6

Assisted Solution

by:Mahesh Bhutkar
Mahesh Bhutkar earned 250 total points
ID: 39829186
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 Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
This video teaches viewers about errors in exception handling.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question