Undeployment of an remote Glassfish application locks objectdb log file


Netbeans 7.1
Oracle Glassfish 3.1.2
ObjectDB 2.3.7_04

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"

  <persistence-unit name="testdb" transaction-type="JTA">
      <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"/>



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



Could you please check what happens if you configure ObjectDB to use a log file in an external directory (not in the web application under Glassfish)?

ObjectDB Support

I tested to set the logpath to "c:/" and then it worked to undeploy the webapplication.
But now is the logfile at c:/ locked.

The problem from the begining was that because glassfish could't undeploy the webapp in a
correct way, which resulted in problems when deploying a new webapp. That problem is now gone.


// Parwing


> But now is the logfile at c:/ locked.

It is probably still locked. Anyway, until this is solved the workaround of using a log file outside the web application directory should be used.

ObjectDB Support