Kevin Schmidt created AMQ-4673:
----------------------------------

             Summary: Application that uses activemq-camel fails deploying to 
GlassFish v4
                 Key: AMQ-4673
                 URL: https://issues.apache.org/jira/browse/AMQ-4673
             Project: ActiveMQ
          Issue Type: Bug
          Components: activemq-camel
    Affects Versions: 5.6.0
         Environment: Mac OS X, Java 1.7.0_25, GlassFish v4
            Reporter: Kevin Schmidt
         Attachments: CamelEndpointLoader.patch

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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to