How do I reference libraries in NetBeans?

2020-07-06 01:59发布

I have a Java Web Services project that was created in an older version of NetBeans, and I haven't accessed it in many months, so my paths and installed libraries are different.

When I try to open the project, I get a "Resolve Reference Problems" dialog, and two Reference Problems are listed:

"metro" library could not be found
"JAX-WS-ENDORSED" library could not be found

I have a fresh installation of JDK 6 Update 25 with NetBeans 7.0, and am running Windows 7.

What steps can I take to solve this? I don't even know where to start, as every approach I've taken so far hasn't gotten me anywhere.

Note: JAX-WS-ENDORSED does not appear in my Libraries listing, so I can't remove it. Something hidden is referencing it. How would I find this?

10条回答
戒情不戒烟
2楼-- · 2020-07-06 02:26

If it is still needed, I had the same situation when opened a netbeans 6.9 project in netbeans 7. There is no way to resolve the 'jaxb-endorsed' (in my case was jaxb and not jaxws) reference using the libraries window.

I found a endorsed.classpath property in the nbproject/project.properties file. I still not sure what is its purpose, but in this property I found the bad reference to jaxb-endorsed.classpath, so I deleted, closed netbeans and opened again, and the reference problem has gone.

I already have Jaxb 2.2 library added to my project, so it is working good with the modification I did to the project.properties.

I hope it helps.

查看更多
We Are One
3楼-- · 2020-07-06 02:27

You may want to right click on your project, go to properties -> Libraries.

Remove the JAX-WS-ENDORSED library, and try using JAX-WS 2.2

Also remove metro and try adding METRO 2.0

That may solve your problem.

You may also want to right-click on your web service references and select

Edit Web Service Attributes

Then on wsimport Options tab see if xendorsed is set to true.

UPDATE

You may need to close netbeans and then open it again, and it may work. I was having a problem similar and I just did that and it worked.

The only difference, and it may not be needed, is that I also added the JAXB 2.2 library, but that was because I was trying to solve a compilation error.

查看更多
叼着烟拽天下
4楼-- · 2020-07-06 02:33

I had same problem and Fix it by install soap webservice and and resful webservice in netbeans plugin

查看更多
冷血范
5楼-- · 2020-07-06 02:33

I fix it:

  1. unistall netbeans.
  2. delete HOME/.netbeans and HOME/.nbi
  3. then install netbeans again
查看更多
神经病院院长
6楼-- · 2020-07-06 02:37

I just came across this issue and found some help from http://netbeans.org/bugzilla/show_bug.cgi?id=187145. Apparently, Netbeans will create the JAX-WS-ENDORSED library when a new web service is created. So go to File > New File, choose Web Service > Web Service Client and fill in dummy values (this can be done in a throwaway project). This client can then be removed, and Netbeans will have created the library with the following classpath entries:

java/modules/ext/jaxws22/api/jaxws-api.jar
ide/modules/ext/jaxb/api/jaxb-api.jar

These are relative to your Netbeans install directory (on OS X will be located in Contents/Resources/Netbeans within the .app). Alternatively, you could create the library manually using the entries above.

This only needs to be done once, as the library will be added to Netbeans Global Libraries list.

查看更多
Bombasti
7楼-- · 2020-07-06 02:39

The best solution is to edit project.properties file and replace below piece of code.

Original property: endorsed.classpath=\${libs.JAX-WS-ENDORSED.classpath}

Replace with: endorsed.classpath=\${lib.JAX-WS 2.2.classpath}

In older versions of Netbeans there is JAX-WS-ENDORSED library in libs location.

Newer versions of Netbeans having JAX-WS 2.2 library in lib folder

** ALL THE BEST **

查看更多
登录 后发表回答