users@glassfish.java.net

Why am i getting this error 'SHIPPING_REQUESTS' does NOT exist

From: <glassfish_at_javadesktop.org>
Date: Tue, 09 Sep 2008 14:47:56 PDT

Hi All,

I am trying to run the examples given in the EJB3 in Action book which can be downloaded from here http://manning.com/panda/codeexamples-javaeesdk.zip:

I am unable to create database tables using the given code:

First i run these commands in the command prompt:
asadmin
and then start-domain domain1
and the output is :
______________________________________________________________________
asadmin> start-domain domain1
Starting Domain domain1, please wait.
Log redirected to C:\Program Files\glassfish-v2ur1\domains\domain1\logs\server.l
og.
Redirecting output to C:/Program Files/glassfish-v2ur1/domains/domain1/logs/serv
er.log
Domain domain1 is ready to receive client requests. Additional services are bein
g started in background.
Domain [domain1] is running [Sun Java System Application Server 9.1_01 (build b0
9d-fcs)] with its configuration and logs at: [C:\Program Files\glassfish-v2ur1\d
omains].
Admin Console is available at [http://localhost:4848].
Use the same port [4848] for "asadmin" commands.
User web applications are available at these URLs:
[http://localhost:8080 https://localhost:8181 ].
Following web-contexts are available:
[/web1 /__wstx-services /servlet-stateless-war ].
Standard JMX Clients (like JConsole) can connect to JMXServiceURL:
[service:jmx:rmi:///jndi/rmi://ramesh-cfa05abd:8686/jmxrmi] for domain managemen
t purposes.
Domain listens on at least following ports for connections:
[8080 8181 4848 3700 3820 3920 8686 ].
Domain does not support application server clusters and other standalone instanc
es.
______________________________________________________________________
and then start-database
output for the above command is :
______________________________________________________________________
asadmin> start-database
Database started in Network Server mode on host 0.0.0.0 and port 1527.
--------- Derby Network Server Information --------
Version: CSS10020/10.2.2.1 - (538595) Build: 538595 DRDA Product Id: CSS10020
-- listing properties --
derby.drda.traceDirectory=C:\Program Files\glassfish-v2ur1\data...
derby.drda.maxThreads=0
derby.drda.keepAlive=true
derby.drda.minThreads=0
derby.drda.portNumber=1527
derby.drda.logConnections=false
derby.drda.timeSlice=0
derby.drda.startNetworkServer=false
derby.drda.host=0.0.0.0
derby.drda.traceAll=false
------------------ Java Information ------------------
Java Version: 1.5.0_13
Java Vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.5.0_13\jre
Java classpath: C:\Program Files\glassfish-v2ur1\lib\appserv-rt.jar;C:\Program
Files\glassfish-v2ur1\lib\admin-cli.jar;C:\Program Files\glassfish-v2ur1\javadb\
lib\derby.jar;C:\Program Files\glassfish-v2ur1\javadb\lib\derbytools.jar;C:\Prog
ram Files\glassfish-v2ur1\javadb\lib\derbynet.jar;C:\Program Files\glassfish-v2u
r1\javadb\lib\derbyclient.jar
OS name: Windows XP
OS architecture: x86
OS version: 5.1
Java user name: RAMESH
Java user home: C:\Documents and Settings\RAMESH
Java user dir: C:\Documents and Settings\RAMESH
java.specification.name: Java Platform API Specification
java.specification.version: 1.5
--------- Derby Information --------
JRE - JDBC: J2SE 5.0 - JDBC 3.0
[C:\Program Files\glassfish-v2ur1\javadb\lib\derby.jar] 10.2.2.1 - (538595)
[C:\Program Files\glassfish-v2ur1\javadb\lib\derbytools.jar] 10.2.2.1 - (538595)

[C:\Program Files\glassfish-v2ur1\javadb\lib\derbynet.jar] 10.2.2.1 - (538595)
[C:\Program Files\glassfish-v2ur1\javadb\lib\derbyclient.jar] 10.2.2.1 - (538595
)
------------------------------------------------------
----------------- Locale Information -----------------
Current Locale : [English/United States [en_US]]
Found support for locale: [cs]
         version: 10.2.2.1 - (538595)
Found support for locale: [de_DE]
         version: 10.2.2.1 - (538595)
Found support for locale: [es]
         version: 10.2.2.1 - (538595)
Found support for locale: [fr]
         version: 10.2.2.1 - (538595)
Found support for locale: [hu]
         version: 10.2.2.1 - (538595)
Found support for locale: [it]
         version: 10.2.2.1 - (538595)
Found support for locale: [ja_JP]
         version: 10.2.2.1 - (538595)
Found support for locale: [ko_KR]
         version: 10.2.2.1 - (538595)
Found support for locale: [pl]
         version: 10.2.2.1 - (538595)
Found support for locale: [pt_BR]
         version: 10.2.2.1 - (538595)
Found support for locale: [ru]
         version: 10.2.2.1 - (538595)
Found support for locale: [zh_CN]
         version: 10.2.2.1 - (538595)
Found support for locale: [zh_TW]
         version: 10.2.2.1 - (538595)
------------------------------------------------------

Starting database in the background.
Log redirected to C:\Program Files\glassfish-v2ur1\databases\derby.log.
Command start-database executed successfully.
______________________________________________________________________

and then i run the following ANT commands in the new command prompt
ant for the files build.xml and command.xml

these are the contents of build.xml(attached)


and this is the common.xml which is required by the build.xml


and i get the following output in command prompt:
______________________________________________________________________
C:\Documents and Settings\pandu1\Desktop\glassfish\glassfish>ant
Buildfile: build.xml

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

DropDerbyDataSource:
     [exec] Command delete-jdbc-resource executed successfully.
     [exec] Command delete-jdbc-resource executed successfully.

CreateDataSourceDerby:
     [exec] Command create-jdbc-resource executed successfully.
     [exec] Command create-jdbc-resource executed successfully.

DropJMSResource:
     [exec] Command delete-jms-resource executed successfully.
     [exec] Command delete-jms-resource executed successfully.
     [exec] Command delete-jms-resource executed successfully.

CreateJMSResource:
     [exec] Command create-jms-resource executed successfully.
     [exec] Command create-jms-resource executed successfully.
     [exec] Command create-jms-resource executed successfully.

all:

BUILD SUCCESSFUL
Total time: 25 seconds
______________________________________________________________________

and then i navigated to a specific chapter folder called as follows:

C:\Documents and Settings\RAMESH\Desktop\glassfish good\glassfish>cd chapter4

and then run the command ant for the build.xml which is available in the chapter4 folder and the contents of this file are:
________________________________________________________________________
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE project [
    <!ENTITY common SYSTEM "file:../common.xml">
]>


<project name="chapter4" default="all" basedir="." >

        <import file="../common.xml"/>


   
        
        
        <!-- ****************************************************************
         ** Creates deployable units for the **
         ** application. **
         ** ************************************************************* -->
    <target name="all" depends="package-app,deploy" description="Creates and deploys all deployable units for the application">
        <echo message="-----> Creates and deploys all deployable units for the application"/>
    </target>

        
        <target name="java-env-check" unless="env.JAVA_HOME">
        <fail message="JAVA_HOME environment variables must be set."/>
    </target>
        
    <!-- ******************************************************
         ** Initialize all properties relevant to the **
         ** execution of this how-to demonstration. **
         ** *************************************************** -->
    <target name="init" depends="common,java-env-check" >
        <echo message="-----> Initializing project properties" />
            

        <property name="app.name" value="chapter4" />
        <property name="ear.name" value="${app.name}" />
        <property name="ejb.name" value="${app.name}-ejb" />
        <property name="context.root" value="${app.name}" />
        <property name="cli.name" value="${app.name}-client" />
        
        <property name="src.dir" value="./src" />
        <property name="bld.dir" value="./build" />
        <property name="lib.dir" value="./lib" />
        <property name="etc.dir" value="./etc" />
        <property name="log.dir" value="./log" />

        

            <!-- EJB Application -->
        <property name="src.ejb.dir" value="${src.dir}/ejb/bean" />
        <property name="src.ejb.cli.dir" value="${src.dir}/ejb/client"/>
        <property name="bld.ejb.dir" value="${bld.dir}/${ejb.name}/bean" />
        <property name="bld.ejb.cli.dir" value="${bld.dir}/${ejb.name}/client" />

     
   
        <property name="bld.ear.dir" value="${bld.dir}/${ear.name}" />
              <property name="bld.cli.dir" value="${bld.dir}/client" />
        <property name="bld.compiler" value="classic" />
        <property name="class.files" value="**/*.class" />
        <property name="bak.files" value="**/*.bak" />

    </target>



    <!-- ******************************************************
         ** Removes the how-to build process artifacts **
         ** *************************************************** -->
    <target name="clean" depends="init" description="Removes the contents of the 'build', 'lib' and others files">
        <echo message="-----> Removing the contents of the ${bld.dir} and ${lib.dir} directories as well as other miscellaneous files used during the creation of the application"/>
        <delete dir="${bld.dir}"/>
        <delete dir="${lib.dir}"/>
        <delete dir="${log.dir}"/>
        <delete>
            <fileset dir="." includes="${bak.files}" defaultexcludes="no"/>
        </delete>
    </target>



    <!-- ****************************************************************
         ** Sets up required directories and configuration for how-to **
         ** ************************************************************* -->
    <target name="setup" depends="init">
       <echo message="-----> Creating the required sub-directories" />
        <mkdir dir="${lib.dir}" />
        <mkdir dir="${bld.dir}" />
        <mkdir dir="${log.dir}" />
        <mkdir dir="${bld.ear.dir}" />
        <mkdir dir="${bld.ear.dir}/META-INF" />
        <mkdir dir="${bld.ejb.dir}/META-INF" />
        <mkdir dir="${bld.ejb.cli.dir}/META-INF" />
    </target>






    <!-- ****************************************************************
         ** Package the EAR File **
         ** ************************************************************* -->
    <target name="build" depends="package-app" description="Package the application in a ear file">
        <echo message="Location of the ear file: ${lib.dir}/${app.name}.ear" />
    </target>

    <target name="package-app" depends="package-ejb,package-client">
     <copy todir="${bld.ear.dir}/META-INF">
                <fileset dir="${etc.dir}" includes="application.xml"/>
      </copy>

        <jar destfile="${bld.dir}/${app.name}.ear" >
            <fileset dir="${bld.ear.dir}" includes="*" />
        </jar>
        <copy file="${bld.dir}/${app.name}.ear" todir="${lib.dir}" />
    </target>




    
      
   

    <!-- EJB RELATED TARGET -->

    <!-- ****************************************************************
         ** Compile the EJB Classes **
         ** ************************************************************* -->
        <target name="compile-ejb-classes" depends="setup" >
        <echo message="-----> Compiling EJBs"/>
                <javac srcdir="${src.ejb.dir}"
                                destdir="${bld.ejb.dir}"
                                debug="on">
                        <classpath>
                                <pathelement path="${common.j2ee.class.path}" />
                    <pathelement location="${bld.ejb.dir}" />
                    <pathelement location="${lib.dir}/${ejb.name}.jar" />
                        </classpath>
                </javac>
        </target>
        

    <!-- ****************************************************************
         ** Add Descriptor **
         ** ************************************************************* -->
        <target name="ejb-descriptor" depends="setup">
                <copy todir="${bld.ejb.dir}/META-INF">
                        <fileset dir="${etc.dir}" includes="ejb-jar.xml, persistence.xml"/>
                </copy>
        </target>


        <!-- ****************************************************************
         ** Create EJB jar file **
         ** ************************************************************* -->
        <target name="package-ejb" depends="compile-ejb-classes,ejb-descriptor">
        <echo message="-----> Create EJB jar file"/>
                <jar jarfile="${bld.ear.dir}/${ejb.name}.jar">
                        <fileset dir="${bld.ejb.dir}" includes="**" />
                </jar>
        </target>

<!-- ****************************************************************
         ** Create Client jar file **
         ** ************************************************************* -->


<target name="package-client" depends="compile-cli-classes,cli-descriptor">
      <jar jarfile="${lib.dir}/${cli.name}.jar" manifest="${etc.dir}/Manifest.mf">
         <fileset dir="${bld.ejb.cli.dir}" includes="**" />
      </jar>
   </target>



   <target name="compile-cli-classes" depends="setup">
      <javac srcdir="${src.ejb.cli.dir}"
             destdir="${bld.ejb.cli.dir}"
             debug="on">
         <classpath>
            <pathelement path="${common.j2ee.class.path}" />
            <pathelement location="${bld.ejb.cli.dir}" />
            <pathelement location="${bld.ejb.dir}" />
         </classpath>
      </javac>
   </target>

   <target name="cli-descriptor" depends="setup">
      <copy todir="${bld.ejb.cli.dir}/META-INF">
         <fileset dir="${etc.dir}" includes="application-client.xml
                                          "
         />
      </copy>
      <copy todir="${bld.ejb.cli.dir}">
         <fileset dir="${etc.dir}" includes="jndi.properties" />
      </copy>
   </target>

<target name="undeploy"
          depends="init"
          unless="ee">
    <echo message="Undeploying ${app.name} example"
          level="verbose"></echo>
    <echo message="asadmin.bat undeploy --user ${admin.user} --password ${admin.password} --host ${admin.host} --port ${admin.port} chapter1"></echo>
    <exec executable="${J2EE_HOME}/bin/${ASADMIN}" failonerror="false">
      <arg line=" undeploy"/>
      <arg line="--user ${admin.user}"/>
      <arg line="--passwordfile ${PWD_FILE}"/>
      <arg line="--host ${admin.host}"/>
      <arg line="--port ${admin.port}"/>
       <arg line="chapter4"/>
    </exec>
  </target>

  
  <target name="deploy"
          depends="init"
          unless="ee">
    <echo message="Deploying ${app.name} example"
          level="verbose"></echo>
    <echo message="asadmin.bat deploy --user ${admin.user} --password ${admin.password} --host ${admin.host} --port ${admin.port} --upload=true lib/chapter4.ear"></echo>
    <exec executable="${J2EE_HOME}/bin/${ASADMIN}" failonerror="false">
      <arg line="deploy"/>
      <arg line="--user ${admin.user}"/>
     
      <arg line="--host ${admin.host}"/>
      <arg line="--port ${admin.port}"/>
      <arg line="--upload=true"/>
      <arg line="lib/chapter4.ear"/>
    </exec>
  </target>

  
  
  <target name="run"
          depends="init">
    <echo message="Executing client class using ${J2EE_HOME}/bin/${APPCLIENT} "></echo>
    <exec executable="${J2EE_HOME}/bin/${APPCLIENT}">
      <arg line="-client lib/chapter4-client.jar"/>
    </exec>
  </target>

</project>

________________________________________________________________________

output of the above command is:

______________________________________________________________________
C:\Documents and Settings\pandu\Desktop\glassfish good\glassfish\chapter4>ant
Buildfile: build.xml

common:
     [echo] BuildName: chapter4
     [echo] BuildHome: C:\Documents and Settings\pandu\Desktop\glassfish good\g
lassfish\chapter4
     [echo] BuildFile: C:\Documents and Settings\pandu\Desktop\glassfish good\g
lassfish\chapter4\build.xml
     [echo] BuildJVM: 1.5

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 localho
st --port 4848 --upload=true lib/chapter4.ear
     [exec] Command deploy executed successfully.

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

BUILD SUCCESSFUL
Total time: 17 seconds
______________________________________________________________________

and then i ran the application as follows:

C:\Documents and Settings\RAMESH\Desktop\glassfish good\glassfish\chapter4>ant r
un

output of the above command is:
______________________________________________________________________
C:\Documents and Settings\RAMESH\Desktop\glassfish good\glassfish\chapter4>ant r
un
Buildfile: build.xml

common:
     [echo] BuildName: chapter4
     [echo] BuildHome: C:\Documents and Settings\RAMESH\Desktop\glassfish good\g
lassfish\chapter4
     [echo] BuildFile: C:\Documents and Settings\RAMESH\Desktop\glassfish good\g
lassfish\chapter4\build.xml
     [echo] BuildJVM: 1.5

java-env-check:

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

run:
     [echo] Executing client class using C:\Program Files\glassfish-v2ur1/bin/ap
pclient.bat
     [exec] Shipping Request Message Sent ..

BUILD SUCCESSFUL
Total time: 18 seconds
______________________________________________________________________

but the server log of glassfish is like below:

_______________________________________________________________________
[#|2008-09-10T01:48:46.218+0530|WARNING|sun-appserver9.1|javax.enterprise.system.stream.err|_ThreadID=75;_ThreadName=p: thread-pool-1; w: 67;_RequestID=4a964f08-3b2c-4dc2-a576-a25b1b36a67b;|
java.sql.SQLException: Table/View 'SHIPPING_REQUESTS' does not exist.
        at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown Source)
        at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
        at org.apache.derby.client.am.Statement.execute(Unknown Source)
        at actionbazaar.buslogic.ShippingRequestProcessorMDB.processShippingRequest(ShippingRequestProcessorMDB.java:91)
        at actionbazaar.buslogic.ShippingRequestProcessorMDB.onMessage(ShippingRequestProcessorMDB.java:70)
        at sun.reflect.GeneratedMethodAccessor154.invoke(Unknown Source)
        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:1067)
        at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176)
        at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895)
        at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3986)
        at com.sun.ejb.containers.MessageBeanContainer.deliverMessage(MessageBeanContainer.java:1111)
        at com.sun.ejb.containers.MessageBeanListenerImpl.deliverMessage(MessageBeanListenerImpl.java:74)
        at com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:179)
        at $Proxy58.onMessage(Unknown Source)
        at com.sun.messaging.jms.ra.OnMessageRunner.run(OnMessageRunner.java:258)
        at com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:76)
        at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
