Hi Armin,

Please find below "howto" to deploy ojb as an ear file.

Here is an example of the .ear package structure. It is redeployable
without having to restart Jboss. 

/ejb.jar/
...EJBs
...META-INF/
......ejb-jar.xml
......jboss.xml
......MANIFEST.MF 

/web-app.war/
...JSP
...WEB-INF/
......web.xml

/META-INF/
...application.xml
/ojb.jar
/[ojb required runtime jar] 

/OJB.properties
/repository.dtd
/respository_internal.xml
/repository.xml
/repository_database1.xml
/repository_app1.xml
/repository_database2.xml
/repository_app2.xml


There are two approaches to use OJB api in the ejb.jar file.

1. To create a Manifest.mf file with classpath attribute that include
all the runtime jar required by OJB (Very important to include all
required jar). The sample below works fine. 

Class-Path: db-ojb-1.0.rc6.jar antlr-2.7.3.jar commons-beanutils.jar
commons-collections.jar commons-dbcp-1.1.jar commons-lang-2.0.jar
commons-logging.jar commons-pool-1.1.jar 
jakarta-regexp-1.3.jar

Note: If you to include the jar file under a directory of the ear file,
says /lib/db-ojb-1.0.rc6.jar and etc. At the classpath attribute it will
be something like; 

Class-Path: ./lib/db-ojb-1.0.rc6.jar and etc (The "." in front is
important)

2. To add the required jar file as a "java" element in the
application.xml file. 

        <module>
                <java>antlr-2.7.3.jar</java>
        </module>
        <module>
                <java>commons-beanutils.jar</java>
        </module>
        <module>
                <java>commons-collections.jar</java>
        </module>
        <module>
                <java>commons-dbcp-1.1.jar</java>
        </module>
        <module>
                <java>commons-lang-2.0.jar</java>
        </module>
        <module>
                <java>commons-logging.jar</java>
        </module>
        <module>
                <java>commons-pool-1.1.jar</java>
        </module>
        <module>
                <java>db-ojb-1.0.rc6.jar</java>
        </module>

Note: To use this approach, all the library had to be in the root of the
ear. 


(This was tested on Jboss 3.2.3)


Regards,
Stephen


