Worst possible situation
yuriy_zubarev Feb 10, 2008 3:56 PMGreeting,
The subject line is grim but true. I was developing Seam app on Windows box and everything worked fine, I put it on a Linux box and it doesn't work and doesn't spit out any exceptions.
Ok, a bit of details. I use Seam 2.0.1 and tomcat 6 on Java 5. Windows and Linux environments have the very same versions of all components. When I started debugging this problem I created a very simple TestWidget entity with two pages to see the list and details for test widgets.
@Entity @Table(name = "test_widgets") public class TestWidget implements Serializable { private int id; private String name; @Id @GeneratedValue @Column public int getId() { return id; } public void setId(int id) { this.id = id; } @Column public String getName() { return name; } public void setName(String name) { this.name = name; } }
TestWidget class is coming from a maven sub-project and the generated JAR also includes persistence.xml:
persistence.xml <?xml version="1.0" encoding="UTF-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> <persistence-unit name="provisioningDatabase" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:comp/env/jdbc/ProvisioningDB</jta-data-source> <class>mypackage.entity.TestWidget</class> <properties> <property name="hibernate.hbm2ddl.auto" value="update"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/> </properties> </persistence-unit> </persistence>
components.xml <framework:entity-query name="testWidgets" ejbql="select w from TestWidget w" />
@Name("testWidgetHome") public class TestWidgetHome extends EntityHome<TestWidget> { @Factory("testWidget") public TestWidget initModule() { return getInstance(); } }
test_widgets.xhtml <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:a="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml"> <ui:define name="content"> <h1>Test Widgets</h1> <h:dataTable id="roles" value="#{testWidgets.resultList}" var="w"> <h:column> <f:facet name="header">ID</f:facet> #{w.id} </h:column> <h:column> <f:facet name="header">Name</f:facet> #{w.name} </h:column> <h:column> <f:facet name="header">Actions</f:facet> <s:link value="edit" view="/test_widget.xhtml"> <f:param name="twId" value="#{w.id}"/> </s:link> </h:column> </h:dataTable> <h2>Create Test Widget</h2> <h:form styleClass="normal-form"> <fieldset> <s:decorate template="layout/edit.xhtml"> <ui:define name="label">Name:</ui:define> <h:inputText value="#{testWidget.name}" id="name" required="true"/> </s:decorate> </fieldset> <div><h:commandButton value="Create" action="#{testWidgetHome.persist}"/></div> </h:form> </ui:define> </ui:composition>
test_widget.xhtml <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:t="http://myfaces.apache.org/tomahawk" xmlns:a="http://richfaces.org/a4j" xmlns:platform="http://boats.com/platform/taglib" xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml"> <ui:define name="content"> <h1>Test Widget: #{testWidget.id}</h1> <h:form> <s:decorate template="layout/edit.xhtml"> <ui:define name="label">Name:</ui:define> <h:inputText value="#{testWidget.name}" required="true"/> </s:decorate> <h:commandButton action="#{testWidgetHome.update}" value="Save"/> </h:form> </ui:define> </ui:composition>
test_widget.page.xml <page> <param name="twId" value="#{testWidgetHome.id}" converterId="javax.faces.Integer"/> </page>
When I run the app on a windows box everything works. When I run it on a Linux box, I can create widgets and see the list of widgets but when I click to see details of a particular widget, I get a screen with no details information. The screen looks like as if I'm trying to create a new widget. #{testWidget.id} shows "0" and "name" textbox is empty. No exception or warnings in a log file. I'm totally puzzled. This is a very basic set-up and everything works fine on a Windows box.
Any clues would be highly appreciated.
Thank you,
Yuriy