Caused by: org.apache.derby.client.am.SqlException: Table/View 'SHIPPING_REQUESTS' does not exist.
        at org.apache.derby.client.am.Statement.completeSqlca(Unknown Source)
        at org.apache.derby.client.am.Statement.completeExecuteImmediate(Unknown Source)
        at org.apache.derby.client.net.NetStatementReply.parseEXCSQLIMMreply(Unknown Source)
        at org.apache.derby.client.net.NetStatementReply.readExecuteImmediate(Unknown Source)
        at org.apache.derby.client.net.StatementReply.readExecuteImmediate(Unknown Source)
        at org.apache.derby.client.net.NetStatement.readExecuteImmediate_(Unknown Source)
        at org.apache.derby.client.am.Statement.readExecuteImmediate(Unknown Source)
        at org.apache.derby.client.am.Statement.flowExecute(Unknown Source)
        at org.apache.derby.client.am.Statement.executeX(Unknown Source)
        ... 17 more
|#]
_______________________________________________________________________

why am i getting the above error:

and the sql file to create above table is:
_______________________________________________________________________
create table SHIPPING_REQUESTS(
ITEM_ID number(19),
SHIPPING_ADDRESS varchar2(255),
SHIPPING_METHOD varchar2(255),
INSURANCE_AMOUNT number(20,4))
/
_______________________________________________________________________

and the java source files of the chapter4 are:
ShippingRequestProcessorMDB.java

Guys,Please help me..Please help me..Please

Thanks
Pandu
[Message sent by forum member 'java_aspirant' (java_aspirant)]

http://forums.java.net/jive/thread.jspa?messageID=298171