在重命名类后,Netbeans部署失败 [英] Netbeans deployment fails after class rename

查看:185
本文介绍了在重命名类后,Netbeans部署失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为webservice编写一个测试客户端。这是一个使用JSF框架的Netbeans 6.9.1 WebApplication。我有一个调用web服务的托管bean。



一切正常,直到我注意到我的bean类名中有一个错字。这是 serviceBean ,我用第一个字母的大写字母将它重命名为 ServiceBean 。我使用Netbeans的安全重命名功能,并且文件名和类签名都按预期发生了变化。



但是从那时起我在Glassfish 3.0.1上运行我的应用程序时遇到了很多麻烦。

我可以从Netbeans无错地构建我的应用程序(甚至是Clean& Build)。但是,如果我部署服务器日志中有以下消息:

  WARNUNG:注释处理中的错误:java.lang.NoClassDefFoundError: jsf / serviceBean(错误名称:jsf / ServiceBean)
WARNUNG:WEB9052:无法加载类jsf.ServiceBean,reason:java.lang.ClassNotFoundException:jsf.ServiceBean
INFO:Mojarra 2.0.2(FCS b10)为Kontext'/ PidClient'初始化。
SCHWERWIEGEND:无法加载带注释的类:jsf.serviceBean,reason:java.lang.NoClassDefFoundError:jsf / serviceBean(错误名称:jsf / ServiceBean)
INFO:将应用程序PidClient加载到/ PidClient

我在facelet页面上有一个表单,它将被提交给我的托管bean。尽管出现上述错误,表单仍会被加载,但如果我尝试提交它,我会收到以下错误消息:

  WARNUNG:/ index.xhtml @ 19,94 value =#{serviceBean.fldLname}:Target Unreachable,标识符'serviceBean'解析为空
javax.el.PropertyNotFoundException:/index.xhtml @ 19,94 value =# {serviceBean.fldLname}:目标不可达,标识符'serviceBean'在com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:93)
处解析为空
com.sun .faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:95)
位于javax.faces.component.UIInput.getConvertedValue(UIInput.java:1008)

所以这只会是由上面的NoClassDefFoundError造成的后续错误。



现在到奇怪的部分:
如果我建立我的项目,它会创建文件 ServiceBean.class ,但是如果我从Netbean部署项目然后查看我的部署目录,该类重命名为 serviceBean.class



似乎部署过程会重命名该文件。 p>

有什么问题? (Netbeans 6.9.1,Glassfish 3.0.1,Windows 7)
$ b 更新:更好:将ServiceBean.java重命名为ServiceBean2。 java的。结果:如果我的Clean& Build战争文件只包含ServiceBean2.class。如果我从NB部署,构建目录包含ServiceBean2.class serviceBean.class。如何摆脱这个鬼?

解决方案

我能够复制这个问题的一个变种。我必须清除NetBeans编译缓存(在操作系统上似乎存在问题这是宽大的...)



为了摆脱我遇到的问题,我必须:


  1. 停止服务器


  2. 清理项目

  3. >

    停止NetBeans

  4. 删除%HOME .netbeans\6.9\var\cache

  5. 启动NetBeans

当我运行有问题的项目时,NetBeans重新编译项目,启动服务器并打开index.xhtml。之后,我可以成功浏览应用程序。



我已打开 http://netbeans.org/bugzilla/show_bug.cgi?id=198565 来追踪问题。请监控该问题,并添加您认为可以帮助解决问题的人的任何信息。


I am writing a test client for a webservice. It's a Netbeans 6.9.1 WebApplication using JSF framework. I have one managed bean that calls the webservice.

Everything worked fine until I noticed a typo in my bean class name. It was serviceBean and I renamed it to ServiceBean with first letter upper case. I used safe rename function of Netbeans and both the filename and class signature changed as expected.

But from then I had a lot of trouble running my application on Glassfish 3.0.1.

I can build my application from Netbeans without error (even "Clean & Build"). But if I deploy there is the following message in server log:

WARNUNG: Error in annotation processing: java.lang.NoClassDefFoundError: jsf/serviceBean (wrong name: jsf/ServiceBean)
WARNUNG: WEB9052: Unable to load class jsf.ServiceBean, reason: java.lang.ClassNotFoundException: jsf.ServiceBean
INFO: Mojarra 2.0.2 (FCS b10) für Kontext '/PidClient' wird initialisiert.
SCHWERWIEGEND: Unable to load annotated class: jsf.serviceBean, reason: java.lang.NoClassDefFoundError: jsf/serviceBean (wrong name: jsf/ServiceBean)
INFO: Loading application PidClient at /PidClient

I have a form on a facelet page that will be submitted to my managed bean. The form will be loaded despite of the above error but if I try to submit it I get the following error:

WARNUNG: /index.xhtml @19,94 value="#{serviceBean.fldLname}": Target Unreachable, identifier 'serviceBean' resolved to null
javax.el.PropertyNotFoundException: /index.xhtml @19,94 value="#{serviceBean.fldLname}": Target Unreachable, identifier 'serviceBean' resolved to null
        at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:93)
        at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:95)
        at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1008)

So this will only be a follow-up error caused by the NoClassDefFoundError above.

And now to the strange part: If I build my project it creates the file ServiceBean.class but if I deploy the project from Netbeans and then look into my deployment directory the class is renamed to serviceBean.class.

It seems that deployment process renames the file.

What is the problem? (Netbeans 6.9.1, Glassfish 3.0.1, Windows 7)

UPDATE: It gets even better: Renamed ServiceBean.java to ServiceBean2.java. Result: If I "Clean & Build" the war file contains ServiceBean2.class only. If I deploy from NB the build dir contains ServiceBean2.class and serviceBean.class. How do I get rid of this ghost?

解决方案

I was able to replicate a variation of this problem. I had to clear the NetBeans compilation cache (which appears to have issues on OSes that are case-forgiving...)

To move past the issue that I encountered, I had to:

  1. Stop the server

  2. Clean the project

  3. Stop NetBeans

  4. Delete %HOME%.netbeans\6.9\var\cache

  5. Start NetBeans

When I ran the project which was having problems, NetBeans recompiled the project, started the server and opened the index.xhtml. I was able to navigate through the app successfully after that.

I have opened http://netbeans.org/bugzilla/show_bug.cgi?id=198565 to track the issue. Please monitor that issue and add any info that you think would assist somebody that attempts to resolve the issue.

这篇关于在重命名类后,Netbeans部署失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