如何在 NetBeans 中引用库?

发布于 2024-11-13 07:56:42 字数 559 浏览 5 评论 0原文

我有一个在旧版本的 NetBeans 中创建的 Java Web 服务项目,并且我已经好几个月没有访问它了,所以我的路径和安装的库是不同的。

当我尝试打开该项目时,出现“解决参考问题”对话框,并列出了两个参考问题:

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

我全新安装了 JDK 6 Update 25 和 NetBeans 7.0,并且正在运行 Windows 7。

我可以采取哪些步骤来解决此问题?我什至不知道从哪里开始,因为到目前为止我采取的每一种方法都没有取得任何成果。

注意: JAX-WS-ENDORSED 没有出现在我的库列表中,因此我无法删除它。隐藏的东西正在引用它。我该如何找到这个?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

你的背包 2024-11-20 07:56:42

我刚刚遇到这个问题,并从 http://netbeans.org/bugzilla/ 找到了一些帮助show_bug.cgi?id=187145。显然,当创建新的 Web 服务时,Netbeans 将创建 JAX-WS-ENDORSED 库。因此,转到“文件”>“新建文件,选择Web Service > Web 服务客户端并填写虚拟值(这可以在一次性项目中完成)。然后可以删除该客户端,Netbeans 将使用以下类路径条目创建库:

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

这些条目相对于您的 Netbeans 安装目录(在 OS X 上将位于 .app 内的 Contents/Resources/Netbeans 中)。或者,您可以使用上面的条目手动创建库。

此操作只需完成一次,因为该库将添加到 Netbeans 全局库列表中。

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.

红尘作伴 2024-11-20 07:56:42

最好的解决方案是编辑 project.properties 文件并替换下面的代码。

原始属性:endorsed.classpath=\${libs.JAX-WS-ENDORSED.classpath}

替换为:endorsed.classpath=\${lib.JAX-WS 2.2.classpath}< /strong>

在旧版本的 Netbeans 中,libs 位置中有 JAX-WS-ENDORSED 库。

较新版本的 Netbeans 在 lib 文件夹中具有 JAX-WS 2.2 库

** ALL THE BEST **

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 **

爱你是孤单的心事 2024-11-20 07:56:42

如果仍然需要,当我在 netbeans 7 中打开 netbeans 6.9 项目时,我会遇到同样的情况。无法使用库窗口解析“jaxb-endorsed”(在我的情况下是 jaxb 而不是 jaxws)引用。

我在 nbproject/project.properties 文件中找到了认可的.classpath 属性。
我仍然不确定它的目的是什么,但是在这个属性中我发现了对 jaxb-endorsed.classpath 的错误引用,所以我删除了,关闭了 netbeans 并再次打开,引用问题就消失了。

我已经将 Jaxb 2.2 库添加到我的项目中,因此它与我对 project.properties 所做的修改配合得很好。

我希望它有帮助。

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.

海拔太高太耀眼 2024-11-20 07:56:42

我遇到了类似的问题:不要删除 JAX-WS-ENDORSED - 提醒我投反对票。我必须去导入的项目>解决参考
问题对话>从那里删除指向旧 NB 文件夹的引用 - pic : 在此处输入图像描述

然后创建一次性网站按照 William Scott 建议的服务,然后添加新创建的 jar :在此处输入图像描述

I had a similar problem : DO NOT DELETE THE JAX-WS-ENDORSED - remind me to downvote. I had to go to the imported project > resolve reference
problems dialogue > delete the references from there which were pointing to the old NB folders - pic : enter image description here

and then create the throwaway web service as suggested by William Scott and then add the newly created jars :enter image description here

薆情海 2024-11-20 07:56:42

Netbeans 维护一组库,它们只是管理相关 jar 文件组的便捷方法。首先单击工具> 图书馆。您将看到库管理器窗口。

Library Manager

如果您下载了 jar 文件,您将看到添加自己的库的选项。如果您没有看到所需的库,您可以下载它们并自行添加。一旦该库存在于 Netbeans 中,您就可以转到Project Explorer 窗口并右键单击项目的Libraries 选项卡。选择添加库,您将有机会添加在库管理器中添加的库。

Netbeans maintains a set of libraries, which are simply a convenient way to manage groups of related jar files. Start by clicking Tools > Libraries. You will see the library manager window.

Library Manager

You will see the options to add your own libraries if you have jar files downloaded. If you do not see the library that you are looking for you can download them and add them your self. Once the library exist in Netbeans you can go to the Project Explorer window and right click on the Libraries tab of your project. Select Add Library and you will have the chance to add the library that you added in the library manager.

