4 Replies Latest reply on Aug 12, 2007 5:14 PM by henry lu

    jboss and spring frame work

    henry lu Newbie

      I am new to the JBoss and having questions about using Spring framework with JBoss
      0. I am not using EJB.
      1. Can I just deploye an existing war file with Spring Framework that works in Tomcat into the JBoss without any configuration change with exception of (data source)?
      2. If not, what the minimum changes have to be made? Could someone send me a simple example that includs Spring Framework?

      Thanks,

      -Henry

        • 1. Re: jboss and spring frame work
          Peter Johnson Master

          For the few Spring applications that I have put together, I did not have to make any special changes to them, simply deployed the WAR file.

          If you are using a data source, you might have to add a WEB-INF/jboss-web.xml file to map the data source name.

          I am guessing that you have already tried this and run into a problem. Care to share what it is?

          • 2. Re: jboss and spring frame work
            henry lu Newbie

            Thank you for your info. As matter fact, I didn't have jboss-web.xml. Could you send me an example of yours?

            -Henry

            • 3. Re: jboss and spring frame work
              Peter Johnson Master

              I don't have Spring-related example, but here is one using plain servlets/JSPs. In my web.xml file I have:

              <resource-ref>
               <res-ref-name>ds/SomeDS</res-ref-name>
               <res-type>javax.sql.DataSource</res-type>
               <res-auth>Container</res-auth>
               <res-sharing-scope>Shareable</res-sharing-scope>
               </resource-ref>


              and in jboss-web.xml I have:

              <jboss-web>
               <resource-ref>
               <res-ref-name>ds/SomeDS</res-ref-name>
               <jndi-name>java:ds/SomeDS</jndi-name>
               </resource-ref>
              </jboss-web>


              and in my application I look up the datasource as:

              InitialContext ctx = new InitialContext();
              DataSource ds = (DataSource)ctx.lookup("java:comp/env/ds/SomeDS");


              • 4. Re: jboss and spring frame work
                henry lu Newbie

                I got the following error in the jmx console when I invoke the oracle jdbc driver:

                oracle.jdbc.driver.OracleDriver Information
                Not loaded in repository cache

                here is my oracle-ds.xml file:

                <local-tx-datasource>
                <jndi-name>cpp</jndi-name>
                <connection-url>jdbc:oracle:thin:@xxx:oralu</connection-url>
                <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
                <user-name>x</user-name>
                x
                ....

                <type-mapping>Oracle9i</type-mapping>


                -Henry