Wednesday, November 12, 2008

More Glassfish and Netbeans Fun

two Libyan EE-9 Cascavel on paradeImage via WikipediaSometimes, and maybe always, Glassfish holds open a deployed jar file. When you do a clean build on a Netbeans "Enterprise Application" project, the build will fail saying that the jar file can not be deleted. The jar in question will have a path something like this:

{Netbeans Projects}\Project_EA\dist\gfdeploy\Project_SERVLET_war\WEB-INF\lib

Shutting down Glassfish (completely, you may have to use O/S tools to do this) will allow the jar to be deleted and rebuilt.

This is a big problem because it seems that if you do an ordinary build, rather than a clean build, on the EA project the jar file may not be updated. In one case this lead me to get a very strange runtime error claiming that a general Java class used in the EJB project belonging to the given EA assembly, had no constructor of a given form when clearly it did.
com.iwsinc.cms.jobs.PSStatusCheckJob.<init>(I)V
java.lang.NoSuchMethodError: com.iwsinc.cms.jobs.PSStatusCheckJob.<init>(I)V
at com.iwsinc.cms.ejb.CMSTimerEJB.cmsWatchEJBOperation(CMSTimerEJB.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
...
What was happening was that the build process was quietly failing to update the EJB part of the EA project - the jar in other words, because it was held open and could be be deleted.

This problem, I would guess, only happens on Windows.

Product Version: NetBeans IDE 6.1 (Build 200805300101)
Java: 1.6.0; Java HotSpot(TM) Client VM 1.6.0-b105
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Userdir: E:\openesb\.netbeans\openesb



Reblog this post [with Zemanta]

No comments:

Post a Comment