0

I just used:

ant

ant deploy

and it gave me following error:

deploy:
     [echo] localhost
     [echo] 8080
     [echo] order
     [echo] C:\glassfishv3\glassfish\docs\javaee-tutorial\examples\bp-project\ma
in.xml/../../../../../../bin/asadmin.bat
     [echo] order
     [echo] SQL92
     [exec] Deprecated syntax, instead use:
     [exec] asadmin --port 4848 --host localhost deploy [options] ...
     [exec] com.sun.enterprise.admin.cli.CommandException: remote failure: Excep
tion while loading the app : javax.ejb.EJBException: javax.ejb.CreateException:
Initialization failed for Singleton ConfigBean
     [exec]
     [exec] Cannot create tables for application order. The expected DDL file or
der_order_createDDL.jdbc is not available.
     [exec]
     [exec]
     [exec] Command deploy failed.

That means without making any changes. Then I included the following in the build.xml taken from roster example:

<target name="-pre-deploy" unless="netbeans.home" depends="init">
        <antcall target="start-db"/>
    </target>

But the problem remains the same. The server.log shows:

Caused by: javax.ejb.EJBTransactionRolledbackException
	at com.sun.ejb.containers.BaseContainer.mapLocal3xException(BaseContainer.java:2253)
	at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2053)
	at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1955)
	at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:198)
	at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:84)
	at $Proxy264.createPart(Unknown Source)
	at order.ejb.__EJB31_Generated__RequestBean__Intf____Bean__.createPart(Unknown Source)
	at order.ejb.ConfigBean.createData(ConfigBean.java:36)
	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.ejb.containers.interceptors.BeanCallbackInterceptor.intercept(InterceptorManager.java:1006)
	at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:61)
	at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:109)
	at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCallback(SystemInterceptorProxy.java:133)
	at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.init(SystemInterceptorProxy.java:115)
	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.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:961)
	at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:61)
	at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:390)
	at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:373)
	at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:521)
	... 38 more
Caused by: javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean
	at com.sun.ejb.containers.BaseContainer.checkExceptionClientTx(BaseContainer.java:4975)
	at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4810)
	at com.sun.ejb.containers.StatefulSessionContainer.postInvokeTx(StatefulSessionContainer.java:1656)
	at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2004)
	... 62 more
Caused by: javax.ejb.EJBException: Object: order.entity.Part@63b596 is not a known entity type.
	at order.ejb.RequestBean.createPart(RequestBean.java:53)
	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 org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1056)
	at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1128)
	at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:4087)
	at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5272)
	at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5252)
	at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:190)
	... 60 more

To tell you the truth every example of the J2EE tutorials have some problems and can't be run smoothly. I can't run them as is and have to spent time figuring out what went wrong. Can anyone point out what went wrong?

Thanks.

Edited by peter_budo: Correcting code tags. Please use [code][/code] instead od {code}

2
Contributors
7
Replies
8
Views
7 Years
Discussion Span
Last Post by ~s.o.s~
1

It is always a good solution to google for the base exception message. Chances are that someone else has already encountered this error and found a solution for the same. Searching around, it seems that using Glassfish + Eclipse has some problems when it comes to dealing with object persistence when the entity class is updated. Are you using Glassfish with eclipse? If that blog post doesn't solve your issue, then read some other articles and see if that helps.

0

Thanks for your reply. I am using glassfish. In the persistence.xml it used eclipse ddl generator which didn't myself include. Not only glassfish, the whole tutorial example package sucks big time. I am not complaining because I couldn't do it. I fixed other problems with other examples also but this thing is really awful. I don't know why would sun release such crappy code.

0

I used the thing that is suggested in the post. It seemingly worked after restarting the server 2 times. Now I have another problem with this *persistently* problemetic example:

[exec] com.sun.enterprise.admin.cli.CommandException: remote failure: Excep
tion while loading the app : javax.ejb.EJBException: javax.ejb.CreateException:
Initialization failed for Singleton ConfigBean
     [exec]
     [exec] Deployment encountered SQL Exceptions:
     [exec]     Got SQLException executing statement "CREATE TABLE PERSISTENCE_O
