As i posted early, i am trying to get the ejb's working in two different application servers(ie SessionBean in WebLogic accessing Entity Bean in JBoss).I hope this can be acheivable since ejb's support distributed technology.
For this i created a .ear file for JBoss that contains EntityBean.
I got these directory structure for JBoss MyJB.ear
package sab.tutorial.ejb
->JBPersonEntityBean (The Bean Class)
->JBPerson_PK (The Primary Key)
package sab.tutorial.interfaces
->JBPerson (Remote)
->JBPersonHome (Home)
META-INF
->application.xml
->ejb-jar.xml
->jboss.xml
->jbosscmp-jdbc.xml
I used eclipse and xDoclet for the code and package generation and the configuration of Database(MySQL) is done(which is aleady tested and working)
Then for WebLogic MyWL.ear i have following directory structure
package com.tutorial.ejb
->RegisterSessionBean (The Bean Class which calls the entity bean in JBoss)
package com.tutorial.interfaces
->Register (Remote)
->RegisterHome (Home)
package com.tutorial.web
->RegisterServlet (Client that initializes the sessionbean and calls its method)
META-INF
->application.xml
->ejb-jar.xml
->weblogic-cmp-rdbms-jar.xml
->weblogic-ejb-jar.xml
WEB-INF
->web.xml
->weblogic.xml
index.html that calls the
servlet.
I have given the JNDI name for entity bean in JBoss as below in the jboss.xml
-----------------------------
.....
<entity>
<ejb-name>JBPerson</ejb-name>
<jndi-name>sab/tutorial/com/JBPerson</jndi-name>
</entity>
........
--------------------------------
and in the sessionbean of WebLogic in the implementation method i have the following code to access the JBoss entity bean
---------------------------------------------------------------
.............................
Properties prop = new Properties();
Context context=null;
Thread.currentThread().setContextClassLoader(org.jnp.interfaces.NamingContextFactory.class.getClassLoader());
prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
prop.put(Context.PROVIDER_URL, "localhost:1099");
prop.put(Context.URL_PKG_PREFIXES, "org.jboss.naming

rg.jnp.interfaces");
context = new InitialContext(prop);
JBPersonHome home = (JBPersonHome)context.lookup("sab/tutorial/com/JBPerson");
JBPerson bean = home.create(_LoginName, _Password, _FirstName, _LastName);
.........................
---------------------------------------------------------------
Also i had updated the policy files of weblogic.
I deployed the MyJB.ear in JBoss and MyWL.ear in WebLogic.
But while trying to call the sessionbean method it is giving following exception.
---------------------------------------------------------------
access denied (java.io.FilePermission C:\bea\user_projects\domains\mydomain\myserver\.wlnotdelete\EJBCompilerCache\cl0p924w3fjo\com\tutorial\interfaces\JBPersonHome.class read) java.security.AccessControlException: access denied (java.io.FilePermission C:\bea\user_projects\domains\mydomain\myserver\.wlnotdelete\EJBCompilerCache\cl0p924w3fjo\com\tutorial\interfaces\JBPersonHome.class read) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270) at java.security.AccessController.checkPermission(AccessController.java:401) at java.lang.SecurityManager.checkPermission(SecurityManager.java:542) at java.lang.SecurityManager.checkRead(SecurityManager.java:887) at java.io.File.exists(File.java:677) at weblogic.utils.classloaders.ClasspathClassFinder.getSourcesInternal(ClasspathClassFinder.java:291) at weblogic.utils.classloaders.ClasspathClassFinder.getSource(ClasspathClassFinder.java:246) at.................................
-----------------------------------------------------------------------
Even then my JBoss entity bean home is in the package sab.tutorial.interfaces ,its looking in some directory ie shown in the above exception (C:\bea\user_projects\domains\mydomain\myserver\.wlnotdelete\...) which i couldn't find.
Chris told that i should have the EntityBean remote and home interfaces with in the .ear file of weblogic.How can i put this, should i put these two class files in a jar file and jar it with the .ear file or how can i do this, if some one have any idea please help.
Thanks
Dinesh