You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Torsten Krall <tk...@tkl-soft.de> on 2007/02/05 11:36:16 UTC
Several problems using jndi with ejb3
Hello,
I am using geronimo-tomcat6-jee5-2.0-M2 and I am writing an application
ear containing several ejbs (based on EJB3).
Everything compiles and deploys fine.
My ejb looks like this:
@Stateless
@Remote(Stammdatenverwaltung.class)
public class StammdatenVerwaltungServerImpl implements Stammdatenverwaltung
{
[...]some methods[...]
}
My first problem is getting a reference to this bean from a client:
Properties props = new Properties();
props.setProperty("java.naming.factory.initial",
"org.openejb.client.RemoteInitialContextFactory");
props.setProperty("java.naming.provider.url", "remotehost:4201");
props.setProperty("java.naming.security.principal", "system");
props.setProperty("java.naming.security.credentials", "XXX");
Context ic = new InitialContext(props);
Stammdatenverwaltung stammdatenverwaltung = (Stammdatenverwaltung)
ic.lookup("geronimo-deploymentUtil60647.tmpdir/StammdatenVerwaltungServerImplBusinessRemote");
After I could not get a handle to the bean with various jndi-names, I
found an article (http://incubator.apache.org/openejb/jndi-names.html)
saying that the deployment-id + "BusinessRemote" is used as jndi-name.
The problem is that this deployment-id changes with every deployment.
How can I set a fix value for the jndi-name?
I tried @Stateless with annotation-parameters "name" and "mapped-name"
but that did not help.
I do NOT want to use ejb-descriptors.
Second problem (perhaps this is the same problem):
I cannot get a handle to my global datasource "tkldienstplanpool" from
within my ejb (serverside).
I was not able to recognize the jndi-name of that datasource (deployed
as "tkldienstplanpool").
Do I need the deployment-id as prefix or do I need to add a
reference-description in my application.xml and geronimo-application.xml?
What should it look like? The usage-button in geronimo-console does only
show some examples for web.xml and geronimo-web.xml.
A last question:
Why does the geronimo-console-jndi-viewer not show jndi-names?
My ejb is listed but does not show its jndi-name
("geronimo-deploymentUtil60647.tmpdir/StammdatenVerwaltungServerImpl").
It looks like this:
Enterprise Applications
->default/tkldienstplan/1.0/car
->EJBModule
->stammdaten-ejb.jar
->SessionBeans
->StammdatenVerwaltungServerImpl
->java:comp/java:comp/TransactionManager
->java:comp/java:comp/TransactionSynchronizationRegistry
Many questions, I hope I will get some answers ;-)
Best regards,
Torsten Krall