[jboss-user] [JBoss Seam] - skeleton generated by Hibernate does not work, probably data

bpgergo do-not-reply at jboss.com
Mon Jul 2 16:00:56 EDT 2007


Hi,

I generated a seam skeleton app with Hibernate tools from a legacy db.
Hibernate version: 3.2.4.sp1, May 18, 2007
Hibernate tools version: org.hibernate.eclipse, 3.2.0.beta8
DB type &version: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit on Windose 2003 SP2, x64 Edition 
Appserver: jboss-4.0.5.GA (installed with JEMS 1.2 Installer and the ejb3 profile selected)
Framework:jboss-seam-1.2.1.GA

The seam example apps are working fine.

My generated sekeleton app does not work after deployment, and I can not figure out what could be the problem. I guess the app can not really connect to the db.

This is the typical exception thrown by every page:

  | exception
  | 
  | javax.servlet.ServletException: Cannot get value for expression '#{tirolesFinder.example.roId}'
  | 	javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
  | 	org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
  | 	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  | 
  | root cause
  | 
  | javax.faces.FacesException: Cannot get value for expression '#{tirolesFinder.example.roId}'
  | 	org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:422)
  | 	org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
  | 	org.jboss.seam.jsf.SeamViewHandler.renderView(SeamViewHandler.java:59)
  | 	org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
  | 	javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
  | 	org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
  | 	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  | 
  | note The full stack trace of the root cause is available in the Apache Tomcat/5.5.20 logs.
  | 

Here are those files which I consider to be relevant supposing it is some kind of a datasource problem.

persistence.xml

  | <entity-manager>
  |     <persistence-unit name="entityManager">
  |         <provider>org.hibernate.ejb.HibernatePersistence</provider>
  |         <!-- modified manually from DefaultDS -->
  |         <jta-data-source>java:/TimeDS</jta-data-source>
  |         <properties>
  |             <!-- modified manually from HSQLDialect -->
  |             <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect" />
  |             <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
  |             <property name="hibernate.transaction.flush_before_completion" value="true" />
  |             <!-- commented manually -->
  |             <!--property name="hibernate.hbm2ddl.auto" value="create-drop" /-->
  |             <property name="hibernate.show_sql" value="true" />
  |             <property name="jboss.entity.manager.factory.jndi.name" value="java:/seamappEntityManagerFactory" />
  |         </properties>
  |     </persistence-unit>
  | </entity-manager>
  | 

time-ds.xml

  | <?xml version="1.0" encoding="UTF-8"?>
  | 
  | <!-- ===================================================================== -->
  | <!--                                                                       -->
  | <!--  JBoss Server DataBase Configuration                                  -->
  | <!--  created manually                                                     -->
  | <!-- ===================================================================== -->
  | 
  | <datasources>
  | 
  |   <local-tx-datasource>
  |     <jndi-name>TimeDS</jndi-name>
  |     <connection-url>jdbc:oracle:thin:@localhost:1521:time</connection-url>
  |     <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
  |     <user-name>SON</user-name>
  |     <password>risa</password>    
  |     <min-pool-size>5</min-pool-size>
  |     <max-pool-size>20</max-pool-size>    
  | 
  |         <metadata>
  |          <type-mapping>Oracle10g</type-mapping>
  |       </metadata>  
  |     </local-tx-datasource>
  | 
  | </datasources>
  | 

