On Aug 5, 2006, at 1:53 PM, David Blevins wrote:

On Aug 5, 2006, at 1:29 PM, Mohammed Nour wrote:

Hi All...

During my play with OPENEJB-146 I was trying to deploy a bean that could be looked up through JNDI and has a local Home and Component interfaces, at first I had *NoNameFound* exception when I used the JNDI name assigned to this bean in the openejb-jar.xml, I went through the code of OEJB and found out that it adds the word *Local* to this JNDI name because this bean has a local Home and Component interfaces, and I sould lookup this bean using this modified JNDI name, I wonder why this happnes? shouldn't the client be able to lookup the bean using the JNDI name that she\he has assigned to the bean?

When you want the javax.ejb.EJBHome, you use the name you gave it. When you want the LocalHome, you tack on "Local" to the JNDI name. Also note, you can't lookup LocalHomes over the RemoteInitialContextFactory.

I think this test might be slightly easier to do at first. http:// jira.codehaus.org/browse/OPENEJB-145

Note that we don't have support for the remote business interface yet, but you could get the "backwards compatible remote home interface" part to run. Should be a fairly quick test to write. Essentially, creating this test is a matter of copying the previous test and deleting some ejb specific stuff.

Let me see if I can't help you with this one by writing out the steps. The first one is always the hardest. The many of the tests will be variations on this theme (i.e. take an ejb test and make a pojo test out of it). Though, they will get more challenging as we venture into the untested areas of Interceptors, Annotations and the like.

- Copy http://fisheye.codehaus.org/browse/openejb/trunk/openejb3/ openejb-itests/src/main/java/org/openejb/test/stateless/ StatelessJndiTests.java - Name the new test org/openejb/test/stateless/ StatelessPojoJndiTests.java
    - Edit the JNDI name (pick a new one, StatelessPojoBean maybe)
- Edit http://fisheye.codehaus.org/browse/openejb/trunk/openejb3/ openejb-itests/src/main/resources/META-INF/ejb-jar.xml - Copy the session bean called "BasicStatelessBean" to a new session bean entry called "BasicStatelessPojoBean" (or whatever you picked) - Edit the "ejb-class" value of "BasicStatelessPojoBean" to be org.openejb.test.stateless. BasicStatelessPojoBean (or whatever class name you like) - Copy this class http://fisheye.codehaus.org/browse/openejb/trunk/ openejb3/openejb-itests/src/main/java/org/openejb/test/stateless/ BasicStatelessBean.java - Name your copy org.openejb.test.stateless.BasicStatelessPojoBean (or whatever class name you picked)
    - Delete the part "implements javax.ejb.SessionBean"
    - Delete any methods that start with "ejb"
- Edit http://fisheye.codehaus.org/browse/openejb/trunk/openejb3/ openejb-itests/src/main/resources/META-INF/openejb-jar.xml - Copy the deployment entry called "BasicStatelessBean" to a new entry called "BasicStatelessPojoBean" (or whatever you picked) - Edit http://fisheye.codehaus.org/browse/openejb/trunk/openejb3/ openejb-itests/src/main/java/org/openejb/test/stateless/ StatelessTestSuite.java - Add a new entry for "suite.addTest(new StatelessPojoJndiTests ());"

That should get all the right stuff in the right spots. When the build goes, this test should run and pass. If you can get something to run, definitely send a patch no matter how much more work you want to do -- generally a good idea to check in often, same idea applies to patches. Get the patch in JIRA and then go ahead and keep hacking.

I've listed the steps, but I haven't detailed them, so absolutely feel encouraged to flood the list with questions. It helps everyone learn to participate, not just you. Don't expect to see a day when you are "out of questions" so don't feel like you are bothering anyone. Follow that advice and do expect to see a day when you are till not "out of questions", but the people around you no longer have answers -- this means you've grown. When that day comes, expect to be answering lots of questions ;)

Hope this helps,

-David

-David



Thanks and best regards...
Mohammad Nour El-Din


Reply via email to