gpc / jms

JMS integration for Grails.
http://grails.org/plugin/jms
16 stars 28 forks source link

Grails3 version missing beans when running as a jar #16

Closed ColinHarrington closed 9 years ago

ColinHarrington commented 9 years ago

Using Grails 3.0.1, Java 8, JMS plugin 2.0.0.M1

Our service has:

static exposes = ['jms']
static container = "other"

void onMessage(message) { 
    // ...
}

The standardJmsListenerContainer bean is not present when running as a jar java -jar -Dgrails.env=development build/libs/appName-1.0.jar

There is no error when running with run or bootRun or running the war, but when running the jar I'm getting a NoSuchBeanDefinitionException.

Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'otherJmsListenerContainer' defined in null: Could
not resolve parent bean definition 'standardJmsListenerContainer'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
named 'standardJmsListenerContainer' is defined
        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:1238)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:1182)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1168)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:428)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:404)
        at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:186)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1105)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:969)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1288)
        ... 54 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'standardJmsListenerContainer' is defined
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:687)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1168)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:946)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:1223)
        ... 63 more

Here is the jms config for our container:

jms:
    containers:
        other:
            meta:
                parentBean: 'standardJmsListenerContainer'
            sessionTransacted: true
ColinHarrington commented 9 years ago

We upgraded to grails 3.0.4 and no longer had this issue. I did some testing and it was resolved with grails-3.0.2