Solved

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

Posted on 2014-02-01
3
2,736 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 35

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Convert from a json string array to a Java object 3 63
dao vs facade design patterns 2 32
Where to place postgres JDBC driver jar on tomcat 8 26
Java array 10 57
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

756 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