>-----Original Message-----
>From: Armin Waibel [mailto:[EMAIL PROTECTED] 
>Sent: 22 April 2004 14:46
>To: OJB Users List
>Subject: Re: deploying OJB in Jboss
>
>
>Hi Stephen,
>
>Stephen Ting wrote:
>> Hi Armin,
>> 
>> Thanks for your help + suggestion. I had successfully package 
>> everything in an ear file and it is redeployable.
>
>Congratulation! This isn't everybody's job ;-)
>
>> So nice. Actually, there is not
>> much changes to what was suggested in the ojb deployment doc.
>> 
>
>Stephen it would be really great if you could write a "howto" 
>about your 
>experience with OJB .ear packing (no big thing, only a few 
>lines in your 
>on words how you get it work) to integate it in "deployment" page.
>
>regards,
>Armin
>
>> I had successfully uses 2 methods to get it work on Jboss 3.2.3.
>> 
>> 1. To include ALL jar file required by OJB during runtime in the 
>> classpath of the manifest file.
>> 
>> Class-Path: db-ojb-1.0.rc6.jar antlr-2.7.3.jar 
>commons-beanutils.jar c  
>> ommons-collections.jar commons-dbcp-1.1.jar 
>commons-lang-2.0.jar comm  
>> ons-logging.jar commons-pool-1.1.jar jakarta-regexp-1.3.jar
>> 
>> ***The carriage return at the end of the classpath is not required.
>> 
>> 2. The second approach is to add the required jar file as a "java" 
>> element in the application.xml file. To use this method, all the 
>> library had to be in right at the root of the ear.
>> 
>> <module>
>> <java>db-ojb-1.0.rc6.jar</java>
>> </module>
>> 
>> ...etc
>> 
>> NOTE: If only include ojb jar file in the classpath it won't work.
>> 
>> Regards,
>> Stephen
>>  
>> 
>> 
>>>-----Original Message-----
>>>From: Armin Waibel [mailto:[EMAIL PROTECTED]
>>>Sent: 21 April 2004 15:48
>>>To: OJB Users List
>>>Subject: Re: deploying OJB in Jboss
>>>
>>>
>>>Hi Stephen,
>>>
>>>now I'm be stumped, your structure looks fine to me. Did you set a
>>>carriage return at the end of each Class-Path line?
>>>hmm ...try to post your problem at the jboss list and let these guys 
>>>solve your problem;-).
>>>Sorry I can't help more.
>>>Please keep me up-to-date (seems to me very important for 
>other user).
>>>
>>>regards,
>>>Armin
>>>
>>>Stephen Ting wrote:
>>>
>>>>Hi Armin,
>>>>
>>>>I am trying to deploy an ear file with the following structure, but
>>>>failed
>>>>
>>>>/ejb1.jar/
>>>>...EJBs
>>>>...META-INF/
>>>>......ejb-jar.xml
>>>>......jboss.xml
>>>>......MANIFEST.MF [Class-Path: ./lib/ojb.jar]   
>>>>
>>>>/ejb2.jar/
>>>>...EJBs
>>>>...META-INF/
>>>>......ejb-jar.xml
>>>>......jboss.xml
>>>>......MANIFEST.MF [Class-Path: ./lib/ojb.jar]   
>>>>
>>>>/web-app.war/
>>>>...JSP
>>>>...WEB-INF/
>>>>......web.xml [ejb-refs to EJBs]
>>>>
>>>>/META-INF/
>>>>...application.xml
>>>>/lib/ojb.jar
>>>>/lib/ojb related jar
>>>>
>>>>/OJB.properties
>>>>/repository.xml
>>>>/repository_database1.xml
>>>>/repository_sys1.xml
>>>>/repository_database2.xml
>>>>/repository_sys2.xml
>>>>
>>>>It doesn't work, everytime getting this exception
>>>>
>>>>2004-04-21 11:13:02,626 INFO
>>>
>>>[org.jboss.deployment.EARDeployer] Init
>>>
>>>>J2EE application:
>>>>file:/G:/jboss/jboss-3.2.3-n/server/default/deploy/eplyPortal.ear
>>>>2004-04-21 11:13:03,970 WARN  [org.jboss.ejb.EJBDeployer] Verify 
>>>>failed; continuing
>>>>java.lang.NoClassDefFoundError: 
>>>>org/apache/ojb/broker/PersistenceBrokerException
>>>>    at java.lang.Class.getDeclaredMethods0(Native Method)
>>>>    at java.lang.Class.privateGetDeclaredMethods(Class.java:1647)
>>>>    at java.lang.Class.privateGetPublicMethods(Class.java:1770)
>>>>    at java.lang.Class.getMethods(Class.java:824)
>>>>
>>>>Whereas if I access OJB through JNDI, I have no problems.
>>>>
>>>>Please help
>>>>
>>>>Thanks
>>>>
>>>>Regards,
>>>>Stephen
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>-----Original Message-----
>>>>>From: Armin Waibel [mailto:[EMAIL PROTECTED]
>>>>>Sent: 19 April 2004 15:02
>>>>>To: OJB Users List
>>>>>Subject: Re: deploying OJB in Jboss
>>>>>
>>>>>
>>>>>Hi Stephen,
>>>>>
>>>>>Stephen Ting wrote:
>>>>>
>>>>>
>>>>>
>>>>>>Hi Armin,
>>>>>>
>>>>>>If I were to have multiple ejb.jar that have it owns
>>>>>
>>>>>repository (class
>>>>>
>>>>>
>>>>>>descriptor, jdbc-connection-descriptor). OJB will only found
>>>>>
>>>>>the jdbc
>>>>>
>>>>>
>>>>>>connection descriptor of the ejb.jar that is firstly
>>>>>
>>>>>deployed. What is
>>>>>
>>>>>
>>>>>>the correct strategy for deployment of multiple ejb.jar 
>with it own 
>>>>>>bundle of OJB.jar in a same JVM?
>>>>>>
>>>>>
>>>>>hmm, each .ear file is separate application and should 
>have its own 
>>>>>classloader. Thus if you include all ojb jars + jars OJB 
>depends and 
>>>>>the config files in each .ear file you can use different .ear
>>>
>>>applications
>>>
>>>>>with different config files.
>>>>>But I think it is not possible to use different OJB config
>>>>>files in the 
>>>>>same .ear file (same application), because all ejb.jar 
>files use the 
>>>>>same classloader.
>>>>>If you have multiple ejb.jar files in one .ear file, each 
>>>
>>>ejb.jar file
>>>
>>>>>will find the same config-files (first found by classloader).
>>>>>
>>>>>Why do you need this - can you explain?
>>>>>
>>>>>regards,
>>>>>Armin
>>>>>
>>>>>
>>>>>
>>>>>>Thanks
>>>>>>Regards,
>>>>>>Stephen
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>-----Original Message-----
>>>>>>>From: Armin Waibel [mailto:[EMAIL PROTECTED]
>>>>>>>Sent: 18 April 2004 01:59
>>>>>>>To: OJB Users List
>>>>>>>Subject: Re: deploying OJB in Jboss
>>>>>>>
>>>>>>>
>>>>>>>Hi Stephen,
>>>>>>>
>>>>>>>Stephen Ting wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>I had followed the following ear template suggested by OJB
>>>>>>>
>>>>>>>deployment
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>tutorial.  But still during deployment time of my EAR. Jboss
>>>>>>>
>>>>>>>complain
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>cann't find OJB api. Whereas if i include the lib in the
>>>>>>>
>>>>>>>ejb.jar file,
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>it will deploy successfully without any problems.
>>>>>>>
>>>>>>>Sorry I never tried this, the description showed in the 
>deployment
>>>>>>>file based on this post
>>>>>>>
>>>>>>>http://www.mail-archive.com/[EMAIL PROTECTED]/msg08471.html
>>>>>>>
>>>>>>>of successfully deployment.
>>>>>>>
>>>>>>>regards,
>>>>>>>Armin
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>I was not able to do
>>>>>>>>this, because i had more than one archive of my session bean,
>>>>>>>>therefore, i needs all the session in different archive to
>>>>>>>
>>>>>>>see the OJB
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>api in the EAR file.
>>>>>>>>
>>>>>>>>Can someone please help? Please also find attached my
>>>
>>>manifest.mf..
>>>
>>>>>>>>/ejb.jar/
>>>>>>>>...EJBs
>>>>>>>>...DAOs
>>>>>>>>...META-INF/
>>>>>>>>......ejb-jar.xml
>>>>>>>>......jboss.xml
>>>>>>>>......MANIFEST.MF [Class-Path: /lib/ojb.jar<CRLF>]   <--- 
>>>>>>>
>>>>>>>VERY IMPORTANT
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>/lib/
>>>>>>>>...ojb.jar
>>>>>>>>
>>>>>>>>/web-app.war/
>>>>>>>>...JSP
>>>>>>>>...WEB-INF/
>>>>>>>>......web.xml [ejb-refs to EJBs]
>>>>>>>>
>>>>>>>>/META-INF/
>>>>>>>>...application.xml
>>>>>>>>
>>>>>>>>/OJB.properties
>>>>>>>>/repository.xml
>>>>>>>>/repository_database.xml
>>>>>>>>/repository_user.xml
>>>>>>>>
>>>>>>>>
>>>>>>>>This is the content of my manifest.mf file
>>>>>>>>
>>>>>>>>Manifest-Version: 1.0
>>>>>>>>
>>>>>>>>Ant-Version: Apache Ant 1.6.1
>>>>>>>>
>>>>>>>>Created-By: 1.4.2-b28 (Sun Microsystems Inc.)
>>>>>>>>
>>>>>>>>Name: main
>>>>>>>>
>>>>>>>>Class-Path: /lib/ojb.jar
>>>>>>>>
>>>>>>>>Thanks.
>>>>>>>>
>>>>>>>>Regards,
>>>>>>>>
>>>>>>>>Stephen Ting
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>-----------------------------------------------------------
>>>
>>>---------
>>>
>>>>>>>-
>>>>>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>------------------------------------------------------------
>>>
>>>---------
>>>
>>>>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>-----------------------------------------------------------
>---------
>>>>>-
>>>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>------------------------------------------------------------
>---------
>>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to