geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Janko Heilgeist <>
Subject Missing resource injection in Tomcat/Axis vs Jetty/CXF
Date Thu, 13 Nov 2008 07:33:49 GMT

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 ........
private String someString = "DEFAULT";

public void init() {"init: EJB = '%08x', someString = '%s'",
hashCode(), this.someString));

public void doSomething(int counter) {"doSomething: EJB = '%08x', someString =
'%s'", hashCode(), this.someString));

Excerpts from ejb-jar.xml:


        <env-entry-value>Hello, world!</env-entry-value>

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
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

View raw message