Ok, I walk through the steps I developed and deployed the ear file.
Step 1.I develop a test.jar file in Jbuilder4.0, which include an entity bean TblAccount(CMP2.0) and a session bean TellerBean.
TblAccount JNDI name : djf/Account
TellerBean JNDI name : TellerHome
Step 2.I can run the TblAccount and the TellerBean rightly at JBuilder4.0 using Inprise Application Server.
Step 3.I use Application Assembly Tools to assemble an ear file.
I create a new application, and import the test.jar.I do nothing to the test.jar (I have a problem here. if I give a jndi name to the entity bean TblAccount, the primary key field would change from Accountid to compound key automaticly. Why? Is it right?)
Step 4.New a web module step7.war which includes two simple jsp files.
Step 5.New two EJB References in step7.war :step7/Teller & step7/TblAccountHome,I set the Home,Remote and Type of each ejb reference, but I don't set the bindings.(Because I didn't give the test.jar's EJB JNDI name in step3.)
Step 6.Save the file as Step7.ear.
Step 7.Genetate code for deployment.
Step 8.Launch the administrative console,deploy the ear file.
When go to the step Binding Enterprise Beans to JNDI names,the default jndi name is "test/EJSCMPTblAccountHomeBean" and "test/EJSStatelessTellerHomeBean", I change them to "djf/Account" and "TellerHome".
when mapping resource references to JNDI names, I set the JNDI name to "step7";
when mapping ejb references to enterprise beans ,I set as the following:
Step7.war step7/Teller : djf/Account
Step7.war Step7/TblAccountHome TellerHome
When Mapping ejb jar default data source references to jndi names,I set test.jar's Default Datasource JNDI Name to Step7 ;
When Mapping CMP data source references to JNDI name, I set test.jar:TblAccount's JNDI name Step7;
Save Configuration, finish the deployment.
Step 9. After restart the application server,I run the two jsp files.
the test1.jsp which use the session bean Teller works right, but the test2.jsp which use the entity bean TblAccount doesn't work.
test1.jsp:
-----------------------------------
Context ctx = new InitialContext();
Object Ref = ctx.lookup("TellerHome");
TellerHome Home = (TellerHome)PortableRemoteObject.narrow(Ref, TellerHome.class);
Teller teller=Home.create();
int t=teller.getTellerNo();
out.println("You use teller no:"+t);
-----------------------------------
test2.jsp
----------------------------------
Context ctx = new InitialContext();
Object Ref = ctx.lookup("djf/Account")
TblAccountHome Home = (TblAccountHome)PortableRemoteObject.narrow(Ref, TblAccountHome.class);
out.println("You are successful");
----------------------------------
when run the test2.jsp, I get the error message:"Error 500: Server caught unhandled exception from
servlet [JSP 1.1 Processor]: djf/Account"
if I change the statement to
----------------------------------
Object Ref = ctx.lookup("java:comp/env/step7/TblAccountHome");
-----------------------------------
It still doesn't work, I get the error message:"Error 500: Server caught unhandled exception from servlet [JSP 1.1 Processor]: Exception occurred while attempting to get an instance of the object for the specified reference object. "
[This message has been edited by Doris Deng (edited September 19, 2001).]