what should i do the derby database can't be connected?

i downloaded the j2eetutorial of Sun ,and i practice the bank examples of J2EE platform, the other steps finished successfully according the pdf tutorial ,and formed the BankApp.ear ,but when i run the web client and the application client ,when accessed the database ,it can't show the data in the database.i try many times, but it still doesn't work ,what should i do ?please help me deal the problem,thank you very much.

[432 byte] By [weieila] at [2007-11-27 8:36:55]
# 1
You can start the database using the command,"start-database"AS_INSTALL_DIR/bin/asadmin start-databaseYou can find exception messages (if your app. is not working fine) in AS_INSTALL_DIR/domains/<domainname>logs/server.log.
Jagadish.Prasatha at 2007-7-12 20:34:02 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
first thank you very much.I am a beginner of J2EE ,i see the server.log according you tell me, but i can't understand the information,can you tell me your email, i send you the server.log,and you help me to find what is the real problems. thank you very much.
wweieila at 2007-7-12 20:34:02 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
You can post just the exception stack traces that you see in server.log
Jagadish.Prasatha at 2007-7-12 20:34:02 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4

the exception stack traces:

[#|2007-06-22T10:50:45.500+0800|WARNING|sun-appserver-pe8.2|javax.enterprise.system.container.ejb.entity.finder|_ThreadID=16;|JDO74004: Bean 'CustomerBean' method ejbFindByPrimaryKey:

com.sun.jdo.api.persistence.support.JDODataStoreException: JDO76400: Got a JDBC SQLException while executing the SQL statement:

SQL statement<select t0."CUSTOMERID", t0."PHONE", t0."STREET", t0."STATE", t0."EMAIL", t0."ZIP", t0."MIDDLEINITIAL", t0."FIRSTNAME", t0."CITY", t0."LASTNAME" from "CUSTOMERBEAN" t0 where t0."CUSTOMERID" = CAST (? AS VARCHAR(32672))> with input values:java.lang.String:200.

Please examine the SQLException for more information.

NestedException: org.apache.derby.client.am.SqlException: Table 'CUSTOMERBEAN' does not exist.

at com.sun.jdo.spi.persistence.support.sqlstore.SQLStoreManager.throwJDOSqlException(SQLStoreManager.java:614)

at com.sun.jdo.spi.persistence.support.sqlstore.SQLStoreManager.executeQuery(SQLStoreManager.java:448)

at com.sun.jdo.spi.persistence.support.sqlstore.SQLStoreManager.retrieve(SQLStoreManager.java:345)

at com.sun.jdo.spi.persistence.support.sqlstore.SQLStateManager.retrieve(SQLStateManager.java:2024)

at com.sun.jdo.spi.persistence.support.sqlstore.SQLStateManager.reload(SQLStateManager.java:1162)

at com.sun.jdo.spi.persistence.support.sqlstore.SQLStateManager.reload(SQLStateManager.java:1118)

at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl.getObjectById(PersistenceManagerImpl.java:633)

at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerWrapper.getObjectById(PersistenceManagerWrapper.java:245)

at com.sun.ebank.ejb.customer.CustomerBean1668466742_ConcreteImpl.ejbFindByPrimaryKey(CustomerBean1668466742_ConcreteImpl.java:538)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:585)

at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:983)

at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:147)

at com.sun.ejb.containers.EntityContainer.invokeFindByPrimaryKey(EntityContainer.java:738)

at com.sun.ejb.containers.EJBLocalHomeInvocationHandler.invoke(EJBLocalHomeInvocationHandler.java:181)

at $Proxy27.findByPrimaryKey(Unknown Source)

at com.sun.ebank.ejb.customer.CustomerControllerBean.getDetails(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:585)

at com.sun.enterprise.security.SecurityUtil$2.run(SecurityUtil.java:153)

at java.security.AccessController.doPrivileged(Native Method)

at com.sun.enterprise.security.application.EJBSecurityManager.doAsPrivileged(EJBSecurityManager.java:957)

at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:158)

at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:151)

at $Proxy18.getDetails(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:585)

at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:123)

