...
Excerpt | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The openejb.jndiname.format property allows you to supply a template for the global JNDI names of all your EJBs. With it, you have complete control over the structure of the JNDI layout can institute a design pattern just right for your client apps. See the Service Locator doc for clever ways to use the JNDI name formatting functionality in client code.
|
...
Given an ejb, FooBean, with the following interfaces:
- business-local: org.superbiz.LocalOne
- business-local: org.superbiz.LocalTwo
- business-remote: org.superbiz.RemoteOne
- business-remote: org.superbiz.RemoteTwo
- home: org.superbiz.FooHome
- local-home: org.superbiz.FooLocalHome
The following four examples would yield the same jndi names. The intention with these examples is to show the various ways you can isolate specific interfaces or types of interfaces to gain more specific control on how they are named.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<openejb-jar> <ejb-deployment ejb-name="FooBean"> <!-- applies to LocalOne, LocalTwo, RemoteOne, RemoteTwo, FooHome, and FooLocalHome --> <jndi name="{interfaceClass.simpleName}"/> </ejb-deployment> </openejb-jar> |
...
Changing the Default Setting
You are responsible for ensuring the names don't conflict.
...
Similarly conservative settings would be:
- {deploymentId}/{interfaceClass.simpleName}
- {moduleId}/{ejbName}/{interfaceClass}
- {ejbName}/{interfaceClass}
- {moduleId}/{ejbClass}/{interfaceClass}
- {ejbClass}/{interfaceClass}
- {ejbClass}/{interfaceClass.simpleName}
- {ejbClass.simpleName}/{interfaceClass.simpleName}
- {interfaceClass}/{ejbName}
Bordeline optimistic:
- {moduleId}/{interfaceClass}
- {interfaceClass}
The above two settings would work if you the interface wasn't shared by other beans.
...
Similarly pragmatic settings would be:
- {moduleId}/{ejbClass}/{interfaceType.annotationName}
- {ejbClass}/{interfaceType.xmlName}
- {ejbClass.simpleName}/{interfaceType.xmlNameCc}
- {interfaceType}/{ejbName}
- {interfaceType}/{ejbClass}
Optimistic settings
A very optimistic setting such as "{deploymentId}" would guarantee only one proxy for the bean will be bound to JNDI. This would be fine if you knew you only had one type of interface in your beans. For example, only business remote interfaces, or only business local interfaces, or only an EJBObject interface, or only an EJBLocalObject interface.
...
Similarly optimistic settings would be:
- {ejbName}
- {ejbClass}
- {ejbClass.simpleName}
- {moduleId}/{ejbClass.simpleName}
- {moduleId}/{ejbName}
Advanced Details on EJB 3.0 Business Proxies (the simple part)
...
Info | ||||
---|---|---|---|---|
| ||||
Read this section of either of these two apply to you:
If neither of these two items describe your apps, then there is no need to read further. Go have fun. |
...
Per spec rules many runtime exceptions (container or connection related) are thrown from javax.rmi.Remote proxies as java.rmi.RemoteException which is not a runtime exception and must be throwable via the proxy as a checked exception. The issue is that conflicting throws clauses are actually removed for two interfaces sharing the same method signature. For example two methods such as these:
- InterfaceA: void doIt() throws Foo;
- InterfaceB: void doIt() throws RemoteException;
can be implemented by trimming out the conflicting throws clauses as follows:
- Implementation: void doIt(){}
This is fine for a bean class as it does not need to throw the RMI required javax.rmi.RemoteException. However if we create a proxy from these two interfaces it will also wind up with a 'doIt(){}' method that cannot throw javax.rmi.RemoteException. This is very bad as the container does need to throw RemoteException to any business interfaces extending java.rmi.Remote for any container related issues or connection issues. If the container attempts to throw a RemoteException from the proxies 'doIt(){}' method, it will result in an UndeclaredThrowableException thrown by the VM.
...