dcsimg
Entity Bean Modeler
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Tom_Salmon
Posted On:   Thursday, May 17, 2001 07:18 AM

Folks, I am using JBuilder4 to create a simple Entity Bean and Test Client using the wizards. The web server I am using is WebLogic 5.1 sp9 and I am connecting to the scott/tiger schema on an Oracle 8i database. The bean deploys ok, however when accessing the bean an exception is generated Thu May 17 13:59:29 BST 2001:I EJB JAR deployment c:/jbproject/Employee/Emp.j ar Ignoring exception while setting context on bean: javax.ejb.EJBException: Error looking up dataSource:java.lang.ClassCastException : employee.EmpBeanBMPHomeImpl_ServiceStub at employee.EmpBeanBMP.setEntityContext(EmpBeanBMP.java:286) in the bean class employee.EmpBeanBMP:    More>>

Folks,


I am using JBuilder4 to create a simple Entity Bean and Test Client using the wizards.


The web server I am using is WebLogic 5.1 sp9 and I am connecting to the scott/tiger
schema on an Oracle 8i database.


The bean deploys ok, however when accessing the bean an exception is generated


Thu May 17 13:59:29 BST 2001:I EJB JAR deployment c:/jbproject/Employee/Emp.j
ar Ignoring exception while setting context on bean:
javax.ejb.EJBException: Error looking up dataSource:java.lang.ClassCastException
: employee.EmpBeanBMPHomeImpl_ServiceStub
at employee.EmpBeanBMP.setEntityContext(EmpBeanBMP.java:286)


in the bean class employee.EmpBeanBMP:


public void setEntityContext (EntityContext entityContext) {

super.setEntityContext(entityContext);

try {

Object obj;

javax.naming.Context context = new javax.naming.InitialContext();

obj = context.lookup("java:comp/env/jdbc/Emp");

System.out.println("Object class is " + obj.getClass().toString());

dataSource = (DataSource) obj;

System.out.println("dataSource class is " + dataSource.getClass().toString());

}

catch(Exception e) {

throw new EJBException("Error looking up dataSource:" + e.toString());

}

}


All this code is generated by the wizard. The casting is from employee.EmpBeanBMPHomeImpl_ServiceStub
to DataSource. The second"System.out.println" does not occur. The error occurs on the server. And the class path looks ok; the server start command being:



C:javaweblogic>.jre1_2jre injava
-ms64m -mx64m
-classpath .libweblogic510sp9boot.jar;.classes oot;
.evalcloudscapelibcloudscape.jar
-Dweblogic.class.path=.license;.libweblogic510sp9.jar;.classes;.libweblogicaux.jar;
.myserverserverclasses;c:OracleOra81jdbclibclasses12.zip
-Dweblogic.home=. -Djava.security.manager
-Djava.security.policy==.weblogic.policy weblogic.Server


Any ideas, thanks in advance for your help,


Tom.    <<Less

Re: Entity Bean Modeler

Posted By:   Tom_Salmon  
Posted On:   Friday, May 25, 2001 03:37 AM

Fixed It!!

In the bean class EmpBeanBMP.java I changed:

//obj = context.lookup("java:comp/env/jdbc/Emp");
obj = context.lookup("testDatabaseSource");

in the setEntityContext method.

Then in the weblogic.properties file I added:

weblogic.jdbc.DataSource.testDatabaseSource=thinPool

weblogic.jdbc.connectionPool.thinPool=
url=jdbc:oracle:thin:@ipaddress:port:sid,
driver=oracle.jdbc.driver.OracleDriver,
initialCapacity=1,
maxCapacity=1,
capacityIncrement=1,
props=user=scott;password=tiger

weblogic.allow.reserve.weblogic.jdbc.connectionPool.thinPool=everyone

I was confused as to how the connection was made between the EJB in weblogic and the Oracle data base.
About | Sitemap | Contact