at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:648)

at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:192)

at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1709)

at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1569)

at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:951)

at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:181)

at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:721)

at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:469)

at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1258)

at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:409)

NestedStackTrace:

org.apache.derby.client.am.SqlException: Table 'CUSTOMERBEAN' does not exist.

at org.apache.derby.client.am.Statement.completeSqlca(Unknown Source)

at org.apache.derby.client.net.NetStatementReply.parsePrepareError(Unknown Source)

at org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply(Unknown Source)

at org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(Unknown Source)

at org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(Unknown Source)

at org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(Unknown Source)

at org.apache.derby.client.am.Statement.readPrepareDescribeOutput(Unknown Source)

at org.apache.derby.client.am.PreparedStatement.readPrepareDescribeInputOutput(Unknown Source)

at org.apache.derby.client.am.PreparedStatement.flowPrepareDescribeInputOutput(Unknown Source)

at org.apache.derby.client.am.PreparedStatement.prepare(Unknown Source)

at org.apache.derby.client.am.Connection.prepareStatementX(Unknown Source)

at org.apache.derby.client.am.Connection.prepareStatement(Unknown Source)

at com.sun.gjc.spi.ConnectionHolder.prepareStatement(ConnectionHolder.java:362)

at com.sun.jdo.spi.persistence.support.sqlstore.sql.generator.DBStatement.<init>(DBStatement.java:64)

at com.sun.jdo.spi.persistence.support.sqlstore.SQLStoreManager.executeQuery(SQLStoreManager.java:419)

at com.sun.jdo.spi.persistence.support.sqlstore.SQLStoreManager.retrieve(SQLStoreManager.java:345)

at com.sun.jdo.spi.persistence.support.sqlstore.SQLStateManager.retrieve(SQLStateManager.java:2024)

at com.sun.jdo.spi.persistence.support.sqlstore.SQLStateManager.reload(SQLStateManager.java:1162)

at com.sun.jdo.spi.persistence.support.sqlstore.SQLStateManager.reload(SQLStateManager.java:1118)

at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl.getObjectById(PersistenceManagerImpl.java:633)

at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerWrapper.getObjectById(PersistenceManagerWrapper.java:245)

at com.sun.ebank.ejb.customer.CustomerBean1668466742_ConcreteImpl.ejbFindByPrimaryKey(CustomerBean1668466742_ConcreteImpl.java:538)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:585)

at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:983)

at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:147)

at com.sun.ejb.containers.EntityContainer.invokeFindByPrimaryKey(EntityContainer.java:738)

at com.sun.ejb.containers.EJBLocalHomeInvocationHandler.invoke(EJBLocalHomeInvocationHandler.java:181)

at $Proxy27.findByPrimaryKey(Unknown Source)

at com.sun.ebank.ejb.customer.CustomerControllerBean.getDetails(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:585)

at com.sun.enterprise.security.SecurityUtil$2.run(SecurityUtil.java:153)

at java.security.AccessController.doPrivileged(Native Method)

at com.sun.enterprise.security.application.EJBSecurityManager.doAsPrivileged(EJBSecurityManager.java:957)

at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:158)

at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:151)

at $Proxy18.getDetails(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:585)

at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:123)

at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:648)

at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:192)

at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1709)

at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1569)

at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:951)

at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:181)

at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:721)

at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:469)

at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1258)

at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:409)

|#]

wweieila at 2007-7-12 20:34:02 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5

com.sun.jdo.api.persistence.support.JDODataStoreException: JDO76400: Got a JDBC SQLException while executing the SQL statement:

SQL statement<select t0."CUSTOMERID", t0."PHONE", t0."STREET", t0."STATE", t0."EMAIL", t0."ZIP", t0."MIDDLEINITIAL", t0."FIRSTNAME", t0."CITY", t0."LASTNAME" from "CUSTOMERBEAN" t0 where t0."CUSTOMERID" = CAST (? AS VARCHAR(32672))> with input values:java.lang.String:200.

Please examine the SQLException for more information.

NestedException: org.apache.derby.client.am.SqlException: Table 'CUSTOMERBEAN' does not exist.

