openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Toback (JIRA)" <>
Subject [jira] Created: (OPENJPA-518) openJpa jar is being locked causing future deployments on an app server to fail
Date Fri, 15 Feb 2008 23:06:08 GMT
openJpa jar is being locked causing future deployments on an app server to fail

                 Key: OPENJPA-518
             Project: OpenJPA
          Issue Type: Bug
          Components: lib
    Affects Versions: 1.0.1
         Environment: Windows XP, Sun PE Application Server 8.1, JDK 1.5.0_14-b03, Spring
            Reporter: Adam Toback
            Priority: Minor

So when I deploy my war file on the application server the first time, everything works fine.
 However, if I then try to undeploy or redeploy over the existing version the deployment will
fail because the openjpa.jar in the WEB-INF/lib directory of my war file is locked.

I did track down the bug to:

The addResources method is opening a URL Connection and not performing a setUseCaches(false).
 I made the following changes, implemented the new jar in my webapp and it fixed the problem.

    private static void addResources(URL url, Set set) throws IOException {
        InputStream in = null;
        BufferedReader reader = null;

        try {
   ucon = url.openConnection();
            in = ucon.getInputStream();
            reader = new BufferedReader(new InputStreamReader(in));
            String line;
            while ((line = reader.readLine()) != null) {
                if (line.trim().startsWith("#")
                    || line.trim().length() == 0)

                StringTokenizer tok = new StringTokenizer(line, "# \t");
                if (tok.hasMoreTokens()) {
                    String next = tok.nextToken();
                    if (next != null) {
                        next = next.trim();
                        if (next.length() > 0 && !next.startsWith("#"))
        catch (Exception e) {
            throw new IOException(e.toString());
        finally {
            try { reader.close(); } catch (IOException re) {}
            try { in.close(); } catch (IOException ioe) {}

Only the setUseCaches(false) should be necessary, but I was just making sure that anything
that was opened was closed.


This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message