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