users@glassfish.java.net

spring annotations inside WAB

From: <forums_at_java.net>
Date: Tue, 31 Jan 2012 10:51:14 -0600 (CST)

 Hi

I am trying to migrate a working WAR (that uses spring 3.0.5 and hibernate)
to osgi WAB (war bundle), I am using glassfish 3.1. Spring and Hibernate
jars are located in web-inf/lib

The problem that I currently encountered is
that org.springframework.stereotype.Service annotation on class has no
influence:

@Service("conversationServiceV1") public final class ConversationServiceV1 {
... }
The class is defined in spring xml:

    <jaxrs:server id="restConversationContainer"
address="/api/V1/conversations">
        <jaxrs:serviceBeans>
            <ref bean="conversationServiceV1" />
...
and I get an exception when the WAB is started:

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
No bean named 'conversationServiceV1' is defined at
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:527)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1083)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:274)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
... 45 more
Is there any reason why it wouldn't work? Are there recommendations for
working with spring in glassfish osgi environment (spring should be bundle,
or its ok to embed it in WAB)? 

thank you

 


--
[Message sent by forum member 'okna2000']
View Post: http://forums.java.net/node/883164