build.xml

  | <?xml version="1.0"?>
  | <project name="SeamApplication" default="deploy" basedir=".">
  | <!-- Allow this to be overriden by others importing this project. -->
  |     <dirname property="imported.basedir" file="${ant.file.Seam}" />
  | <!-- Give user a chance to override without editing this file or typing -D -->
  |     <property file="${imported.basedir}/build.properties" />
  | <!-- Name of project and version, used to create filenames -->
  |     <property name="Name" value="SeamApplication" />
  |     <property name="name" value="seamapp" />
  | <!-- set global properties for this build -->
  |     <property name="build.dir" value="build" />
  |     <property name="classes.dir" value="${build.dir}/classes" />
  |     <property name="src.java.dir" value="src" />
  |     <property name="lib.dir" value="lib" />
  |     <property name="deploy.dir" value="${jboss.home}/server/default/deploy" />
  |     <property name="javac.debug" value="true" />
  |     <property name="javac.deprecation" value="false" />
  | <!-- WAR -->
  |     <zipfileset id="war.docroot" dir="resources/jsp">
  |         <include name="**/*" />
  |     </zipfileset>
  |     <zipfileset id="war.webinf" prefix="WEB-INF" dir="resources/WEB-INF">
  |         <patternset refid="meta.files" />
  |     </zipfileset>
  |     <zipfileset id="war.webinf.lib" prefix="WEB-INF/lib" dir="resources/WEB-INF/lib">
  |         <include name="*.jar" />
  |     </zipfileset>
  | <!-- EJB3 -->
  |     <fileset id="ejb3.root" dir="resources">
  |         <include name="import.sql" />
  |         <include name="seam.properties" />
  |         <include name="META-INF/persistence.xml" />
  |     </fileset>
  |     <fileset id="ejb3.lib" dir="lib">
  |         <include name="jboss-seam.jar" />
  |     </fileset>
  | <!-- EAR -->
  |     <zipfileset id="ear.resources" prefix="META-INF" dir="resources/META-INF">
  |         <include name="*" />
  |         <exclude name="persistence.xml" />
  |     </zipfileset>
  | <!-- Deploy -->
  |     <fileset id="deploy" dir="resources">
  |         <include name="_NONE_" />
  |         <!-- added manually -->
  |         <include name="time-ds.xml"/>
  |     </fileset>
  | <!-- Undeploy -->
  |     <patternset id="undeploy">
  |         <include name="_NONE_" />
  |     </patternset>
  |     <path id="build.classpath">
  |         <fileset dir="${lib.dir}">
  |             <include name="**/*.jar" />
  |         </fileset>
  |     </path>
  |     <patternset id="meta.files">
  |         <include name="**/*.dtd" />
  |         <include name="**/*.xml" />
  |         <include name="**/*.xslt" />
  |         <include name="**/*.properties" />
  |     </patternset>
  |     <patternset id="src.files">
  | <!-- include everything we want in the src directory
  |             that we didn't want in the jar itself -->
  |         <include name="**/*.java" />
  |     </patternset>
  |     <target name="clean" description="Cleans up the build directory">
  |         <delete dir="${build.dir}" />
  |     </target>
  |     <target name="init" description="Initialize the build">
  |         <echo message="Build ${Name}" />
  |         <mkdir dir="${classes.dir}" />
  |         <copy todir="${classes.dir}">
  |             <fileset dir="${src.java.dir}">
  |                 <patternset refid="meta.files" />
  |             </fileset>
  |         </copy>
  |     </target>
  |     <target name="compile" depends="init" description="Compile the Java source code">
  |         <javac destdir="${classes.dir}" classpathref="build.classpath" debug="${javac.debug}" deprecation="${javac.deprecation}" nowarn="on">
  |             <src path="${src.java.dir}" />
  |         </javac>
  |     </target>
  |     <target name="war" depends="compile">
  |         <jar destfile="${build.dir}/${name}.war">
  |             <zipfileset refid="war.docroot" />
  |             <zipfileset refid="war.webinf" />
  |             <zipfileset refid="war.webinf.lib" />
  |         </jar>
  |     </target>
  |     <target name="ejb3" depends="compile">
  |         <jar jarfile="${build.dir}/${name}.ejb3">
  |             <fileset dir="${imported.basedir}">
  |                 <include name="${name}.jar" />
  |             </fileset>
  |             <fileset dir="${classes.dir}">
  |                 <include name="**/*.class" />
  |                 <exclude name="**/test/*.class" />
  |             </fileset>
  |             <fileset refid="ejb3.root" />
  |             <fileset refid="ejb3.lib" />
  |         </jar>
  |     </target>
  |     <target name="ear" depends="ejb3, war">
  |         <jar destfile="${build.dir}/${name}.ear">
  |             <zipfileset dir="${build.dir}">
  |                 <include name="${name}.ejb3" />
  |             </zipfileset>
  |             <zipfileset dir="${build.dir}">
  |                 <include name="${name}.war" />
  |             </zipfileset>
  |             <zipfileset refid="ear.resources" />
  |         </jar>
  |     </target>
  |     <target name="deploy" depends="ear">
  |         <property name="unit.ext" value="ear" />
  |         <fail unless="jboss.home">jboss.home MUST be set. Update build.properties to point to a valid JBoss installation.</fail>
  |         <copy todir="${deploy.dir}">
  |             <fileset refid="deploy" />
  |         </copy>
  |         <copy file="${build.dir}/${name}.${unit.ext}" todir="${deploy.dir}" />
  |     </target>
  |     <target name="undeploy">
  |         <property name="unit.ext" value="ear" />
  |         <delete file="${deploy.dir}/${name}.${unit.ext}" />
  |         <delete>
  |             <fileset dir="${deploy.dir}">
  |                 <patternset refid="undeploy" />
  |             </fileset>
  |         </delete>
  |     </target>
  |     <target name="cleandb">
  |         <delete dir="${deploy.dir}/../data/hypersonic" />
  |     </target>
  | </project>
  | 

There's one more thing which is hopefully irrelevant for now (though it could be interesting for Hibernate tools developers). One of the generated EditorBeans was also modified manually, because it did not compile. 
All modifications was similar to this one:

  |        if (instance.getTiPersons()!=null) {
  |           //corrected manually 
  |           //instance.getTiPersons().getTiTimess().add(instance);
  |           instance.getTiPersons().getTiTimeses().add(instance); 
  |        }
  | 

Apart from this error, all the Java and JSF seems sound to me.

Thanks for your help.

Gergo

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059723#4059723

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4059723



More information about the jboss-user mailing list