nkatoch2001 (35) [Avatar] Offline
#1
Hi all,

Please guide me for the following error:-

C:forGlassFishEJB3glassfishchapter8sql>tables.sql

C:forGlassFishEJB3glassfishchapter8sql>cd C:forGlassFishEJB3glassfishchapter8

C:forGlassFishEJB3glassfishchapter8>ant
Buildfile: build.xml

common:
[echo] BuildName: chapter8
[echo] BuildHome: C:forGlassFishEJB3glassfishchapter8
[echo] BuildFile: C:forGlassFishEJB3glassfishchapter8uild.xml
[echo] BuildJVM: 1.6

java-env-check:

init:
[echo] -----> Initializing project properties

setup:
[echo] -----> Creating the required sub-directories

compile-ejb-classes:
[echo] -----> Compiling EJBs

ejb-descriptor:

package-ejb:
[echo] -----> Create EJB jar file

compile-cli-classes:

cli-descriptor:

package-client:

package-app:

deploy:
[echo] asadmin.bat deploy --user admin --password adminadmin --host localhost --port 4848 --upload=true lib/chapter8.ear
[exec] CLI171 Command deploy failed : Deploying application in domain failed;
[exec] Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: java.net.Connect
Exception : Error connecting to server localhost on port 1527 with message Connection refused: connect.
[exec] Error Code: 0
[exec]

all:
[echo] -----> Creates and deploys all deployable units for the application

BUILD SUCCESSFUL
Total time: 4 seconds

Thanks for your time and inputs,

Naveen Katoch
dpanda (136) [Avatar] Offline
#2
Re: Chapter 8 - Getting an error while running ant script using glassfish
Have you started the Derby DB and running on port 1527?

thanks
Debu
nkatoch2001 (35) [Avatar] Offline
#3
Re: Chapter 8 - Getting an error while running ant script using glassfish
Hi Debu,

Thanks for your quick response. I am trying this way "Cd C:forGlassFishEJB3glassfishchapter4sql>ij
CONNECT 'jdbc:derby://localhost:1527/sun-appserv-samples;user=APP;Password=A
PP
run ‘tables.sql’

Please correct me where I am wrong. I will appreciate it.

Thanks again,

Naveen
nkatoch2001 (35) [Avatar] Offline
#4
Re: Chapter 8 - Getting an error while running ant script using glassfish
Hi Debu/Reza/colleagues,

Thanks for your precious time. Please give me any kind inputs.

Thanks again,

Naveen
nkatoch2001 (35) [Avatar] Offline
#5
Re: Chapter 8 - Getting an error while running ant script using glassfish
Hi Debu/Reza,

Thanks for your time. I am getting the followin message with ant script after running the derby sql at port 1527:-

C:forGlassFishEJB3glassfishchapter8>ant
Buildfile: build.xml

common:
[echo] BuildName: chapter8
[echo] BuildHome: C:forGlassFishEJB3glassfishchapter8
[echo] BuildFile: C:forGlassFishEJB3glassfishchapter8uild.xml
[echo] BuildJVM: 1.6

java-env-check:

init:
[echo] -----> Initializing project properties

setup:
[echo] -----> Creating the required sub-directories

compile-ejb-classes:
[echo] -----> Compiling EJBs

ejb-descriptor:

package-ejb:
[echo] -----> Create EJB jar file

compile-cli-classes:

cli-descriptor:

package-client:

package-app:

deploy:
[echo] asadmin.bat deploy --user admin --password adminadmin --host localhost --port 4848 --upload=true lib/chapter8.ear
[exec] Command deploy executed successfully with following warning messages: WARNING:
[exec]
[exec] JDO76614: Deployment encountered SQL Exceptions:
[exec] JDO76609: Got SQLException executing statement "CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL, PRIMARY KEY (SEQ_N
AME))": java.sql.SQLException: Table/View 'SEQUENCE' already exists in Schema 'APP'.
[exec]

all:
[echo] -----> Creates and deploys all deployable units for the application

BUILD SUCCESSFUL
Total time: 6 seconds

And the following message with ant run:-

C:forGlassFishEJB3glassfishchapter8>ant run
Buildfile: build.xml

common:
[echo] BuildName: chapter8
[echo] BuildHome: C:forGlassFishEJB3glassfishchapter8
[echo] BuildFile: C:forGlassFishEJB3glassfishchapter8uild.xml
[echo] BuildJVM: 1.6

java-env-check:

init:
[echo] -----> Initializing project properties

