users@glassfish.java.net

Re: spring annotations inside WAB

From: Sahoo <sanjeeb.sahoo_at_oracle.com>
Date: Tue, 31 Jan 2012 23:44:32 +0530

I have not used Spring inside a WAB, but let me try to gather some
information from you to see if there is something wrong with your bundle
itself. Can you send the WAB's manifest as well as output of "jar tf"
command?

Thanks,
Sahoo
On Tuesday 31 January 2012 10:21 PM, forums_at_java.net wrote:
> 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
>
>