glassfish
  1. glassfish
  2. GLASSFISH-20332

@PreDestroy not called on Application subclass in GlassFish 4 build 83

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0_b83
    • Fix Version/s: 4.0_b86_RC2
    • Component/s: jax-rs
    • Labels:
      None
    • Environment:

      Windows, GlassFish 4 build 83 installed from zip

      Application subclass is packaged in a web-fragment jar which is contained in a war file

      Description

      A method annotated with @PreDestroy is not getting called on my Application subclass. The @PostConstruct method on the same class IS being called. Here is the class:

      @ApplicationPath("/persistence/")
      public class JPARSApplication extends Application {

      private final Set<Class<?>> classes;

      public JPARSApplication()

      { HashSet<Class<?>> c = new HashSet<Class<?>>(); // Unversioned Resources (resources that do not have version in the url) c.add(org.eclipse.persistence.jpa.rs.resources.unversioned.PersistenceResource.class); c.add(org.eclipse.persistence.jpa.rs.resources.unversioned.PersistenceUnitResource.class); c.add(org.eclipse.persistence.jpa.rs.resources.unversioned.EntityResource.class); c.add(org.eclipse.persistence.jpa.rs.resources.unversioned.SingleResultQueryResource.class); c.add(org.eclipse.persistence.jpa.rs.resources.unversioned.QueryResource.class); // Versioned Resources (resources that do have version in the url) c.add(org.eclipse.persistence.jpa.rs.resources.PersistenceResource.class); c.add(org.eclipse.persistence.jpa.rs.resources.PersistenceUnitResource.class); c.add(org.eclipse.persistence.jpa.rs.resources.EntityResource.class); c.add(org.eclipse.persistence.jpa.rs.resources.SingleResultQueryResource.class); c.add(org.eclipse.persistence.jpa.rs.resources.QueryResource.class); // Exception Mapping c.add(ClassNotFoundExceptionMapper.class); c.add(ConversionExceptionMapper.class); c.add(DatabaseExceptionMapper.class); c.add(EntityExistsExceptionMapper.class); c.add(EntityNotFoundExceptionMapper.class); c.add(IllegalAccessExceptionMapper.class); c.add(IllegalArgumentExceptionMapper.class); c.add(IllegalStateExceptionMapper.class); c.add(InvocationTargetExceptionMapper.class); c.add(IOExceptionMapper.class); c.add(JAXBExceptionMapper.class); c.add(JPARSExceptionMapper.class); c.add(MalformedURLExceptionMapper.class); c.add(NamingExceptionMapper.class); c.add(NonUniqueResultExceptionExceptionMapper.class); c.add(NoResultExceptionMapper.class); c.add(NoSuchMethodExceptionMapper.class); c.add(OptimisticLockExceptionMapper.class); c.add(PersistenceExceptionMapper.class); c.add(PessimisticLockExceptionMapper.class); c.add(QueryTimeoutExceptionMapper.class); c.add(RollbackExceptionMapper.class); c.add(TransactionRequiredExceptionMapper.class); c.add(JPARSConfigurationExceptionMapper.class); classes = Collections.unmodifiableSet(c); }

      @Override
      public Set<Class<?>> getClasses()

      { return classes; }

      @PostConstruct
      public void start()

      { System.out.println("---------START----------"); }

      @PreDestroy
      public void predestroy()

      { System.err.println("---------SHUTDOWN2----------"); System.out.println("---------SHUTDOWN----------"); throw new RuntimeException("BLA"); }

      }

      I do not see either the output or the exception in the GlassFish log when I undeploy the app or when I shut down glassfish.

        Issue Links

          Activity

          Hide
          shreedhar_ganapathy added a comment -

          Can you evaluate and reassign as appropriate?

          Show
          shreedhar_ganapathy added a comment - Can you evaluate and reassign as appropriate?
          Hide
          Jakub Podlesak added a comment -

          Confirmed this is a bug that should get fixed for 4.0.

          Show
          Jakub Podlesak added a comment - Confirmed this is a bug that should get fixed for 4.0.
          Hide
          Jakub Podlesak added a comment -

          Adjusted fixBy version and tag as per Shreedhar's request.

          Show
          Jakub Podlesak added a comment - Adjusted fixBy version and tag as per Shreedhar's request.
          Hide
          Jakub Podlesak added a comment -

          This has already been fixed in Jersey 2.0-rc2.

          Show
          Jakub Podlesak added a comment - This has already been fixed in Jersey 2.0-rc2.
          Hide
          Jakub Podlesak added a comment -

          Fixed with Jersey 2.0-rc2 integration (https://java.net/jira/browse/GLASSFISH-20385)

          Show
          Jakub Podlesak added a comment - Fixed with Jersey 2.0-rc2 integration ( https://java.net/jira/browse/GLASSFISH-20385 )

            People

            • Assignee:
              Jakub Podlesak
              Reporter:
              tware
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: