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.
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.
JBoss 3.2.1 (with Jetty)
Oracle9i (you can change this to what you have/want)
Ant (1.5 pref)
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.
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.
could not attach with that msg ..dunno y .. trying this
forgot to add. you need to have classes12.jar or ojdbc14.jar in your classpath for the Oracle drivers with java to work.
I am wondering why no ppl say thanks to you!! I will try your example, and thanks a lot for your help. The bad news is I've just get rid of win 2k from my box(together with .net, vs 6 etc. useless things :), so I hope your code works on redhat 9 too.
you're welcome. :) i guess it should work with RHL too. some changes as to the directory structure and stuff like that. do mail me at firstname.lastname@example.org if you encounter any problems. 'd be glad to help
One of the better things you have done is removing .NET.
Why would you like to have something which doesn't have an adveture.
Just a thought.
Thanks lot, even start to dislike jboss. Just because the people like you are willing to help others.
Thanks a lot.
Thanks for your good effort, I am seeing for sample code... which will give some idea about how jboss, ant and xdoclet work... and the same time how to access the database using jboss... i am working on so many examples which are available in diff. sites... No one give me a clear idea... your example give me the clear picture in all those aspects... and your code also helpful to me... to do further learning....
Thanks a lot.
Tnx for the example... But I can't get it to compile! Ant complains about not finding ejb.jar (only warnings)...
But when ant starts to Compile, it can't find the package Domain (ehm, isn't XDoclet supposed the generate this?)...
Also I had to remove some tags from the antscript... Oh, I'm using ant 1.5 ant XDoclet 1.2