System:
Netbeans 7.1
Oracle Glassfish 3.1.2
ObjectDB 2.3.7_04
Senario:
Create a simple WebApplication with a "hello world" web service interface in Netbeans.
Add objectDB test code to the web service:
@WebService(serviceName = "NewWebService") public class NewWebService { @PersistenceContext(unitName = "testdb") private EntityManager em; /** This is a sample web service operation */ @WebMethod(operationName = "hello") public String hello(@WebParam(name = "name") String txt) { em.persist(new NewEntity()); // just store anything... return "Hello " + txt + " !"; } }
Create a new entity class (NewEntity) with default values.
Modify persistence.xml to contain:
<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="testdb" transaction-type="JTA"> <provider>com.objectdb.jpa.Provider</provider> <properties> <property name="javax.persistence.jdbc.url" value="testdb.odb"/> <property name="javax.persistence.jdbc.user" value="admin"/> <property name="javax.persistence.jdbc.password" value="admin"/> </properties> </persistence-unit> </persistence>
Compile and deploy the WebApplication to an remote Glassfish server. Don't forget to set an admin password on
the Glassfish server and enable "secure admin".
Now, log in remotely to the Glassfish server web managment interface http://ipaddress:4848/ and
undeploy your WebApplication.
Look into the "domain1\applications" folder on the Glassfish server and find that the WebApplication is still there.
If you try to manually delete the folder, you will get an "Folder in use" error message. Because
the "odbxxxxxx.log" file is in use by an java process. If I restart Glassfish, I can delete the folder.
The locked file problem does not exist if I deploy the WebApplication on an local Glassfish server.
How can I undeploy the application without getting the logfile locked ?
// Parwing