Hello,
I cannot get an env-entry via naming. Resource-injection works but I need it via naming, because it is al list of env-entries which can vary in different deployments:
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>SessionService</ejb-name>
<ejb-class>service.SessionServiceImpl</ejb-class>
<env-entry>
<env-entry-name>deUrlPrefix</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>http://localhost:7500/axis/</env-entry-value>
</env-entry>
</session>
</enterprise-beans>
</ejb-jar>
package service;
@Stateful(name="SessionService")
@RemoteBinding(jndiBinding="ejb/SessionService")
public class SessionServiceImpl implements SessionService {
public void businessMethod() throws NamingException {
Context ctx = null;
try {
ctx = new InitialContext();
String prefix = (String) ctx.lookup("java:comp/env/enUrlPrefix"); // throws
} finally {
if (ctx != null) {
try {
ctx.close();
} catch (Throwable e) {
SessionServiceImpl.logger.error(
"could not close context", e);
}
}
}
}
}<injection-target> <injection-target-class> at.apa.defacto.service.SessionServiceImpl </injection-target-class> <injection-target-name>prefix</injection-target-name> </injection-target>
@Resource private String prefix;