Philippe Leménager [
http://community.jboss.org/people/cinephil] created the discussion
"Simple Seam app configured for Tomcat"
To view the discussion, visit:
http://community.jboss.org/message/564739#564739
--------------------------------------------------------------
Hello Seamians ! :)
I've been trying to config a simple seam test project for Tomcat 6 using JBoss Tools
but it still doesn't work after reading many things about it on the Internet and
trying the solutions proposed. :(
1) New Seam Web Project
1.a) Seam web project window
Project name : projettest
Target runtime : Apache Tomcat v6.0
Dynamic web module version : 2.5 (default choice)
Target Server : Tomcat v6.0 Server at localhost
Configuration : Dynamic Web Project with Seam 2.2 (default choice)
NEXT
1.b) Java
NEXT
1.c) Web Module
NEXT
1.d) JSF Capabilities
After some unsuccessfull tries, I've created a user-library with jsf-api.jar and
jsf-impl.jar taken in jboss-seam-2.2.0.GA/lib directory and selected this new library +
"Include libraries with this application". I lived the other things by default.
NEXT
1.d) Seam Facet
Seam Runtime : jboss-seam-2.2.0.GA
Deploy as : WAR
Database type : MySQL5 (InnoDB)
Connection profile MysQL Test (configured and tested)
Database Schema Name : Test
Database Catalog Name : Test
DB Tables already exists in database : selected (the database contains only one simple
table called users (usr_id, username, name, password) with two lines inside).
I leaved the other options as default.
FINISH
=> The project has been created without errors.
2) Changing some things, after reading issues about this operation.
2.a) projettest/WebContent/META-INF/context.xml
2.b) projettest/WebContent/WEB-INF/classes/META-INF/persistence.xml
2.c) projettest/WebContent/WEB-INF/components.xml
I've deleted all params in tag <core:init />
2.d) projettest/WebContent/WEB-INF/pages.xml
I've commented the last tag <exception>, this one :
<!-- <exception>
<redirect view-id="/error.xhtml">
<message severity="error">Unexpected error, please try
again</message>
</redirect>
</exception> -->
2.e) Added jars
I copied from jboss-seam-2.2.0.GA/lib those jars :
- commons-collections.jar
- commons-lang.jar
- commons-logging.jar
- concurrent.jar
- dom4j.jar
- hibernate-annotations.jar
- hibernate-common-annotations.jar
- hibernate-core.jar
- hibernate-entitymanager.jar
- hibernate-search.jar
- hibernate-validator.jar
- javassist.jar
- jboss-common-core.jar
- jta.jar
- log4j.jar
- lucene-core.jar
- persistence-api.jar
- slf4j-api.jar
- slf4j-log4j12.jar
2.f) log4j.xml
I've copied the file log4j.xml from jboss-seam-jpa example project to
projettest/WebContent/WEB-INF/classes.
3) Starting Tomcat and trying to access to the project
There is no error when I start Tomcat, just this info message :
org.apache.catalina.core.StandardContext addApplicationListener
INFO: The listener "com.sun.faces.config.ConfigureListener" is already
configured for this context. The duplicate definition has been ignored.
I also have this WARN :
WARN [PersistentPermissionResolver] no permission store available - please install a
PermissionStore with the name 'org.jboss.seam.security.jpaPermissionStore' if
persistent permissions are required.
When I type
http://localhost:8080/projettest http://localhost:8080/projettest in Firefox,
I already have the "Welcome to Seam!" page with the url
http://localhost:8080/projettest/home.seam http://localhost:8080/projettest/home.seam but
some errors appears in Tomcat console :
12:22:09,217 ERROR [SeamPhaseListener] swallowing exception
java.lang.RuntimeException: exception invoking: getTransaction
at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:154)
...
Caused by: javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.TransactionFactory.getObjectInstance(TransactionFactory.java:113)
...
12:22:09,310 WARN [SeamPhaseListener] uncaught exception, passing to exception handler
java.lang.IllegalStateException: Could not commit transaction
at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:625)
...
Caused by: java.lang.RuntimeException: exception invoking: getTransaction
at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:154)
...
Caused by: javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.TransactionFactory.getObjectInstance(TransactionFactory.java:113)
...
Many times the same errors.
4) Generate entities
4.1) New Seam Generate Entities
Reverse engineer from database is selected
NEXT
4.2) Select Tables
I had to click on the Refresh button because no database had appeared. Then I selected
Test database and clicked on the Include button.
FINISH
=> Some more files have been generated successfully.
5) Trying to browse data
After reloading the home page, a "Browse Data / Users List" menu appears. When I
click on it, I already have the UsersList.seam page with some more ERROR
[SeamPhaseListener] swallowing exception in Tomcat Console.
If I click on the Search button, with ou without something in the fields of the page, the
application crashes with these errors :
org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: "Servlet.service()" pour la servlet Faces Servlet a généré une exception
javax.el.PropertyNotFoundException: /UsersList.xhtml @19,81
value="#{usersList.users.username}": Target Unreachable, identifier
'usersList' resolved to null
at com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:62)
...
I've searched on the Internet but didn't find clear explanation and solution.
Someone here can help me ?
Thanks in advance.
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/564739#564739]
Start a new discussion in JBoss Tools at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]