RDER_PART_DETAIL (PARTNUMBER VARCHAR(255) NOT NULL, REVISION INTEGER NOT NULL, S
PECIFICATION CLOB(2147483647), DRAWING BLOB(2147483647), PRIMARY KEY (PARTNUMBER
, REVISION))": java.sql.SQLException: Table/View 'PERSISTENCE_ORDER_PART_DETAIL'
 already exists in Schema 'APP'.
     [exec]     Got SQLException executing statement "CREATE TABLE PERSISTENCE_O
RDER_ORDER (ORDERID INTEGER NOT NULL, SHIPMENTINFO VARCHAR(255), STATUS CHAR(1),
 LASTUPDATE TIMESTAMP, DISCOUNT INTEGER, PRIMARY KEY (ORDERID))": java.sql.SQLEx
ception: Table/View 'PERSISTENCE_ORDER_ORDER' already exists in Schema 'APP'.
     [exec]     Got SQLException executing statement "CREATE TABLE PERSISTENCE_O
RDER_VENDOR_PART (VENDORPARTNUMBER BIGINT NOT NULL, PRICE FLOAT, DESCRIPTION VAR
CHAR(255), VENDORID INTEGER, PARTNUMBER VARCHAR(255), PARTREVISION INTEGER, PRIM
ARY KEY (VENDORPARTNUMBER))": java.sql.SQLException: Table/View 'PERSISTENCE_ORD
ER_VENDOR_PART' already exists in Schema 'APP'.
     [exec]     Got SQLException executing statement "CREATE TABLE PERSISTENCE_O
RDER_PART (REVISION INTEGER NOT NULL, PARTNUMBER VARCHAR(255) NOT NULL, DESCRIPT
ION VARCHAR(255), REVISIONDATE DATE, BOMPARTNUMBER VARCHAR(255), BOMREVISION INT
EGER, PRIMARY KEY (REVISION, PARTNUMBER))": java.sql.SQLException: Table/View 'P
ERSISTENCE_ORDER_PART' already exists in Schema 'APP'.
     [exec]     Got SQLException executing statement "CREATE TABLE PERSISTENCE_O
RDER_VENDOR (VENDORID INTEGER NOT NULL, PHONE VARCHAR(255), ADDRESS VARCHAR(255)
, VENDORNAME VARCHAR(255), CONTACT VARCHAR(255), PRIMARY KEY (VENDORID))": java.
sql.SQLException: Table/View 'PERSISTENCE_ORDER_VENDOR' already exists in Schema
 'APP'.
     [exec]     Got SQLException executing statement "CREATE TABLE PERSISTENCE_O
RDER_LINEITEM (ITEMID INTEGER NOT NULL, QUANTITY INTEGER, ORDERID INTEGER NOT NU
LL, VENDORPARTNUMBER BIGINT, PRIMARY KEY (ITEMID, ORDERID))": java.sql.SQLExcept
ion: Table/View 'PERSISTENCE_ORDER_LINEITEM' already exists in Schema 'APP'.
     [exec]     Got SQLException executing statement "ALTER TABLE PERSISTENCE_OR
DER_VENDOR_PART ADD CONSTRAINT PRSSTNCRDRVNDRPRT0 UNIQUE (PARTNUMBER, PARTREVISI
ON)": java.sql.SQLSyntaxErrorException: Constraints 'PRSSTNCRDRVNDRPRT0' and 'PR
SSTNCRDRVNDRPRT0' have the same set of columns, which is not allowed.
     [exec]     Got SQLException executing statement "ALTER TABLE PERSISTENCE_OR
DER_PART_DETAIL ADD CONSTRAINT PRSSTNCRDRPRTDRVSN FOREIGN KEY (REVISION, PARTNUM
BER) REFERENCES PERSISTENCE_ORDER_PART (REVISION, PARTNUMBER)": java.sql.SQLExce
ption: Constraint 'PRSSTNCRDRPRTDRVSN' already exists in Schema 'APP'.
     [exec]     Got SQLException executing statement "ALTER TABLE PERSISTENCE_OR
DER_VENDOR_PART ADD CONSTRAINT PRSSTNCRDRVNDVNDRD FOREIGN KEY (VENDORID) REFEREN
CES PERSISTENCE_ORDER_VENDOR (VENDORID)": java.sql.SQLException: Constraint 'PRS
STNCRDRVNDVNDRD' already exists in Schema 'APP'.
     [exec]     Got SQLException executing statement "ALTER TABLE PERSISTENCE_OR
