i am developping a homework web based application by using the following technologies:
- apache tomcat 6.0.18, installed with Netbeans 6.5.1
- toplink (with jpa annotations) for persistence, netbeans automatically creates jpa controller classes
- jsf, using jsf framework of netbeans, netbeans automatically creates jsf classes and crud pages
- derby database, coming bundled with netbeans and can be easily managed inside the ide
- web services, jaxws, using netbeans facilities during development (actually independent from jpa part)
Steps for jpa part:
- create a web application with jsf framework added, select tomcat as server runtime.
- create a database from databases under services tab. (use that db in the following step) (http://www.netbeans.org/kb/60/ide/java-db.html may help)
- create a persistence unit, selecting toplink, the created db in the above step and drop and create as table generation strategy.
- create entity classes
- generate jsf faces from entity classes
- deploy and try from localhost something like that : http://localhost:8084/Registration/faces/welcomeJSF.jsp, do not forget to put faces in the address, that makes the faces servlet deal with that page.
- add derbyclient.jar manually (under /opt/sun/javadb/lib in my linux environment ) if you get the following error during run:
Exception [TOPLINK-4003] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.DatabaseException
Exception Description: Configuration error. Class [org.apache.derby.jdbc.ClientDriver] not found.
and deploy and try again!
my project is working :)
Steps for web service part:
- create the web service and deploy again.. if successful, you should see the wsdl at somewhere like that http://localhost:8084/Registration/RegistrationWS?wsdl, generated jpa controller classes can be used within web service operations.
- create an other web aplication project. this will be the client that makes use of all deployed web services.
- in the client web app, generate the web service client from wsdl.
- crate a .jsp file in which you call the web service. this can be done automatically by right clicking in jsp and selecting 'Web Services Client Resources -> Call Web Servicve Operation'
- deploy the client web app and test from localhost..
Edit on 20.15 : if you get the following error while generating jsf from entity classes,
Could not find Id property. Be sure the accessor method name matches the variable name.
just move the jpa annotations from variable declarations to accessor methods. That fixed the problem in my case. btw, i faced this problem in Windows Xp, but in OpenSuse everything was fine already..