月依秋水 2024-11-20 07:56:42

您可能需要右键单击您的项目,转到属性 ->图书馆。

删除 JAX-WS-ENDORSED 库,并尝试使用 JAX-WS 2.2

同时删除 Metro 并尝试添加 METRO 2.0

这可能会解决您的问题。

您可能还需要右键单击 Web 服务引用并选择

编辑 Web 服务属性

,然后在 wsimport 选项选项卡上查看 xendorsed 是否设置为 true。

更新

您可能需要关闭 netbeans,然后再次打开它,它可能会起作用。我也遇到了类似的问题,我就这么做了,结果成功了。

唯一的区别(可能不需要)是我还添加了 JAXB 2.2 库,但那是因为我试图解决编译错误。

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.

欢你一世 2024-11-20 07:56:42

我遇到了同样的问题,并通过在 netbeans 插件中安装soap webservice 和 resful webservice 来修复它

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

信愁 2024-11-20 07:56:42

我修复了它:

  1. 卸载 netbeans。
  2. 删除 HOME/.netbeans 和 HOME/.nbi
  3. 然后再次安装 netbeans

I fix it:

  1. unistall netbeans.
  2. delete HOME/.netbeans and HOME/.nbi
  3. then install netbeans again
终弃我 2024-11-20 07:56:42

旧线程,不同且有效的解决方案...我刚刚将一些项目从一个系统移动到另一个系统并收到此错误。对于 NetBeans v7.3+,转到“工具”>“插件”、“可用插件”,然后搜索“SOAP”。您应该看到“SOAP Web 服务”。加载此库后,您将获得 JAX-WS-ENDORSED 库。重新启动 NetBeans,您应该能够获得干净的构建。

加载这个包会引入许多其他库。重新启动 IDE 时,您可能会收到一条通知,表明其他软件包现在有可用更新。

Old thread, different and effective solution... I just moved some projects from one system to another and got this error. With NetBeans v7.3+, go to Tools>Plugins, Available Plugins, then search for "SOAP". You should see "SOAP Web Services". On loading this library you'll get the JAX-WS-ENDORSED library. Restart NetBeans and you should be able to get a Clean Build.

Loading this package brings in a number of other libraries. On restarting the IDE you may get a notification that other packages now have available updates.

以歌曲疗慰 2024-11-20 07:56:42

执行以下操作(顺便说一句,在我的例子中是 NetBeans 6.9.1)

  • 1 为什么现在出现这个?
    因为我尝试使用新的 net bean 副本在其他电脑上打开项目

  • 2 问题如何
    未找到 JAX-WS-ENDORSED 的 Jar Lib

未找到问题 jar

  • 3 为什么首先需要它以及它的用途是什么?
    好吧,我在同一服务器/域上有一个网络服务,例如 localhost ,所以当然
    如果我从源文件夹中删除 Web 服务,但我需要它,它就会起作用

  • 4 做什么,它就会起作用?
    尝试以 wsdl 形式添加虚拟任何在线免费网络服务

例如 一些测试 Web 服务或搜索任何其他

尝试添加虚拟 Web 服务

这是我公开免费使用wsdl的来源

  • 5 什么然后呢?
    请添加它

请添加它

  • 现在怎么办?
    等待扫描项目内容应该没问题
    您可以从项目的库属性中重新检查
    或者看到没有红色/或解决引用问题
    在项目属性中

  • 那么究竟发生了什么?
    注意:JAX-WS-ENDORSED 它将自动添加到您的库中
    同样的方法也可以解决其他问题

Do the following ( BTW in my case its NetBeans 6.9.1 )

  • 1 Why this appeared now ?
    Because i tried to open project on other pc with fresh copy of net bean

  • 2 How the problem looks like ?
    Jar Lib Not Found for JAX-WS-ENDORSED

the problem jar not found

  • 3 Why it was needed at the first place and what its used for?
    Well i have a webservice on same server/domain e.g localhost , so of course
    it will work if i removed the web service from the folder in sources but i need it

  • 4 What to do?
    Try to add dummy any online free web service in form wsdl

like Some test web service or search for any other one

Try to add dummy web service

This is the source of my public free to use wsdl

  • 5 What then ?
    Just add it please

Just add it please

  • Now what ?
    Wait for scanning project stuff it should be ok
    you can re check from library properties of project
    or see that there is no red/ or resolve references problem
    in project properties

  • So what happened exactly?
    Note: JAX-WS-ENDORSED it will be added automatically to your libraries
    same methodology can solve other problems as well

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文