DER_VENDOR_PART ADD CONSTRAINT PRSSTNCRDRVPRTRVSN FOREIGN KEY (PARTREVISION, PAR
TNUMBER) REFERENCES PERSISTENCE_ORDER_PART (REVISION, PARTNUMBER)": java.sql.SQL
Exception: Constraint 'PRSSTNCRDRVPRTRVSN' already exists in Schema 'APP'.
     [exec]     Got SQLException executing statement "ALTER TABLE PERSISTENCE_OR
DER_PART ADD CONSTRAINT PRSSTNCRDRPRBMRVSN FOREIGN KEY (BOMREVISION, BOMPARTNUMB
ER) REFERENCES PERSISTENCE_ORDER_PART (REVISION, PARTNUMBER)": java.sql.SQLExcep
tion: Constraint 'PRSSTNCRDRPRBMRVSN' already exists in Schema 'APP'.
     [exec]     Got SQLException executing statement "ALTER TABLE PERSISTENCE_OR
DER_LINEITEM ADD CONSTRAINT PRSSTNCRDRLNTMRDRD FOREIGN KEY (ORDERID) REFERENCES
PERSISTENCE_ORDER_ORDER (ORDERID)": java.sql.SQLException: Constraint 'PRSSTNCRD
RLNTMRDRD' already exists in Schema 'APP'.
     [exec]     Got SQLException executing statement "ALTER TABLE PERSISTENCE_OR
DER_LINEITEM ADD CONSTRAINT PRSSTNCVNDRPRTNMBR FOREIGN KEY (VENDORPARTNUMBER) RE
FERENCES PERSISTENCE_ORDER_VENDOR_PART (VENDORPARTNUMBER)": java.sql.SQLExceptio
n: Constraint 'PRSSTNCVNDRPRTNMBR' already exists in Schema 'APP'.
     [exec]     Got SQLException executing statement "CREATE TABLE PERSISTENCE_O
RDER_SEQUENCE_GENERATOR (GEN_KEY VARCHAR(50) NOT NULL, GEN_VALUE DECIMAL(15), PR
IMARY KEY (GEN_KEY))": java.sql.SQLException: Table/View 'PERSISTENCE_ORDER_SEQU
ENCE_GENERATOR' already exists in Schema 'APP'.
     [exec]     Got SQLException executing statement "INSERT INTO PERSISTENCE_OR
DER_SEQUENCE_GENERATOR(GEN_KEY, GEN_VALUE) values ('VENDOR_PART_ID', 0)": java.s
ql.SQLIntegrityConstraintViolationException: The statement was aborted because i
t would have caused a duplicate key value in a unique or primary key constraint
or unique index identified by 'SQL100731181038790' defined on 'PERSISTENCE_ORDER
_SEQUENCE_GENERATOR'.
     [exec]
     [exec]
     [exec] Command deploy failed.

BUILD FAILED
C:\glassfishv3\glassfish\docs\javaee-tutorial\examples\bp-project\app-server-ant
.xml:360: exec returned: 1

What is this?

0

It is always a good solution to google for the base exception message. Chances are that someone else has already encountered this error and found a solution for the same. Searching around, it seems that using Glassfish + Eclipse has some problems when it comes to dealing with object persistence when the entity class is updated. Are you using Glassfish with eclipse? If that blog post doesn't solve your issue, then read some other articles and see if that helps.

I appreciate your help.

0

It seems that your DB structure is already configured and the build script is seemingly executing the same thing again hence the exception. You have two options:
1. make sure the db structure is torn down after a single test run so that the configuration scripts which run again can start with a clean slate
2. make sure that the db configuration scripts are not fired if the db is already setup

0

Thanks again for your help. I did delete the tables

DROP TABLE PERSISTENCE_ORDER_PART_DETAIL;
DROP TABLE PERSISTENCE_ORDER_VENDOR_PART;
DROP TABLE PERSISTENCE_ORDER_LINEITEM;
DROP TABLE PERSISTENCE_ORDER_VENDOR cascade;
DROP TABLE PERSISTENCE_ORDER_SEQUENCE_GENERATOR;
DROP TABLE PERSISTENCE_ORDER_ORDER;
DROP TABLE PERSISTENCE_ORDER_VENDOR_PART cascade;
DROP TABLE PERSISTENCE_ORDER_PART;