wweieila at 2007-7-12 20:34:02 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 6
org.apache.derby.client.am.SqlException: Table 'CUSTOMERBEAN' does not exist.
wweieila at 2007-7-12 20:34:02 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 7

[#|2007-06-23T18:51:54.234+0800|WARNING|sun-appserver-pe8.2|javax.enterprise.system.container.ejb.entity.finder|_ThreadID=11;|JDO74004: Bean 'CustomerBean' method ejbFindByPrimaryKey:

com.sun.jdo.api.persistence.support.JDOFatalInternalException: JDO76519: Failed to identify vendor type for the data store.

NestedException: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: java.security.PrivilegedActionException : Error opening socket to server localhost on port 1527 with message : null

[#|2007-06-23T18:56:54.156+0800|WARNING|sun-appserver-pe8.2|javax.enterprise.resource.resourceadapter|_ThreadID=12;|RAR5038:Unexpected exception while creating resource|#]

[#|2007-06-23T18:56:54.156+0800|WARNING|sun-appserver-pe8.2|javax.enterprise.resource.resourceadapter|_ThreadID=12;|RAR5058: Error while Resizing pool.|#]

wweieila at 2007-7-12 20:34:02 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 8

[#|2007-06-22T10:58:22.406+0800|WARNING|sun-appserver-pe8.2|javax.enterprise.system.stream.err|_ThreadID=12;|

Debug: RemoteException occurred in server thread; nested exception is:

java.rmi.RemoteException: Exception thrown from bean; nested exception is: com.sun.jdo.api.persistence.support.JDODataStoreException: JDO76400: Got a JDBC SQLException while executing the SQL statement:

SQL statement<select t0."CUSTOMERID", t0."PHONE", t0."STREET", t0."STATE", t0."EMAIL", t0."ZIP", t0."MIDDLEINITIAL", t0."FIRSTNAME", t0."CITY", t0."LASTNAME" from "CUSTOMERBEAN" t0 where t0."CUSTOMERID" = CAST (? AS VARCHAR(32672))> with input values:java.lang.String:200.

Please examine the SQLException for more information.

NestedException: org.apache.derby.client.am.SqlException: Table 'CUSTOMERBEAN' does not exist.|#]

[#|2007-06-22T10:58:25.296+0800|SEVERE|sun-appserver-pe8.2|javax.enterprise.system.container.ejb|_ThreadID=12;|NRU-com.sun.ebank.ejb.account.AccountControllerBean: Cannot load from BACKUPSTORE FOR Key: <1090ac6400101f-515bdd02-2>|#]

[#|2007-06-22T10:58:25.296+0800|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.ejb|_ThreadID=12;|EJB5018: An exception was thrown during an ejb invocation on [AccountControllerBean]|#]

[#|2007-06-22T10:58:25.296+0800|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.ejb|_ThreadID=12;|

javax.ejb.NoSuchObjectLocalException: The EJB does not exist. session-key: 1090ac6400101f-515bdd02-2

wweieila at 2007-7-12 20:34:02 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 9

[#|2007-06-22T10:58:12.500+0800|WARNING|sun-appserver-pe8.2|javax.enterprise.system.stream.err|_ThreadID=11;|

Debug: RemoteException occurred in server thread; nested exception is:

java.rmi.RemoteException: Exception thrown from bean; nested exception is: com.sun.jdo.api.persistence.support.JDODataStoreException: JDO76400: Got a JDBC SQLException while executing the SQL statement:

SQL statement<select t0."CUSTOMERID", t0."PHONE", t0."STREET", t0."STATE", t0."EMAIL", t0."ZIP", t0."MIDDLEINITIAL", t0."FIRSTNAME", t0."CITY", t0."LASTNAME" from "CUSTOMERBEAN" t0 where t0."CUSTOMERID" = CAST (? AS VARCHAR(32672))> with input values:java.lang.String:200.

Please examine the SQLException for more information.

NestedException: org.apache.derby.client.am.SqlException: Table 'CUSTOMERBEAN' does not exist.|#]

[#|2007-06-22T10:58:22.265+0800|WARNING|sun-appserver-pe8.2|javax.enterprise.system.stream.err|_ThreadID=12;|

Debug: /accountList|#]

[#|2007-06-22T10:58:22.265+0800|WARNING|sun-appserver-pe8.2|javax.enterprise.system.stream.err|_ThreadID=12;|

Debug: Forwarding to template.|#]

[#|2007-06-22T10:58:22.359+0800|WARNING|sun-appserver-pe8.2|javax.enterprise.system.stream.err|_ThreadID=12;|

Debug: CustomerControllerBean ejbCreate|#]

[#|2007-06-22T10:58:22.375+0800|WARNING|sun-appserver-pe8.2|javax.enterprise.system.stream.err|_ThreadID=12;|

Debug: AccountControllerBean ejbCreate|#]

[#|2007-06-22T10:58:22.375+0800|WARNING|sun-appserver-pe8.2|javax.enterprise.system.stream.err|_ThreadID=12;|

Debug: TxControllerBean ejbCreate|#]

[#|2007-06-22T10:58:22.375+0800|WARNING|sun-appserver-pe8.2|javax.enterprise.system.stream.err|_ThreadID=12;|

Debug: AccountControllerBean getAccountsOfCustomer|#]

[#|2007-06-22T10:58:22.375+0800|WARNING|sun-appserver-pe8.2|javax.enterprise.system.stream.err|_ThreadID=12;|

Debug: CustomerBean setEntityContext|#]

wweieila at 2007-7-12 20:34:02 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 10

[#|2007-06-22T10:58:12.484+0800|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.ejb|_ThreadID=11;|EJB5018: An exception was thrown during an ejb invocation on [CustomerBean]|#]

[#|2007-06-22T10:58:12.500+0800|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.ejb|_ThreadID=11;|EJB5018: An exception was thrown during an ejb invocation on [AccountControllerBean]|#]

wweieila at 2007-7-12 20:34:02 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 11
thank you very much
wweieila at 2007-7-12 20:34:03 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 12

Hi. First of all, for beginning J2EE/Java EE developers, I would recommend using the latest version of Java EE and the Java EE 5 Tutorial, available here:

http://java.sun.com/javaee/5/docs/tutorial/doc/

The new features of Java EE 5 will make it much easier for you to jump into enterprise Java development. For example, the Java EE 5 version of Duke's Bank uses Java Persistence API entities and EJB 3.0 beans, which are much easier to develop than J2EE 1.4 entity beans and session beans.

Second, you're using the J2EE 1.4 Tutorial, but which exact version of the tutorial are you using? That is, what is the date on the front cover of the PDF or the welcome page in the HTML?

For the J2EE 1.4 version of Duke's Bank, the SQL file used to create the tables is .../j2eetutorial14/examples/bank/sql/create-table.sql. The exception message is strange, because there shouldn't be a CUSTOMERBEAN table. It should be CUSTOMER, as you can see in that file. Did you run this task before deploying the EAR?

asant create-db_common

Basically, I would recommend using the latest tutorial unless you absolutely must use J2EE 1.4.

-ian

ievansa at 2007-7-12 20:34:03 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 13
yes i use the J2EE 1.4 tutorial ,and i do run the command : asant create-db_common.and i must use the j2ee 1.4.then what's the wrong with the programm?
wweieila at 2007-7-12 20:34:03 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 14
Ok. The second thing to check is if you can deploy and run the provided EAR, located here:.../j2eetutorial14/examples/bank/provided-jars/DukesBankApp.earIf not, there is likely a problem with your configuration.
ievansa at 2007-7-12 20:34:03 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 15
I deploy and run the provided EAR, and it warning"Please check your customer ID and password. "and then i can't access the jsp page , does it mean the configurations has something wrong ? then how to deal the priblems?thank you very much.
wweieila at 2007-7-21 22:44:20 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 16
and the customer ID and password isn't the "200 j2ee" and " bankadmin j2ee" ,which are setted before packaging the .jar file?
wweieila at 2007-7-21 22:44:20 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...