3 Replies Latest reply on Jul 21, 2013 4:45 PM by rhanus

    Simple JSF app that attaches to a database

    jgagnon

      I am trying to put together a JSF web application that needs to connect and interact with a database (I'm using MySQL).  I'm very new to web development, so the whole world of "configuration files" (i.e. various xml files and the like) with regards to web apps is pretty much terra incognita.  I have a simple JSF app that I put together using some example code found somewhere on the Internet.  I  spent quite some time struggling with getting a datasource established between JBOSS and MySQL, and I think that has been successful.  Now I'm trying to deploy my simple app that will try to connect with the datasource and that's where I'm not having any luck.  I'll include below or attach various snippets of files/output that I have.  If there is anything I've missed, please let me know.  I'd really appreciate help to figure out why my stuff doesn't work and what (and why) I need to do to make it work.

       

      Development environment:

      iMac running OS X 10.6.8

      Eclipse Juno

      Java 1.6

      JBOSS AS 7.1.1

      MySQL

       

       

        • 1. Re: Simple JSF app that attaches to a database
          rhanus

          the reason is here:

          16:26:56,970 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "DB_Test.war" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.DB_Test.DB_Test.env.jdbc.db_testjboss.naming.context.java.jboss.resources.jdbc.db_testMissing[jboss.naming.context.java.module.DB_Test.DB_Test.env.jdbc.db_testjboss.naming.context.java.jboss.resources.jdbc.db_test]"]}

           

          resource reference jdbc/db_test in UserBean is not connected with any jboss server resource

          you need to add jboss-web.xml beside web.xml and define jndi-name reference:

           

          <?xml version="1.0" encoding="UTF-8"?>

          <jboss-web>

              <resource-ref>

                  <res-ref-name>jdbc/db_test</res-ref-name>

                  <jndi-name>java:jboss/datasources/TestDS</jndi-name>

              </resource-ref>

          </jboss-web>


          • 2. Re: Simple JSF app that attaches to a database
            jgagnon

            It looks like that worked.  I still don't understand what's going on "behind the curtain".  Is there a good source of information I can go to in order to understand what goes on behind the scenes that makes all of this work?  Something that's geared for someone who knows just about nothing about configuring web servers (that would be me ) would be the greatest help.  I try to find stuff by doing a web search, but that is very inefficient and usually leads off on tangents or dead ends.

             

            Thanks

            • 3. Re: Simple JSF app that attaches to a database
              rhanus

              the best way to start with both enterprise java and jboss are jboss as quickstarts along with jboss 7.1 getting started quide

              then you may advance to the javaee6 tutorial look for details on jboss forums, stackoverflow.com...