9 Replies Latest reply on Oct 28, 2003 11:48 PM by RatKing

    JBoss example with Oracle9i

    ejbnewbie Newbie

      Hey ppl-
      this was long due but other things got in my way. but anyway, this is a basic example of user loggin in and the fn/ln details being displayed. there's lots to say but hope y'all will understand as you go thru the code.

      FOREWORD
      Most of the design and approach was based on the xpetstore project (http://xpetstore.sourceforge.net), For eg; the build file, xxxx.properties files, all were based heavily on the approach as used in the XPetstore project.

      System Requirements
      JBoss 3.2.1 (with Jetty)
      Oracle9i (you can change this to what you have/want)
      Ant (1.5 pref)
      XDoclet
      WebWorks

      System design specs
      Win2000 ( i dont know if i should specify this ;-) )
      System developed on JBoss 3.2.1 (coupled with Jetty) and Oracle9i as backend.
      Front-end: jsps and WebWorks.
      Misc: Ant (the neatest tool on earth), XDoclet (translate: ejb-coder life simplified)

      Steps to run this example

      1. Create New server - ejbexample
      in JBOSS_HOME\server make a new folder called ejbexample and copy the contents (all folders recursively) of the JBOSS_HOME\server\default folder to this empty ejbexample folder.

      2. Set up Oracle Database
      Copy JBOSS_HOME\docs\examples\jca\oracle-ds.xml to JBOSS_HOME\server\ejbexample\deploy and modify it (IP address,oracle name) to connect to your database server. and for the <jndi-name></jndi-name> element in this xml file, give examplePool (case-sensitive) as the value.
      instead of oracle-ds.xml, you can put in any *-ds.xml file from the JBOSS_HOME\docs\examples\jca\ directory to configure what database you'll be using. just modify it properly to connect correctly to whatever database and also the jndi-name to examplePool (case-sensitive)

      3. Start Server
      start the ejbexample server by typing run -c ejbexample from JBOSS_HOME\bin folder. Be sure to look out for "Bound Connection Factory. .. ..java:/examplePool...." somewhere in the stack that's printed out when JBoss (ejbexample server) is starting up.

      4. Setting up this App
      Unzip this attched ejbexample file to wherever you want, (NOTE: winzip creates all those folders like you see in the path.)
      Go to WHEREVER_YOU_UNZIPPED\ejbexample (let's call this WF) and run
      ant clean and then
      ant and finally
      ant deploy (NOTE: it'd be preferable if you keep the server running when typing this command). and now, enjoy the fireworks in the server console. you should see something that says it's deploying ejb-example.ear .. starting EJBContainer . .. creating tables and other stuff.

      Setting up Database
      after server is running, and has deployed the app, go to WF and run ant db. this should initialise the database for the usernames and passwords. other wise you can use SQL to enter some sample data in the T_LOGIN and T_USERDETAILS tables.

      Running this App
      Open up http://localhost:8080/ejb-example/web/login.jsp and type in user1 and password1 as the username/password details.

      If you see a Login OK page and the first name last name details below it, congratulations you've done it. otherwise... chek the console window and note the errors. and post it back to this site .. i'll be checking it.

      Final Notes
      The XPetstore project helped me a lot in understanding about Ant and XDoclet and the proper use of the xxxx.properties files. I drew heavily from the same structure as this XPetstore Project and all credit is due to everyone you see in the XXXX.PROPERTIES files.

      ALL I DID WAS USE LOTSA MATERIAL TO BUILD A SMALL APPLICATION OF MY OWN AND AM PUTTING THIS UP SO AS TO HELP OTHERS GET A START ON JBoss AND THAT'S ABOUT IT. THE XPetstore PROJECT HELPED ME A GREAT DEAL, KUDOS TO THE XPetstore PROJECT TEAM AND MINE IS JUST AN ATTEMPT TO MAKE JBoss EASIER TO UNDERSTAND AND WORK WITH.
      This thread helped me a lot too: http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t= is my first attempt at writing about/for a project and i'd love feedback from y'all. How did you like it?? was it incomplete?? was it unclear?? where would you have wanted more stuff/information? do lemme know and i'd b more than glad to help you with whatever i can.