run:
[echo] Executing client class using C:EXAMPLES_HOMEglassfish/bin/appclient.bat
[exec] Dec 25, 2009 8:34:28 PM com.sun.enterprise.appclient.MainWithModuleSupport <init>
[exec] WARNING: ACC003: Application threw an exception.
[exec] javax.ejb.EJBException: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
[exec] java.rmi.RemoteException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.;
nested exception is:
[exec] javax.transaction.RollbackException: Transaction marked for rollback.
[exec] java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
[exec] java.rmi.RemoteException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.;
nested exception is:
[exec] javax.transaction.RollbackException: Transaction marked for rollback.
[exec] at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:243)
[exec] at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:205)
[exec] at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
[exec] at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225)
[exec] at actionbazaar.buslogic.__BazaarAdmin_Remote_DynamicStub.createBidder(actionbazaar/buslogic/__BazaarAdmin_Remote_DynamicStub.java)
[exec] at actionbazaar.buslogic._BazaarAdmin_Wrapper.createBidder(actionbazaar/buslogic/_BazaarAdmin_Wrapper.java)
[exec] at actionbazaar.buslogic.BazaarAdminClient.main(BazaarAdminClient.java:19)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[exec] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[exec] at java.lang.reflect.Method.invoke(Method.java:597)
[exec] at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:266)
[exec] at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:450)
[exec] at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:260)
[exec] at com.sun.enterprise.appclient.Main.main(Main.java:200)
[exec] Caused by: java.rmi.RemoteException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for roll
back.; nested exception is:
[exec] javax.transaction.RollbackException: Transaction marked for rollback.
[exec] at com.sun.enterprise.iiop.POAProtocolMgr.mapException(POAProtocolMgr.java:251)
[exec] at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1420)
[exec] at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1325)
[exec] at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:210)
[exec] at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:117)
[exec] at $Proxy96.createBidder(Unknown Source)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[exec] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[exec] at java.lang.reflect.Method.invoke(Method.java:597)
[exec] at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:154)
[exec] at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:687)
[exec] at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:227)
[exec] at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
[exec] at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1706)
[exec] at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:108smilie
[exec] at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:223)
[exec] at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:806)
[exec] at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563)
[exec] at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)
[exec] at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
[exec] Caused by: javax.transaction.RollbackException: Transaction marked for rollback.
[exec] at com.sun.enterprise.distributedtx.J2EETransaction.commit(J2EETransaction.java:465)
[exec] at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:371)
[exec] at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3826)
[exec] at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3605)
[exec] at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:138smilie
[exec] ... 19 more
[exec] Caused by: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.1 (Build b31g-fcs (10/19/2009))): oracle.toplink.essentials.exceptions.Datab
aseException
[exec] Internal Exception: java.sql.SQLIntegrityConstraintViolationException: INSERT on table 'USERS' caused a violation of foreign key constraint 'FK
_USERS_USER_ID' for key (idiot2). The statement has been rolled back.
[exec] Error Code: -1
[exec] at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:311)
[exec] at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:654)
[exec] at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:703)
[exec] at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:492)
[exec] at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:452)
[exec] at oracle.toplink.essentials.internal.sessions.AbstractSession.executeCall(AbstractSession.java:690)
[exec] at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:22smilie
[exec] at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:214)
[exec] at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.insertObject(DatasourceCallQueryMechanism.java:346)
[exec] at oracle.toplink.essentials.internal.queryframework.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:191)
[exec] at oracle.toplink.essentials.internal.queryframework.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:205)
[exec] at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:564)
[exec] at oracle.toplink.essentials.queryframework.InsertObjectQuery.executeCommit(InsertObjectQuery.java:89)
[exec] at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.performUserDefinedWrite(DatabaseQueryMechanism.java:760)
[exec] at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.performUserDefinedInsert(DatabaseQueryMechanism.java:724)
[exec] at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.insertObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:6
02)
[exec] at oracle.toplink.essentials.queryframework.WriteObjectQuery.executeCommitWithChangeSet(WriteObjectQuery.java:162)
[exec] at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:390)
[exec] at oracle.toplink.essentials.queryframework.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:109)
[exec] at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:62smilie
[exec] at oracle.toplink.essentials.queryframework.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:555)
[exec] at oracle.toplink.essentials.queryframework.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:13
smilie
[exec] at oracle.toplink.essentials.queryframework.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:110)
[exec] at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2244)
[exec] at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:952)
[exec] at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:909)
[exec] at oracle.toplink.essentials.internal.sessions.CommitManager.commitNewObjectsForClassWithChangeSet(CommitManager.java:269)
[exec] at oracle.toplink.essentials.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:190)
[exec] at oracle.toplink.essentials.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:266smilie
[exec] at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1044)
[exec] at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:496)
[exec] at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1126)
[exec] at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.issueSQLbeforeCompletion(UnitOfWorkImpl.java:2454)
[exec] at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.issueSQLbeforeCompletion(RepeatableWriteUnitOfWork.java:277)
[exec] at oracle.toplink.essentials.transaction.AbstractSynchronizationListener.beforeCompletion(AbstractSynchronizationListener.java:131)
[exec] at oracle.toplink.essentials.transaction.JTASynchronizationListener.beforeCompletion(JTASynchronizationListener.java:91)
[exec] at com.sun.enterprise.distributedtx.J2EETransaction.commit(J2EETransaction.java:429)
[exec] ... 23 more
[exec] Caused by: java.sql.SQLIntegrityConstraintViolationException: INSERT on table 'USERS' caused a violation of foreign key constraint 'FK_USERS_US
ER_ID' for key (idiot2). The statement has been rolled back.
[exec] at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
[exec] at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
[exec] at org.apache.derby.client.am.PreparedStatement.executeUpdate(Unknown Source)
[exec] at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:647)
[exec] ... 58 more
[exec] Caused by: org.apache.derby.client.am.SqlException: INSERT on table 'USERS' caused a violation of foreign key constraint 'FK_USERS_USER_ID' for
key (idiot2). The statement has been rolled back.
[exec] at org.apache.derby.client.am.Statement.completeExecute(Unknown Source)
[exec] at org.apache.derby.client.net.NetStatementReply.parseEXCSQLSTTreply(Unknown Source)
[exec] at org.apache.derby.client.net.NetStatementReply.readExecute(Unknown Source)
[exec] at org.apache.derby.client.net.StatementReply.readExecute(Unknown Source)
[exec] at org.apache.derby.client.net.NetPreparedStatement.readExecute_(Unknown Source)
[exec] at org.apache.derby.client.am.PreparedStatement.readExecute(Unknown Source)
[exec] at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
[exec] at org.apache.derby.client.am.PreparedStatement.executeUpdateX(Unknown Source)
[exec] ... 60 more
[exec] javax.ejb.EJBException: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
[exec] java.rmi.RemoteException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.;
nested exception is:
[exec] javax.transaction.RollbackException: Transaction marked for rollback.
[exec] at actionbazaar.buslogic._BazaarAdmin_Wrapper.createBidder(actionbazaar/buslogic/_BazaarAdmin_Wrapper.java)
[exec] at actionbazaar.buslogic.BazaarAdminClient.main(BazaarAdminClient.java:19)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[exec] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[exec] at java.lang.reflect.Method.invoke(Method.java:597)
[exec] at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:266)
[exec] at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:450)
[exec] at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:260)
[exec] at com.sun.enterprise.appclient.Main.main(Main.java:200)
[exec] Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
[exec] at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:462)
[exec] at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:260)
[exec] at com.sun.enterprise.appclient.Main.main(Main.java:200)
[exec] Caused by: java.lang.reflect.InvocationTargetException
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[exec] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[exec] at java.lang.reflect.Method.invoke(Method.java:597)
[exec] at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:266)
[exec] at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:450)
[exec] ... 2 more
[exec] Caused by: javax.ejb.EJBException: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception i
s:
[exec] java.rmi.RemoteException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.;
nested exception is:
[exec] javax.transaction.RollbackException: Transaction marked for rollback.
[exec] at actionbazaar.buslogic._BazaarAdmin_Wrapper.createBidder(actionbazaar/buslogic/_BazaarAdmin_Wrapper.java)
[exec] at actionbazaar.buslogic.BazaarAdminClient.main(BazaarAdminClient.java:19)
[exec] ... 8 more

BUILD SUCCESSFUL
Total time: 7 seconds

Thanks again for your time and inputs,

Naveen Katotch
nkatoch2001 (35) [Avatar] Offline
#6
Re: Chapter 8 - Getting an error while running ant script using glassfish
Hi all,

Thanks for your time. I am waiting for any suggestions or inputs.

Naveen
nkatoch2001 (35) [Avatar] Offline
#7
Re: Chapter 8 - Getting an error while running ant script using glassfish
Hi all,

Resolved and thanks for your time. I am fine upto chapters 10 using glassfish server 2.1

Thanks and kind regards,,

Naveen
HSK1000 (1) [Avatar] Offline
#8
Re: Chapter 8 - Getting an error while running ant script using glassfish
I am getting same error. What steps did you do to fix?
ant is fine. No errors. ant run, I see [exec] Caused by: org.apache.derby.client.am.SqlException: INSERT on table 'USERS' caused a violation of foreign key constraint 'FK_USERS_USER_ID' for key
(idiot2). The statement has been rolled back.
[exec] at org.apache.derby.client.am.Statement.completeExecute(Unknown Source)
[exec] at org.apache.derby.client.net.NetStatementReply.parseEXCSQLSTTreply(Unknown Source)