I
infonote
In Netbeans when i click in the action class in struts to call entity
bean,
i get an error in the web.xml
I will attach the action and the web.xml
The action class compiles successfully.
Here is relevant code from action class
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
return mapping.findForward(SUCCESS);
}
private TravelEJB.ClientFacadeLocal lookupClientFacade() {
try {
javax.naming.Context c = new javax.naming.InitialContext();
return (TravelEJB.ClientFacadeLocal)
c.lookup("java:comp/env/ejb/ClientFacade");
}
catch(javax.naming.NamingException ne) {
java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging
..Level.SEVERE,"exception caught" ,ne);
throw new RuntimeException(ne);
}
}
}
and from web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlnssi="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">
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<session-config><session-timeout>
30
</session-timeout></session-config><welcome-file-list><welcome-file>
index.jsp
</welcome-file></welcome-file-list>
<ejb-local-ref>
<ejb-ref-name>ejb/ClientFacade</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local>TravelEJB.ClientFacadeLocal</local>
<ejb-link>Travel-ejb.jar#ClientFacade</ejb-link>
</ejb-local-ref>
</web-app>
bean,
i get an error in the web.xml
I will attach the action and the web.xml
The action class compiles successfully.
Here is relevant code from action class
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
return mapping.findForward(SUCCESS);
}
private TravelEJB.ClientFacadeLocal lookupClientFacade() {
try {
javax.naming.Context c = new javax.naming.InitialContext();
return (TravelEJB.ClientFacadeLocal)
c.lookup("java:comp/env/ejb/ClientFacade");
}
catch(javax.naming.NamingException ne) {
java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging
..Level.SEVERE,"exception caught" ,ne);
throw new RuntimeException(ne);
}
}
}
and from web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlnssi="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">
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<session-config><session-timeout>
30
</session-timeout></session-config><welcome-file-list><welcome-file>
index.jsp
</welcome-file></welcome-file-list>
<ejb-local-ref>
<ejb-ref-name>ejb/ClientFacade</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local>TravelEJB.ClientFacadeLocal</local>
<ejb-link>Travel-ejb.jar#ClientFacade</ejb-link>
</ejb-local-ref>
</web-app>