[jboss-user] [JBoss Seam] - Re: Could not instantiate Seam component:

pasmith do-not-reply at jboss.com
Tue Aug 1 14:28:43 EDT 2006


Here is some more information on our configuration:

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>
  | 
  |    
  | 	<context-param>
  | 	    <param-name>org.jboss.seam.core.init.debug</param-name>
  | 	    <param-value>true</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>projectMgmt/#{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>
  | 
  |     <!-- MyFaces -->
  |     <listener>
  |         <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
  |     </listener>
  |  
  |     <!-- JSF RI -->
  |     <!--
  |     <listener>
  |         <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  |     </listener> 
  |     -->
  |     
  | </web-app>
  | 

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>
  | 
  | <application>
  |         <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
  |     </application>
  |     
  | 
  |     <!-- A phase listener is needed by all Seam applications -->
  |     
  |     <lifecycle>
  |         <phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>
  |     </lifecycle>
  | 
  | </faces-config>

seam.properties:
org.jboss.seam.core.init.jndiPattern #{ejbName}/local

And finally our LoginAction class:

  | import javax.ejb.Stateless;
  | import javax.persistence.EntityManager;
  | import javax.persistence.PersistenceContext;
  | 
  | import model.User;
  | 
  | import org.jboss.seam.annotations.In;
  | import org.jboss.seam.annotations.Logger;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.annotations.Out;
  | 
  | import org.jboss.seam.log.Log;
  | 
  | @Stateless
  | @Name("login")
  | public class LoginAction implements Login
  | {
  |    
  |    @In 
  |    @Out
  |    private User user;
  |    
  |    @PersistenceContext
  |    private EntityManager em;
  |    
  |    @Logger
  |    private Log log;
  | 
  |    public String login()
  |    {
  |        
  |        User u = em.find(User.class, "pasmith");
  | 
  |        
  |        if(u.getPassword().equals(user.getPassword())) {
  |            System.out.println("CORRECT PASSWORD FOR " + u.getUsername());
  |        }
  |        
  |        return "home";
  |    }
  | 
  | }
  | 

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

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



More information about the jboss-user mailing list