I created CMP EJB, and i already configure my jboss.jcml file to connect to my Oracle DB.
Here is the parts of the configuration :
oracle.jdbc.driver.OracleDriver
DefaultDS
org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
jdbc:oracle:thin:@110.15.23.16:1521:mydb
test
test
0
5
I Always used it as DefaultDS, because if I use
with another name then the error will come.
But that's fine.. I use it as DefaultDS, and
everything works fine. And I can deploy my EJB
without any problems.
But when I run the client, the codes
looks like this :
// Create property for JBoss
Properties prop = new Properties();
prop.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
prop.setProperty("java.naming.provider.url","jnp://localhost:1099");
prop.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
// Create an Initial Context
Context initial = new InitialContext(prop);
System.out.println("Step 1. Initial Context");
// Look for the object
Object objref = initial.lookup("AccountBean");
System.out.println("Step 2. Look For The Object");
// Cast it
AccountHome myAccountHome = (AccountHome) PortableRemoteObject.
narrow(objref, AccountHome.class);
System.out.println("Step 3. Casting the Object");
// Create the object
boolean docreate = true;
if (docreate)
{
Account player = myAccountHome.create("104", 1000.2, "Hanna", "Hit");
System.out.println("Step 4. Creating the player");
}
It will not print the Step 4, because it fail
to create a new row for Account.
And the error message is just like this :
javax.ejb.CreateException: Could not create entity:java.sql.SQLException: ORA-00942: table or view does not exist
I check the table, and it's there !
What's happening ?
I used to use J2EE App Server, and it works fine !