But it solved some of the problems ie vendor_part, order etc. But for vendor table I am unable to find a solution:

delete-tables:
      [sql] Executing resource: C:\glassfishv3\glassfish\docs\javaee-tutorial\ex
amples\common\sql\javadb\delete.sql
      [sql] Failed to execute:  DROP TABLE PERSISTENCE_ORDER_PART_DETAIL
      [sql] java.sql.SQLSyntaxErrorException: 'DROP TABLE' cannot be performed o
n 'PERSISTENCE_ORDER_PART_DETAIL' because it does not exist.
      [sql] Failed to execute:  DROP TABLE PERSISTENCE_ORDER_VENDOR_PART
      [sql] java.sql.SQLSyntaxErrorException: 'DROP TABLE' cannot be performed o
n 'PERSISTENCE_ORDER_VENDOR_PART' because it does not exist.
      [sql] Failed to execute:  DROP TABLE PERSISTENCE_ORDER_LINEITEM
      [sql] java.sql.SQLSyntaxErrorException: 'DROP TABLE' cannot be performed o
n 'PERSISTENCE_ORDER_LINEITEM' because it does not exist.
      [sql] Failed to execute:  DROP TABLE PERSISTENCE_ORDER_VENDOR cascade
      [sql] java.sql.SQLSyntaxErrorException: Syntax error: Encountered "cascade
" at line 1, column 37.
      [sql] Failed to execute:  DROP TABLE PERSISTENCE_ORDER_SEQUENCE_GENERATOR
      [sql] java.sql.SQLSyntaxErrorException: 'DROP TABLE' cannot be performed o
n 'PERSISTENCE_ORDER_SEQUENCE_GENERATOR' because it does not exist.
      [sql] Failed to execute:  DROP TABLE PERSISTENCE_ORDER_ORDER
      [sql] java.sql.SQLSyntaxErrorException: 'DROP TABLE' cannot be performed o
n 'PERSISTENCE_ORDER_ORDER' because it does not exist.
      [sql] Failed to execute:  DROP TABLE PERSISTENCE_ORDER_VENDOR_PART cascade

      [sql] java.sql.SQLSyntaxErrorException: Syntax error: Encountered "cascade
" at line 1, column 42.
      [sql] Failed to execute:  DROP TABLE PERSISTENCE_ORDER_PART
      [sql] java.sql.SQLSyntaxErrorException: 'DROP TABLE' cannot be performed o
n 'PERSISTENCE_ORDER_PART' because it does not exist.
      [sql] 12 of 20 SQL statements executed successfully

deploy:
     [exec] Deprecated syntax, instead use:
     [exec] asadmin --port 4848 --host localhost deploy [options] ...
     [exec] com.sun.enterprise.admin.cli.CommandException: remote failure: Excep
tion while loading the app : javax.ejb.EJBException: javax.ejb.CreateException:
Initialization failed for Singleton ConfigBean
     [exec]
     [exec] Deployment encountered SQL Exceptions:
     [exec]     Got SQLException executing statement "CREATE TABLE PERSISTENCE_O
RDER_VENDOR (VENDORID INTEGER NOT NULL, PHONE VARCHAR(255), ADDRESS VARCHAR(255)
, VENDORNAME VARCHAR(255), CONTACT VARCHAR(255), PRIMARY KEY (VENDORID))": java.
sql.SQLException: Table/View 'PERSISTENCE_ORDER_VENDOR' already exists in Schema
 'APP'.
     [exec]
     [exec] Command deploy failed

.

Actually I tried different combinations like

drop table ...vendor cascade constraints;
alter table ...vendor drop constraint pss...;
drop table vendor;

But none of them worked. Now I have no idea what to do. Some help please.

0

The errors are exactly what they say;

java.sql.SQLSyntaxErrorException: Syntax error: Encountered "cascade

It has failed to recognize 'cascade' keyword and hence the error. Since an error was encountered, the deletion of VENDOR table could not be completed. Also make sure that you delete the dependent tables first and then the table which refers to the dependents.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.