4 Replies Latest reply on Feb 11, 2008 4:33 AM by yuriy_zubarev

    Worst possible situation

    yuriy_zubarev

      Greeting,

      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


        • 1. Re: Worst possible situation

          I am in the process of doing a migration.
          http://www.jboss.com/index.html?module=bb&op=viewtopic&t=129648

          Please post any solution or cause you find.

          • 2. Re: Worst possible situation
            jazir1979


            On my project we develop on windows, but our anthill (continuous integration) deployment and demo environment are on linux, with another external demo environment on windows under IIS forwarding to JBossAS.

            I've never noticed any kind of different application behaviour among these environments, so I'm not sure what could be causing your troubles.

            • 3. Re: Worst possible situation
              shane.bryzak

              If you could package this up in a deployable test case in JIRA and assign to me, I'd be happy to take a look at it for you.

              • 4. Re: Worst possible situation
                yuriy_zubarev

                Ok, there is some progress.

                So I had test_widget.page.xml and test_widget.xhtml files and the former should "pass" twId parameter to latter. This is exactly what breaks on Linux. As far as Seam is concerned test_widget.page.xml just doesn't exist! That's why twId was never taken care of and I got empty detail pages. When I deleted test_widget.page.xml and put its content to pages.xml then everything worked!

                I would really appreciate some explanations here especially since test_widget.page.xml is picked up with no problems in Windows environment.

                Either I'm missing something very obvious or nobody uses .page.xml approach.

                Thank you,
                Yuriy