Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-4673

Application that uses activemq-camel fails deploying to GlassFish v4

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.6.0
    • 5.9.0
    • Camel
    • None
    • Mac OS X, Java 1.7.0_25, GlassFish v4

    • Patch Available

    Description

      I have an application that uses activemq-camel and deploys/works fine with GlassFish v3. I tried to deploy the same application on GlassFish v4 and get this error:

      remote failure: Error occurred during deployment: Exception while deploying the app [appname] : The lifecycle method [afterPropertiesSet] must not throw a checked exception. Related annotation information: annotation [@javax.annotation.PostConstruct()] on annotated element [public void org.apache.activemq.camel.component.CamelEndpointLoader.afterPropertiesSet() throws java.lang.Exception] of type [METHOD]. Please see server.log for more details.
      Command deploy failed.

      It appears that CamelEndpointLoader has a @PostConstruct method that throws an Exception and per the Java EE spec that isn't allowed. Apparently GlassFish v3 was lenient but v4 is not.

      Looking at the code, it is easy to fix. The afterPropertiesSet method just needs to catch the exceptions from addQueue/addTopic and log them at the end of the method like it does earlier in the method. If a failure to add these during the method should actually be considered a failure, then something like IllegalStateException or another unchecked exception should be thrown instead.

      This fix has been tested and verified to get past the problem.

      Attachments

        1. CamelEndpointLoader.patch
          2 kB
          Kevin Schmidt

        Activity

          People

            Unassigned Unassigned
            schmke Kevin Schmidt
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: