Code Comments
Programming Forum and web based access to our favorite programming groups.I created 2 different enterprise application with Netbeans 6.1. Each of them has: - an EJB container with a persistence unit, a db schema, entity classes generated from database and a session facade bean for one Entity - a web application with a servlet that access to the session bean and call a findAll() method important: each enterprise access to different databases, with different tables. Application server is Glassfish v2 in bundle with Netbeans If I start netbeans and I launch one of them all works fine. The problem begin when I "run" the second one: the latter works fine(as the first before), but now the first doesn't work. the error is due to the fact that all the two application launches the query on the same database(the database of the second enterprise application launched)! Obviously the second app works. The first app throws an Exception due to the fact that the related table isn't available in the database. In my example: app 1: search the table EMPLOYEE in database A app 2: search the table PERSON in database B (app 2 is the last app launched) PERSON is retrieved without any error EMPLOYEE launch the following exception can someone help me? thank you in advance PS: also CustomerCMP example in bundle with Netbeans works in the same way. Internal Exception: java.sql.SQLSyntaxErrorException: Table 'EMPLOYEE' doesn't exist. Error Code: -1 Call: SELECT ID, FIRSTNAME, LASTNAME, EMAIL FROM EMPLOYEE Query: ReportQuery(dsffd.Employee) at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(Database Exception.java:319) at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExec uteCall(DatabaseAccessor.java:566) at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeCa ll(DatabaseAccessor.java:452) at oracle.toplink.essentials.threetier.ServerSession.executeCall(ServerSession. java:473) at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechani sm. executeCall(DatasourceCallQueryMechanism .java:228) at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechani sm. executeCall(DatasourceCallQueryMechanism .java:214) at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechani sm. executeSelectCall(DatasourceCallQueryMec hanism.java:285) at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechani sm. selectAllRows(DatasourceCallQueryMechani sm.java:615) at oracle.toplink.essentials.internal.queryframework.ExpressionQueryMechanism.s electAllRowsFromTable(ExpressionQueryMec hanism.java:2416) at oracle.toplink.essentials.internal.queryframework.ExpressionQueryMechanism.s electAllReportQueryRows(ExpressionQueryM echanism.java:2382) at oracle.toplink.essentials.queryframework.ReportQuery.executeDatabaseQuery(Re portQuery.java:802) at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery .java:628) at oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.execute(Object LevelReadQuery.java:692) at oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.executeInUnitO fWork(ObjectLevelReadQuery.java:746) at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQu ery(UnitOfWorkImpl.java:2233) at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(Abs tractSession.java:952) at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(Abs tractSession.java:924) at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.executeReadQue ry(EJBQueryImpl.java:367) at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getResultList( EJBQueryImpl.java:478) at com.sun.enterprise.util.QueryWrapper.getResultList(QueryWrapper.java:196) at dsffd.EmployeeFacade.findAll(EmployeeFacade.java:43) 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:597) at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecu rityManager.java:1067) at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176) at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.ja va:2895) at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3986) at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObject InvocationHandler.java:197) .. 37 more Caused by: java.sql.SQLSyntaxErrorException: La tabella 'EMPLOYEE' non esiste. at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source) at org.apache.derby.client.am.Connection.prepareStatement(Unknown Source) at com.sun.gjc.spi.base.ConnectionHolder.prepareStatement(ConnectionHolder.java :475) at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.prepareSt atement(DatabaseAccessor.java:1162) at oracle.toplink.essentials.internal.databaseaccess.DatabaseCall.prepareStatem ent(DatabaseCall.java:612) at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExec uteCall(DatabaseAccessor.java:485) .. 65 more Caused by: org.apache.derby.client.am.SqlException: Table 'EMPLOYEE' doesn't 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(Unkn own 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) .. 70 more
Post Follow-up to this messageHi, I'm sorry if this is not correct, just a hunch. I believe this might = happen if you have named the persistence units the same in both projects. (accepting the defaults, they will both be named ..pu1) wim -----Original Message----- From: Michele Sesana [mailto:sesanami-IWqWACnzNjyonA0d6jMUrA@public.gmane.or g]=20 Sent: vrijdag 13 juni 2008 16:08 To: nbj2ee-gVrGfPuBK2Jg9hUCZPvPmw@public.gmane.org Subject: [nbj2ee] multiple enterprise application and JPA does not work I created 2 different enterprise application with Netbeans 6.1. Each of them has: - an EJB container with a persistence unit, a db schema, entity classes=20 generated from database and a session facade bean for one Entity - a web application with a servlet that access to the session bean and=20 call a findAll() method important: each enterprise access to different databases, with different = tables. Application server is Glassfish v2 in bundle with Netbeans If I start netbeans and I launch one of them all works fine. The problem begin when I "run" the second one: the latter works fine(as=20 the first before), but now the first doesn't work. the error is due to the fact that all the two application launches the=20 query on the same database(the database of the second enterprise=20 application launched)! Obviously the second app works. The first app throws an Exception due to = the fact that the related table isn't available in the database. In my example: app 1: search the table EMPLOYEE in database A app 2: search the table PERSON in database B (app 2 is the last app launched) PERSON is retrieved without any error EMPLOYEE launch the following exception can someone help me? thank you in advance PS: also CustomerCMP example in bundle with Netbeans works in the same = way. Internal Exception: java.sql.SQLSyntaxErrorException: Table 'EMPLOYEE'=20 doesn't exist. Error Code: -1 Call: SELECT ID, FIRSTNAME, LASTNAME, EMAIL FROM EMPLOYEE Query: ReportQuery(dsffd.Employee) at=20 oracle.toplink.essentials.exceptions.DatabaseException.sqlException(Datab= ase Exception.java:319) at=20 oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicE= xec uteCall(DatabaseAccessor.java:566) at=20 oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.execut= eCa ll(DatabaseAccessor.java:452) at=20 oracle.toplink.essentials.threetier.ServerSession.executeCall(ServerSessi= on. java:473) at=20 oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMech= ani sm. executeCall(DatasourceCallQueryMechanism .java:228) at=20 oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMech= ani sm. executeCall(DatasourceCallQueryMechanism .java:214) at=20 oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMech= ani sm. executeSelectCall(DatasourceCallQueryMec hanism.java:285) at=20 oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMech= ani sm. selectAllRows(DatasourceCallQueryMechani sm.java:615) at=20 oracle.toplink.essentials.internal.queryframework.ExpressionQueryMechanis= m.s electAllRowsFromTable(ExpressionQueryMec hanism.java:2416) at=20 oracle.toplink.essentials.internal.queryframework.ExpressionQueryMechanis= m.s electAllReportQueryRows(ExpressionQueryM echanism.java:2382) at=20 oracle.toplink.essentials.queryframework.ReportQuery.executeDatabaseQuery= (Re portQuery.java:802) at=20 oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQu= ery .java:628) at=20 oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.execute(Obj= ect LevelReadQuery.java:692) at=20 oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.executeInUn= itO fWork(ObjectLevelReadQuery.java:746) at=20 oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecut= eQu ery(UnitOfWorkImpl.java:2233) at=20 oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(= Abs tractSession.java:952) at=20 oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(= Abs tractSession.java:924) at=20 oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.executeRead= Que ry(EJBQueryImpl.java:367) at=20 oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getResultLi= st( EJBQueryImpl.java:478) at=20 com.sun.enterprise.util.QueryWrapper.getResultList(QueryWrapper.java:196)= at dsffd.EmployeeFacade.findAll(EmployeeFacade.java:43) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at=20 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java= :39 ) at=20 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI= mpl .java:25) at java.lang.reflect.Method.invoke(Method.java:597) at=20 com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBS= ecu rityManager.java:1067) at=20 com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176) at=20 com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer= .ja va:2895) at=20 com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3986) at=20 com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObj= ect InvocationHandler.java:197) .. 37 more Caused by: java.sql.SQLSyntaxErrorException: La tabella 'EMPLOYEE' non=20 esiste. at=20 org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown = Source) at=20 org.apache.derby.client.am.SqlException.getSQLException(Unknown Source) at=20 org.apache.derby.client.am.Connection.prepareStatement(Unknown Source) at=20 com.sun.gjc.spi.base.ConnectionHolder.prepareStatement(ConnectionHolder.j= ava :475) at=20 oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.prepar= eSt atement(DatabaseAccessor.java:1162) at=20 oracle.toplink.essentials.internal.databaseaccess.DatabaseCall.prepareSta= tem ent(DatabaseCall.java:612) at=20 oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicE= xec uteCall(DatabaseAccessor.java:485) .. 65 more Caused by: org.apache.derby.client.am.SqlException: Table 'EMPLOYEE'=20 doesn't exist. at org.apache.derby.client.am.Statement.completeSqlca(Unknown=20 Source) at=20 org.apache.derby.client.net.NetStatementReply.parsePrepareError(Unknown=20 Source) at=20 org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply(Unknown= =20 Source) at=20 org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(U= nkn own=20 Source) at=20 org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(Unkn= own Source) at=20 org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(Unkno= wn=20 Source) at=20 org.apache.derby.client.am.Statement.readPrepareDescribeOutput(Unknown=20 Source) at=20 org.apache.derby.client.am.PreparedStatement.readPrepareDescribeInputOutp= ut( Unknown=20 Source) at=20 org.apache.derby.client.am.PreparedStatement.flowPrepareDescribeInputOutp= ut( Unknown=20 Source) at org.apache.derby.client.am.PreparedStatement.prepare(Unknown=20 Source) at=20 org.apache.derby.client.am.Connection.prepareStatementX(Unknown Source) .. 70 more
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.