[Beginners Corner] - JBoss 4.0.5 servlet filter problem in web.xml
by rayymlai
I write a simple JSF hello world page index.jsp and deploy to JBoss 4.0.5. it seems that JBoss can only accept .faces extension, despite I define the Faces servlet filter with *.jsp.
Setup
1. My simple JSF apps has only one page index.jsp,
which is a simple hello world app, e.g.
Hello world, hi there.
2. I have a simple web.xml that defines the servlet filter with *.jsp (instead of .faces).
e.g.
<?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">
<display-name>xxx</display-name>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
<!-- Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
3. A simple, vanilla faces-config.xml
e.g.
<?xml version="1.0" encoding="UTF-8"?>
<faces-config>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
</faces-config>
Problems
1. upon successful deployment to JBoss, if I type
http://localhost:8080/xxx/index.jsp
JBoss will generate "non-stoppable" exceptions in the server console for a few minutes, and ends up with an exception on the Web browser:
exception
javax.servlet.ServletException: javax.servlet.ServletException
javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
root cause
javax.faces.FacesException: javax.servlet.ServletException
org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:422)
org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
2. if I type
http://localhost:8080/xxx/index.faces
the system will work and show hello world message.
Note: if I put *.faces in the faces servlet filter in the web.xml, the system will work as well.
3. JBoss does not seem to accept the faces servlet with a non-*.faces entry. I understand that *.faces is a recommended practice from the JSF spec, but in reality, many people use *.jsf or even *.jsp in the servlet filter.
Implication - I can only use *.faces in the URL for JSF apps.
Could anyone tell me whether I miss anything, or whether this is a specific JBoss implementation?
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982203#3982203
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982203
18 years, 1 month
[JBossWS] - hibernate and web services
by ypasmk
I'm trying to use web services and it's working but when I try to use hibernate in server side i get no entity found exception..here is my server side bean
|
| @Stateless
|
| @Local( {
|
| LoginService.class
|
| })
|
| @Remote( {
|
| LoginService.class
|
| })
|
| //@SecurityDomain("JBossWS")
|
| //@RolesAllowed ({"admin", "guest"})
|
| //@RunAs("admin")
|
|
|
| /*
|
| * JBossWS Annotations
|
| */
|
| @WebService(name = "LoginService",
|
| serviceName = "LoginService",
|
| endpointInterface = "some.webservices.LoginServiceSEI"
|
| )
|
| public class LoginServiceBean implements LoginService
|
| {
|
| private static final Logger log = Logger.getLogger(LoginServiceBean.class);
|
|
|
|
|
| @PersistenceContext
|
| EntityManager em;
|
|
|
|
|
|
|
|
|
| public boolean checkUser(String userid,String passid)
|
| {
|
|
|
| log.info("checking person('"+userid+"','"+passid+"')");
|
|
|
| try{
|
|
|
| User users=(User)em.createQuery("from User where username=:username and password=:password")
|
| .setParameter("username",userid)
|
| .setParameter("password",passid)
|
| .getSingleResult();
|
| log.info("hi there");
|
|
|
| }catch(Exception e) { log.info(e.toString()); return false; }
|
| return true;
|
| //else return true;
|
|
|
| }
|
|
|
|
|
| }
|
|
and here is the exception
|
| 20:36:15,788 INFO [LoginServiceBean] javax.persistence.NoResultException: No entity found for query
|
|
any help ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982192#3982192
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982192
18 years, 1 month