- 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)
- 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:
- 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..