geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Janko Heilgeist <janko.heilge...@scai.fraunhofer.de>
Subject Re: Missing resource injection in Tomcat/Axis vs Jetty/CXF
Date Tue, 18 Nov 2008 07:18:14 GMT
Hi Jarek,

thanks for your help with this issue. I opened GERONIMO-4416 for the
bug. Should I open a separate bug with the Axis2 project or do you
expect the bug to be in the Geronimo-specific wiring?

Janko

Jarek Gawor wrote:
> Janko,
> 
> I was able to replicate the problem with Axis2. It is creating an
> extra instance of the bean but that instance won't be used for
> anything. The properly injected bean will be used for all the calls.
> 
> Can you open a bug with this issue?
> 
> Thanks,
> Jarek
> 
> On Fri, Nov 14, 2008 at 2:13 AM, Janko Heilgeist
> <janko.heilgeist@scai.fraunhofer.de> wrote:
>> Hi Jarek,
>>
>> your advice didn't work, unfortunately. The server logs still show the
>> additional "DEFAULT"-bean. I've attached the files you requested plus my
>> openejb-jar.xml just for completeness.
>>
>> Janko
>>
>> Jarek Gawor wrote:
>>> I think you end up with deploying two ejbs because the name of bean
>>> specified in the DD does not match the bean name of the annotated
>>> class. And so, the container thinks you are deploying two separate
>>> beans. To fix it, you could try adding "name=MyWebService" attribute
>>> to the @Stateless annotation.
>>>
>>> If that still does not work right, send me your ejb-xml.jar file and
>>> the bean class.
>>>
>>> Jarek
>>>
>>> On Thu, Nov 13, 2008 at 2:33 AM, Janko Heilgeist
>>> <janko.heilgeist@scai.fraunhofer.de> wrote:
>>>> Hi,
>>>>
>>>> I've got a problem when deploying web services under Geronimo
>>>> Tomcat/Axis. Not every instance of the stateless bean seems to receive
>>>> the @Resource that I would like to have injected into the bean. I create
>>>> a simple web service with an injected string that is accessed inside a
>>>> @PostConstruct method and inside an exposed web method.
>>>>
>>>> // relevant excerpts ........
>>>> @Resource
>>>> private String someString = "DEFAULT";
>>>>
>>>> @PostConstruct
>>>> public void init() {
>>>>    logger.info(String.format("init: EJB = '%08x', someString = '%s'",
>>>> hashCode(), this.someString));
>>>> }
>>>>
>>>> public void doSomething(int counter) {
>>>>    logger.info(String.format("doSomething: EJB = '%08x', someString =
>>>> '%s'", hashCode(), this.someString));
>>>> }
>>>>
>>>> Excerpts from ejb-jar.xml:
>>>>
>>>> <session>
>>>>    <ejb-name>MyWebService</ejb-name>
>>>>    <ejb-class>
>>>>    com.heilgeist.tests.tst_ws_with_resource.ws_ejb.MyServiceEJBImpl
>>>>    </ejb-class>
>>>>
>>>>    <env-entry>
>>>>        <env-entry-name>
>>>> com.heilgeist.tests.tst_ws_with_resource.ws_ejb.MyServiceEJBImpl/someString
>>>>        </env-entry-name>
>>>>        <env-entry-type>java.lang.String</env-entry-type>
>>>>        <env-entry-value>Hello, world!</env-entry-value>
>>>>    </env-entry>
>>>> </session>
>>>>
>>>> When I access this web service I get the following lines in the server log:
>>>>
>>>> 08:12:41,381 INFO  [MyServiceEJBImpl] init: EJB = '00b6d31c', someString
>>>> = 'Hello, world!'
>>>> 08:12:41,477 INFO  [MyServiceEJBImpl] init: EJB = '01c50523', someString
>>>> = 'DEFAULT'
>>>> 08:12:41,745 INFO  [MyServiceEJBImpl] doSomething: EJB = '00b6d31c',
>>>> someString = 'Hello, world!'
>>>>
>>>> The second line indicates, that there is an additional instance of the
>>>> stateless bean, that doesn't receive the injected string. It is only
>>>> created once directly following the deployment of the web service. Even
>>>> if further MYServiceEJBImpl instances are created later on to handle
>>>> concurrent requests there is only a single instance of the bean with the
>>>> default string. It's web service method is never called. Using the
>>>> Jetty/CXF package this additional stateless bean is not created:
>>>>
>>>> 08:09:54,557 INFO  [MyServiceEJBImpl] init: EJB = '015db507', someString
>>>> = 'Hello, world!'
>>>> 08:09:54,558 INFO  [MyServiceEJBImpl] doSomething: EJB = '015db507',
>>>> someString = 'Hello, world!'
>>>>
>>>> Can someone please shed some light on this funny behavior of Axis?
>>>>
>>>> Regards, Janko
>>>>
>>


Mime
View raw message