5 Replies Latest reply on May 12, 2004 5:57 AM by Bruce Scharlau

    Using Torque and JBoss

    jexenberger Newbie


      Has anyone ever managed to get Apache Torque to work using JBoss, I have tried but it keeps complaining it can't find one of my Torque generated classes

        • 1. Re: Using Torque and JBoss
          lpmon Novice


          The class loader cannot find 'Torque' class or any other classes in the torque related jars.

          I have beat on this a while with no success. I have to admit all of this is new to me. However, I got Velocity working with JBoss fairly easily. But, Velocity is accessed at a different point (template in a page) and I am trying to use torque inside the servlet code.

          My question: If I put the velocity .jar files into the war and JBoss found them why can't I put the torque jars in the same place and they be found?

          My experiment:

          - Added the torque jars at into the war file (WEB-INF/lib same place as a bunch of other apache jars including velocity)
          - Modified the Dispatcher.java in JBoss test app (Dukes Bank) to use Torque.

          I get class not found exception. I tried adding the jars to the class-path in the manifest with no luck.


          • 2. Re: Using Torque and JBoss
            Juha Lindfors Master

            Does Torque generate classes at runtime?

            • 3. Re: Using Torque and JBoss
              lpmon Novice

              I am new to Torque but I do have an answer to this.

              One uses the Torque generator to create classes. Then these classes are added to a web app along with some Torque runtime classes. My problem is JBoss cannot find the classes for the Torque runtime. I set things up as described in my earlier post.

              I just tried setting the JBoss startup classpath to include the Torque jars. (I changed run.bat). JBoss still cannot find the classes.

              • 4. Re: CLASSPATH...  Using Torque and JBoss
                lpmon Novice

                I got past my class not found problems. In another thread I saw info. about differences between versions of JBoss. I am running 3.2.3. The suggestion for someone having classpath problems was go into the Tomcat jboss-service.xml file and change the 'UseJBossWebLoader' property to 'false'. I did this and everything started working! Path to the changed file: server\default\deploy\jbossweb-tomcat41.sar\META-INF\jboss-service.xml

                Okay ...., I had changed so many things my experience tells me I need to make sure I understand "how I got to here". If I change UseJBossWebLoader back to true it still works. Mystified!

                • 5. Re: Using Torque and JBoss
                  Bruce Scharlau Newbie

                  I hope that you've sorted this out by now. However, assuming that someone else will come along and wnat to know the answer, here's what I found when I recently integrated Torque into a web app running on JBoss.

                  First, you need to put the torque jars (torque/lib) under server/default/lib so that they are available.
                  Second, you need to import the torque.properties file into your app so that all of its paramaters are available to the servlet/JSP.
                  Third, you need to load said file into the page, before you can call the torque classes.

                  I've put the details into a Torque and JBoss page which explains it all.