7 Replies Latest reply on Mar 31, 2006 9:48 AM by Jason Long

    problem deploying simple seam app

    Ivaylo Kabakov Newbie

      hello!
      I have a problem deploying a simple test-like app using Jboss4.0.4RC1, EJB3, Seam, Facelets and JSF RI.
      The package I'm deploying has the following structure:

      /happyseam.ear
       / business.jar
       / META-INF
       / org
       / happyseam
       / business
       - ClientActions.class
       - ClientActionsBean.class
       - seam.properties
       / persistence.jar
       / META-INF
       - persistence.xml
       / org
       / happyseam
       / persistence
       - Client.class
       - seam.properties
       / test.war
       / META-INF
       / WEB-INF
       / lib
       - jsf-facelets.jar
       - faces-config.xml
       - web.xml
       - RegisterClient.xhtml
       - RegisterSuccess.xhtml
      


      The files are:

      Client:
      @Entity
      @Name("client")
      @Table(name="CLIENTS")
      @Scope(ScopeType.SESSION)
      public class Client implements Serializable {
       private int id;
       private String forename;
       private String surname;
       private String email;
      
       public Client() {}
      
       public Client(String forename, String surname, String email) {
       this.forename = forename;
       this.surname = surname;
       this.email = email;
       }
      
       @Column(name="CLIENT_EMAIL")
       public String getEmail() {
       return email;
       }
      
       public void setEmail(String email) {
       this.email = email;
       }
      
       @NotNull @Length(min=2, max=30)
       @Column(name="CLIENT_FORENAME")
       public String getForename() {
       return forename;
       }
      
       public void setForename(String forename) {
       this.forename = forename;
       }
      
       @Id
       @GeneratedValue
       @Column(name="CLIENT_ID")
       public int getId() {
       return id;
       }
      
       public void setId(int id) {
       this.id = id;
       }
      
       @NotNull @Length(min=2, max=30)
       @Column(name="CLIENT_SURNAME")
       public String getSurname() {
       return surname;
       }
      
       public void setSurname(String surname) {
       this.surname = surname;
       }
      }
      


      ClientActionsBean:
      @Stateful
      @Scope(ScopeType.SESSION)
      @Name("registerActions")
      @Interceptors(SeamInterceptor.class)
      public class ClientActionsBean implements ClientActions, Serializable {
       @PersistenceContext(type=EXTENDED)
       private EntityManager em;
      
       @In
       private Client client;
      
       @IfInvalid(outcome = Outcome.REDISPLAY)
       public String register() {
       try {
       System.out.println(client.getForename());
       em.persist(client);
       return "success";
       } catch (Exception e) {
       e.printStackTrace();
       return null;
       }
       }
      
       @Destroy
       @Remove
       public void destroy() {
       }
      }


      Registration page:
      <?xml version="1.0" encoding="UTF-8" ?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelet" xmlns:h="http://java.sun.com/jsf/html">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <title>register client</title>
      </head>
      <body>
      <h:form id="registerForm">
       <h:outputLabel id="fnOL" for="forename">
       <h:outputText id="forenameLabel" value="First name: " />
       </h:outputLabel>
       <h:inputText id="forename" value="#{client.forename}" />
       <br />
       <h:outputLabel id="mnOL" for="middlename">
       <h:outputText id="middlenameLabel" value="Middle name: " />
       </h:outputLabel>
       <h:inputText id="middlename" value="#{client.middlename}" />
       <br />
       <h:outputLabel id="snOL" for="surname">
       <h:outputText id="surnameLabel" value="Last name: " />
       </h:outputLabel>
       <h:inputText id="surname" value="#{client.surname}" />
       <br />
       <h:commandButton id="submit" value="register" action="#{registerActions.register}" />
      </h:form>
      </body>
      </html>
      


      And using the following descriptors:

      faces-config.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE faces-config
       PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
       "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
      
      <faces-config>
       <lifecycle>
       <phase-listener>
       org.jboss.seam.jsf.SeamPhaseListener
       </phase-listener>
       </lifecycle>
      
       <application>
       <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
       </application>
      
       <navigation-rule>
       <from-view-id>/registerClient.xhtml</from-view-id>
       <navigation-case>
       <from-outcome>success</from-outcome>
       <to-view-id>/registrationSuccess.xhtml</to-view-id>
       <redirect />
       </navigation-case>
       </navigation-rule>
      </faces-config>


      web.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.4"
       xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      
       <!-- Seam -->
       <listener>
       <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
       </listener>
      
       <!-- Propagate conversations across redirects -->
       <filter>
       <filter-name>Seam Redirect Filter</filter-name>
       <filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>Seam Redirect Filter</filter-name>
       <url-pattern>*.seam</url-pattern>
       </filter-mapping>
      
       <!-- 120 second conversation timeout -->
       <context-param>
       <param-name>org.jboss.seam.core.manager.conversationTimeout</param-name>
       <param-value>120000</param-value>
       </context-param>
      
       <!-- Global JNDI name pattern for JBoss EJB3 (change for other servers) -->
       <context-param>
       <param-name>org.jboss.seam.core.init.jndiPattern</param-name>
       <param-value>jboss-seam-booking/#{ejbName}/local</param-value>
       </context-param>
      
       <!-- JSF -->
       <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>client</param-value>
       </context-param>
      
       <context-param>
       <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
       <param-value>.xhtml</param-value>
       </context-param>
      
       <context-param>
       <param-name>facelets.DEVELOPMENT</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <!-- Faces Servlet Mapping -->
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.seam</url-pattern>
       </servlet-mapping>
      
       <!-- JSF RI -->
       <listener>
       <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
       </listener>
      </web-app>
      


      Persistence.xml:
      <persistence>
       <persistence-unit name="happySeamData">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <jta-data-source>java:/HappySeamDS</jta-data-source>
       <properties>
       <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
       <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
       <property name="hibernate.transaction.flush_before_completion" value="true" />
       <property name="hibernate.hbm2ddl.auto" value="none" />
       </properties>
       </persistence-unit>
      </persistence>
      


      When deploying the package the Jboss throws the following exception:
      19:15:00,859 WARN [ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=business.jar
      java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
       at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:653)
       at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:460)
       at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:286)
       at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:222)
       at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
       at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
       at java.lang.Class.initAnnotationsIfNecessary(Class.java:2998)
       at java.lang.Class.getAnnotation(Class.java:2958)
       at org.jboss.aop.annotation.AnnotationElement.getVisibleAnnotation(AnnotationElement.java:72)
       at org.jboss.aop.Advisor.resolveAnnotation(Advisor.java:245)
       at org.jboss.ejb3.ProxyDeployer.initializeRemoteBindingMetadata(ProxyDeployer.java:127)
       at org.jboss.ejb3.SessionContainer.instantiated(SessionContainer.java:70)
       at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:546)
       at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:528)
       at org.jboss.ejb3.Ejb3Deployment.deployUrl(Ejb3Deployment.java:509)
       at org.jboss.ejb3.Ejb3Deployment.deploy(Ejb3Deployment.java:481)
       at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:438)
       at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:125)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:260)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:243)
       at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:260)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:974)
       at $Proxy0.create(Unknown Source)
       at org.jboss.system.ServiceController.create(ServiceController.java:330)
       at org.jboss.system.ServiceController.create(ServiceController.java:273)
       at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:260)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:190)
       at $Proxy25.create(Unknown Source)
       at org.jboss.ejb3.EJB3Deployer.create(EJB3Deployer.java:345)
       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:953)
       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:943)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:807)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:771)
       at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:260)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:190)
       at $Proxy6.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:334)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:522)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:20
      7)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:218)
      
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:197)
      19:15:01,078 FATAL [PersistenceXmlLoader] happySeamData JTA
      ... ... ...
      

      with more exceptions following.
      I have no idea what this exception means.

      Could someone please help me with some guidance what am I doing wrong, or probably missing something.

      PS: Sorry if I'm being too verbose, but just trying to explain the steps taken and see if I'm doing something wrong or not understanding the general idea.

      Thanks in advance for any tips.