---------- Forwarded message ----------
Date: Tue, 13 Apr 2004 01:39:08 -0500
From: Don Vines <[EMAIL PROTECTED]>
To: Bruce Snyder <[EMAIL PROTECTED]>
Subject: RE: [castor-dev] JBOSS 3.2 ** please dis-regard previous email **
    review this one instead ** thanks.


Bruce,

The email to castor-dev bounced because I am not subscribed
to that maillist so perhaps you may want to post this email.

Please note: I forgot 2 of the steps in the first email I sent
to you so please post this emil to the castor-dev maillist not
the previous one.

Thanks,

-- Don

-----Original Message-----
From: Don Vines [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 13, 2004 1:24 AM
To: Bruce Snyder
Cc: castor-dev
Subject: RE: [castor-dev] JBOSS 3.2



Bruce,

Appreciate your help.  First let me answer your questions at
the bottom and then give you a summary of how I've been able
to integrate JBoss 3.2.2 with Catror 0.9.4.3.

Assembly and deployment:

Regarding the JARs - this is an existing application; I'm
just migrating it from JBoss 2.4.x to JBoss 3.2.x wihtout
trying to change too much of their code, directories, etc.

I certainly agree with the desire to have a self contained
EAR.  Unfortunately, they did not build or deploy the app.
in that way.

Here's how the J2EE application is assembled:

1. There is a single EAR.  Inside that ear there is an
   application.xml file that specifies a war and a jar.
   In addition to the WAR and JAR (for EJBs) there's
   5 additional JARs used by an applet.

2. The WAR does have a web-inf/classes and a web-inf/lib.

3. The JARs have classes, images, etc.

4. The J2EE application also places 25 JARs into the
   server/default/lib directroy; none of which are
   contained inthe EAR.

Any suggested re-factorings would be appreciated although,
I believe that I have worked out most if not all of the
class loader issues by now.

JBoss-Castor Integration

Now with that background, for what you really care about I
presume and that the integration of JBoss 3.2.2 with Castor
0.4.9.3.  Here's a summary of what I did, you can also see
al the files in the attached zip which is an Eclipse project.

1. ftp://ftp.castor.org/pub/castor/castor_0.9.4.2/castor-0.9.4.2.jar
   from the exolab web site and place it in the server/default/lib
   directory.

2. Added the following mbean to the user-services.xml file:

  <mbean code="org.jboss.jdo.castor.CastorJDOImpl"
name="Saltare:service=CastorJDO,name=castor">
    <attribute name="Configuration">../conf/default/database.xml</attribute>
    <attribute name="JndiName">jdo/castor</attribute>
    <!-- needs to be the same as TransactionTimeout for JBoss above -->
    <attribute name="LockTimeout">120</attribute>
    <attribute name="LoggingEnabled">true</attribute>
    <attribute name="CommonClassPath">false</attribute>
    <attribute name="AutoStore">false</attribute>
    <attribute name="DatabasePooling">true</attribute>
   </mbean>

3. Go to http://cvs.sourceforge.net/viewcvs.py/jboss/contrib/castorjdo/
   and get a copy of the CastorJDOImpl.java file -- its the one with the
   label rollback-to-3-2

4. Wrote a build script to generate the CastorJDOImplMBean.java file,
   compile both the java files, assemble the Jar file and copy it to
   server/default/lib.

Note: perhaps the build script has an error in it (I don't know for sure)
because after generating the MBean I had to make a couple of source code
changes to get it to compile with JBoss 3.2.x.  I've attached the source
for the MBean so you don't have to make these changes.

Again, any comments would be appreciated.

-- Don


-----Original Message-----
From: Bruce Snyder [mailto:[EMAIL PROTECTED]
Sent: Sunday, April 11, 2004 10:08 AM
To: Don Vines
Cc: castor-dev
Subject: RE: [castor-dev] JBOSS 3.2


This one time, at band camp, Don Vines said:

DV>Here's some additional information that may help.
DV>
DV>1.  I have attached the complete stack trace following my signature.
DV>    Basically, it says that the CastorJDOImpl class can't be found.
DV>
DV>2.  I have attached the jboss-castorjdo.jar file which is in the
DV>    server\default\lib and that contains CastorJDOImpl class that
DV>    can't be found.
DV>
DV>    Note: castor-0.9.4.3.jar is also in the server\default\lib directory.
DV>
DV>3.  I have attached the user-services.xml file which is where
DV>    the CastorJDO service is being registered as an MBean.
DV>
DV>4.  I'm using the JBoss3.2.2 - Tomcat 4.1.27 bundle.
DV>
DV>Thanks again for your help,
DV>
DV>-- Don
DV>
DV>20:25:49,915 WARN  [ServiceConfigurator] Failed to complete install
DV>java.lang.ClassNotFoundException: Unexpected error during load of:
DV>org.jboss.jdo.castor.CastorJDOImp
DV>l, msg=org/jboss/util/ServiceMBeanSupport
DV>        at
DV>org.jboss.mx.loading.UnifiedClassLoader3.loadClassImpl(UnifiedClassLoader
3.j
DV>ava:218)
DV>        at
DV>org.jboss.mx.loading.UnifiedClassLoader3.loadClass(UnifiedClassLoader3.ja
va:
DV>123)
DV>        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
DV>        at
DV>org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:819)
DV>        at
DV>org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:291)
DV>        at
DV>org.jboss.mx.server.MBeanServerImpl.createMBean(MBeanServerImpl.java:318)
DV>        at
org.jboss.system.ServiceCreator.install(ServiceCreator.java:98)
DV>        at
DV>org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.
jav
DV>a:155)
DV>        at
DV>org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:118
)
DV>        at
DV>org.jboss.system.ServiceController.install(ServiceController.java:225)
DV>        at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
DV>        at
DV>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI
mpl
DV>..java:25)
DV>        at java.lang.reflect.Method.invoke(Method.java:324)
DV>        at
DV>org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDis
pat
DV>cher.java:284
DV>)
DV>        at
DV>org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
DV>        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
DV>        at $Proxy4.install(Unknown Source)
DV>        at org.jboss.deployment.SARDeployer.create(SARDeployer.java:183)
DV>        at
org.jboss.deployment.MainDeployer.create(MainDeployer.java:786)
DV>        at
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:641)
DV>        at
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
DV>        at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
DV>        at
DV>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI
mpl
DV>..java:25)
DV>        at java.lang.reflect.Method.invoke(Method.java:324)
DV>        at
DV>org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDis
pat
DV>cher.java:284
DV>)
DV>        at
DV>org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
DV>        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
DV>        at $Proxy6.deploy(Unknown Source)
DV>        at
DV>org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentSca
nne
DV>r.java:302)
DV>        at
DV>org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScann
er.
DV>java:476)
DV>        at
DV>org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doSc
an(
DV>AbstractDeplo
DV>ymentScanner.java:201)
DV>        at
DV>org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(Abstr
act
DV>DeploymentSca
DV>nner.java:274)
DV>        at
DV>org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
DV>        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
DV>        at
DV>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI
mpl
DV>..java:25)
DV>        at java.lang.reflect.Method.invoke(Method.java:324)
DV>        at
DV>org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDis
pat
DV>cher.java:284
DV>)
DV>        at
DV>org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
DV>        at
DV>org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.
jav
DV>a:976)
DV>        at $Proxy0.start(Unknown Source)
DV>        at
DV>org.jboss.system.ServiceController.start(ServiceController.java:394)
DV>        at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
DV>        at
DV>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI
mpl
DV>..java:25)
DV>        at java.lang.reflect.Method.invoke(Method.java:324)
DV>        at
DV>org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDis
pat
DV>cher.java:284
DV>)
DV>        at
DV>org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
DV>        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
DV>        at $Proxy4.start(Unknown Source)
DV>        at org.jboss.deployment.SARDeployer.start(SARDeployer.java:226)
DV>        at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
DV>        at
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642)
DV>        at
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
DV>        at
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:589)
DV>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
DV>        at
DV>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java
:39
DV>)
DV>        at
DV>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI
mpl
DV>..java:25)
DV>        at java.lang.reflect.Method.invoke(Method.java:324)
DV>        at
DV>org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDis
pat
DV>cher.java:284
DV>)
DV>        at
DV>org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
DV>        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
DV>        at $Proxy5.deploy(Unknown Source)
DV>        at
org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:384)
DV>        at org.jboss.system.server.ServerImpl.start(ServerImpl.java:291)
DV>        at org.jboss.Main.boot(Main.java:150)
DV>        at org.jboss.Main$1.run(Main.java:395)
DV>        at java.lang.Thread.run(Thread.java:534)

I figured that the error would be with a ClassLoader, but I wasn't
sure which one. The fact that you're placing these jars in the
server/default/lib dir likely the issue here. The appropriate method
for using jars within a J2EE container (and even a web container)
is to place them within either the ear file (or the war file). The
reason for doing so is due to each application having it's own
context. Depending upon the level of isolation built into the
context, you may not have access to a jar from within an application
or vice versa - the app server's boot ClassLoader may not have
access to a jar if it's not in the correct location. So now I'm
curious to know how you're constructing your application and deploying
it in JBoss. Is it an ear or a war? Are you placing your other jars
within the WEB-INF/lib dir within the ear or war? Etc.

For the benefit of the entire Castor community, I'm also CC'ing the
castor-dev mailing list with this response. What's more, Patrick
may have some input here as his experience with the integration of
Castor and JBoss is more up to date than mine.

Bruce
--
perl -e 'print
unpack("u30","<0G)[EMAIL PROTECTED]&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'

The Castor Project
http://www.castor.org/

Apache Geronimo
http://incubator.apache.org/projects/geronimo.html

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to