Solved

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

Posted on 2014-02-01
3
2,778 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

734 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