Great work! I would like to suggest one more change to the
build-xdoclet.xml file:
There is no need to do the following in the "compile_beans" target:
<copy todir="${generated.ejb.classes.dir}/META-INF">
<fileset dir="${generated.descriptor.dir}" includes="**/*.xml"/>
<!-- fileset dir="${generated.base.dir}">
<include name="**/*.xml" />
<include name="**/*.properties" />
</fileset -->
</copy>
Instead, modify the "jar-beans" target to do the following:
<!--
=================================================================== -->
<!-- Build deployable jar of the generated
-->
<!--
=================================================================== -->
<target name="jar_beans" depends="compile_beans">
<jar jarfile="${jar.dir}/${jar.name}.jar"
basedir="${generated.ejb.classes.dir}" >
<metainf dir="${generated.descriptor.dir}">
<include name="**/*.xml" />
</metainf>
</jar>
</target>
I have attached the modified build-xdoclet.xml file.
----- Original Message -----
From: "Phil Warrick" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Thursday, October 31, 2002 12:59 PM
Subject: [j2ee deployment] my howto
> Phil Warrick wrote:
> > I'm getting close to finally getting the cvs head ejb examples to work
> > with a remote client (more on the pain involved with the
> > build-xdoclet.xml file and creating a client perhaps later).
>
> For anyone interested, I'll mention what I needed to do do get a remote
> client working with the sample ejb bean PBClient in jboss. Excuse me if
> some of this is obvious to some of you: it wasn't obvious to me :) Hope
> it fills in some gaps in the docs for somebody and helps the evolution
> of the build scripts.
>
> Configuration: Win2K, hsqldb, jBoss 3.0.3, ojb cvs head
>
> 1) Build source with
> bin\build jar
>
> 2) Build ejb beans with
> ant -buildfile build-xdoclet.xml
>
> As I mentioned in a previous email, this command gave me unresolved
> symbol messages during code generation of the following type:
>
> [ejbdoclet]
> C:\eclipse\workspace\jakarta-ojb_cvs\src\ejb\org\apache\ojb\ejb\Pers
> onArticleManagerODMGBean.java:122: cannot resolve symbol
> [ejbdoclet] symbol : class ArticleManagerODMGLocal
> [ejbdoclet] location: class
org.apache.ojb.ejb.PersonArticleManagerODMGBean
> [ejbdoclet] private ArticleManagerODMGLocal am;
>
> After looking at the xdoclet archives, these message are common for
> certain configurations, but they can be ignored because the code is
> getting generated. A look at the destination directory target/srcejb
> confirms this.
>
> A more serious problem is that the above errors prevent target
> compile_beans from starting. So I removed the xdoclet dependency from
> that target and ran it explicitly:
>
> ant -buildfile build-xdoclet.xml compile_beans
>
> This wouldn't compile unless the dist jars were on the class path, so I
> added that to path id ojb.classpath (although I don't know why
> build.dest and build.desttest aren't enough):
>
> <path id="ojb.classpath">
> <pathelement path="${build.dest}"/>
> <pathelement path="${build.desttest}"/>
> <fileset dir="${lib}">
> <include name="**/*.jar"/>
> <include name="**/*.zip"/>
> </fileset>
> <!-- added this fileset-->
> <fileset dir="${dist}">
> <include name="**/*.jar"/>
> <include name="**/*.zip"/>
> </fileset>
> </path>
>
> This created target\srcejb\ojb_beans.jar (maybe should be put in a
> different directory like dist?)
>
> 3) Build the ejb clients:
> Added a target to build-xdoclet.xml
>
> <target name="jar_clients" depends="compile_beans_and_clients">
> <jar jarfile="${jar.dir}/${clientjar.name}.jar"
> basedir="${generated.ejb.classes.dir}"
> excludes="**/*Bean.class,
> **/*BO.class,
> **/*BeanImpl.class,
> **/*.xml,
> **/*.properties" />
> </target>
>
> to create ojb_beans_clients.jar with the required client classes and
> configuration files META-INF\jboss.xml and META-INF\ejb-jar.xml
>
> 4) Deploy jakarta-ojb.sar to jboss
> I modified slightly the sar file that Mickey posted in a previous email:
>
> a) added all the latest lib\*.jar files excluding hsqldb.jar since jboss
> has this already
>
> b) ensured that the following OJB.properties were set
> ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFacto
> ryPassThroughImpl
> useAutoCommit=0
> OJBTxManagerClass=org.apache.ojb.odmg.JTATxManager
> JTATransactionManagerClass=org.apache.ojb.otm.transaction.factory.JBossT
> ransactionManagerFactory
>
> PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.Persiste
> ntFieldPropertyImpl
> (Note the change in path in last setting since last release)
>
> Deployed this file to ...\jboss-3.0.3\server\default\deploy\ojb
>
> c) in repository.xml set the jdbc conn descriptor to hsqldb settings
> required for use in jboss:
>
> <jdbc-connection-descriptor
> platform="Hsqldb"
> jdbc-level="2.0"
> jndi-datasource-name="java:DefaultDS"
> username="sa"
> password=""
> eager-release="true"
> />
>
>
> 5) Deploy ojb_beans.jar file to jboss
> in the directory ...\jboss-3.0.3\server\default\deploy\ojb
>
> Note that simply putting these two jar files in
> ...\jboss-3.0.3\server\default
> caused deploy order problems for me although others do not report this
> problem
>
>
> 6) Deploy ojb test hsqldb database to jboss
> After creating the database with
> bin\build prepare-testdb
>
> Take the generated OJB.script file from .../target/test
> and rename the file to default.script.
> Replace the jboss default.script file in
> ...\jboss-3.0.3\server\default\db\hypersonic
> with this file.
>
> 7) Run jboss
>
> 8) Run client org.apache.ojb.ejb.AllTests
> Numerous jars are required for the client. I modified build.bat
> to set this up properly and called it ".\runEJBClient.bat"
>
> @echo off
> REM Please let JAVA_HOME point to your JDK base directory
> if "%JAVA_HOME%" == "" set JAVA_HOME=C:\j2sdk1.4.0
> set JAVA=%JAVA_HOME%\bin\java
> set JBOSS_HOME=C:\jboss\jboss-3.0.3
> set cp=
> for %%i in (%JBOSS_HOME%\client\*.jar) do call bin\cp.bat %%i
> for %%i in (dist\*.jar) do call bin\cp.bat %%i
> for %%i in (lib\*.jar) do call bin\cp.bat %%i
> "%JAVA%" -classpath "target\srcejb\ojb-beans-clients.jar;%CP%"
> org.apache.ojb.ejb.AllTests
>
> That's it.
>
> Phil
>
>
> --
> To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>
<?xml version="1.0" encoding="UTF-8"?>
<!-- OJB ant build script for xdoclet use -->
<project name="OJB XDoclet" default="jar_beans" basedir=".">
<!-- Allow any user specific values to override the defaults -->
<property file="build.properties"/>
<property file="${user.home}/build.properties" />
<property name="java.src.dir" value="${src.dir}/ejb"/>
<property name="generated.src.dir" value="${build.dir}/srcejb"/>
<property name="generated.descriptor.dir" value="${build.dir}/srcejb"/>
<property name="generated.ejb.classes.dir" value="${build.dir}/classesejb"/>
<property name="jar.name" value="ojb-beans"/>
<property name="jar.dir" value="${build.dir}/srcejb"/>
<path id="ojb.classpath">
<pathelement path="${build.dest}"/>
<pathelement path="${build.desttest}"/>
<fileset dir="${lib}">
<include name="**/*.jar"/>
<include name="**/*.zip"/>
</fileset>
</path>
<!-- =================================================================== -->
<!-- run xdoclet -->
<!-- =================================================================== -->
<target name="xdoclet" depends="">
<taskdef
name="ejbdoclet"
classname="xdoclet.ejb.EjbDocletTask">
<classpath refid="ojb.classpath"/>
</taskdef>
<delete dir="${generated.src.dir}"/>
<mkdir dir="${generated.src.dir}"/>
<ejbdoclet
sourcepath="${java.src.dir}"
destdir="${generated.src.dir}"
classpathref="ojb.classpath"
excludedtags="@version,@author"
ejbspec="2.0">
<fileset dir="${java.src.dir}">
<include name="**/*Bean.java" />
<include name="**/*BeanImpl.java" />
<include name="**/*BO.java" />
</fileset>
<!-- session/-->
<!-- dataobject/ -->
<remoteinterface/>
<localinterface/>
<homeinterface/>
<localhomeinterface/>
<!-- entitycmp pattern="{0}BeanImpl"/ -->
<deploymentdescriptor destdir="${generated.descriptor.dir}"/>
<jboss version="3.0"
xmlencoding="UTF-8"
typemapping="Hypersonic SQL"
datasource="java:/DefaultDS"
destdir="${generated.descriptor.dir}"/>
<!-- weblogic xmlencoding="UTF-8" destdir="${build.dir}/ejb/META-INF" validatexml="true"/ -->
<!--
<webSphere destdir="${build.dir}/ejb/META-INF" />
<orion/>
-->
<!-- apachesoap destdir="${build.dir}/web" / -->
<!--
Have struts form objects generated based on entity beans'
data objects. Will require struts.jar to compile.
<strutsform />
-->
</ejbdoclet>
</target>
<!-- =================================================================== -->
<!-- Compiles the source directory and copy all xml -->
<!-- files in src to classes.dir -->
<!-- =================================================================== -->
<target name="compile_beans" depends="xdoclet">
<delete dir="${generated.ejb.classes.dir}"/>
<mkdir dir="${generated.ejb.classes.dir}"/>
<mkdir dir="${generated.ejb.classes.dir}/META-INF"/>
<copy todir="${generated.src.dir}">
<fileset dir="${java.src.dir}">
<include name="**/*Bean.java" />
<include name="**/*BeanImpl.java" />
<include name="**/*BO.java" />
</fileset>
</copy>
<javac srcdir="${generated.src.dir}"
destdir="${generated.ejb.classes.dir}"
debug="${debug}"
optimize="${optimize}"
deprecation="${deprecation}">
<classpath refid="ojb.classpath"/>
</javac>
<delete>
<fileset dir="${generated.src.dir}">
<include name="**/*Bean.java" />
<include name="**/*BO.java" />
<include name="**/*BeanImpl.java" />
</fileset>
</delete>
</target>
<!-- =================================================================== -->
<!-- Build deployable jar of the generated files -->
<!-- =================================================================== -->
<target name="jar_beans" depends="compile_beans">
<jar jarfile="${jar.dir}/${jar.name}.jar"
basedir="${generated.ejb.classes.dir}" >
<metainf dir="${generated.descriptor.dir}">
<include name="**/*.xml" />
</metainf>
</jar>
</target>
</project>
--
To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>