Netbeans Deployment Fails After Renaming a Class

I am writing a test client for a web service. This is NetBeans 6.9.1 WebApplication using the JSF framework. I have one managed bean that calls a web service.

Everything worked fine until I noticed a typo in my bean class. It was a serviceBean, and I renamed it a ServiceBean with an uppercase first letter. I used the Netbeans secure rename function, and both the file name and class signature changed as expected.

But since then I have had many problems running the application on Glassfish 3.0.1.

I can create my application from Netbeans without errors (even "Clean and Build"). But if I turn around, the following message appears in the 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 the front page that will be sent to my managed bean. The form will be loaded despite 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) 

Thus, it will only be a subsequent error caused by the NoClassDefFoundError above.

And now for the weird part: If I create my project, it creates the ServiceBean.class file, but if I pull the project out of Netbeans and then look in my deployment directory, the class will be renamed to serviceBean.class.

The deployment process seems to be renaming the file.

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

UPDATE:. This is even better: renamed ServiceBean.java to ServiceBean2.java. Result: if "Clean and Build", the war file contains only ServiceBean2.class. If I deploy from NB, the build directory contains ServiceBean2.class and serviceBean.class. How to get rid of this ghost?

+7
source share
3 answers

I was able to reproduce a variation of this problem. I had to clear the NetBeans compilation cache (which seems to have OS problems that apologize ...)

To get past the problem that I encountered, I had to:

  • Stop server

  • Clean up project

  • Stop NetBeans

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

  • Launch NetBeans

When I ran a project that had problems, NetBeans recompiled the project, started the server, and opened index.xhtml. After that, I was able to successfully navigate through the application.

I opened http://netbeans.org/bugzilla/show_bug.cgi?id=198565 to track the problem. Review this problem and add any information that you think will help someone who tries to solve the problem.

+14
source

I had a very similar problem with NetBeans 7.3, which means that it is still not fixed. This happened after I renamed and deleted the entity class, and the JPA refused to believe that the class was deleted, so I could not install it in Glassfish.

I had many hours, starting with restarting NetBeans and Glassfish, to reinstall them. It turns out reinstalling NetBeans does not clear its cache, but where the problem is.

When I start OS X, I did the following in ~ / Library / Caches / NetBeans:

$ grep -r MyDeletedEntity *

And boom, there were some links to my remote class!

Then I continued deleting the contents in this folder, restarted NetBeans, and deployed again to Glassfish. Now it works!

If this does not work, / Applications / NetBeans / NetBeans {whateverversion} .app / Contents / Resources / NetBeans / nb / var / cache and delete everything in this folder.

0
source

Too late, but can help others. I only realized that Dzherel kept links to old names. I disabled JRebel for my project, cleaned up and created + run, and the problem went away.

0
source

All Articles