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>



Reply via email to