-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Exception Servlet action is not available
PostPosted: Tue Sep 06, 2005 9:23 am 
Newbie

Joined: Fri Aug 05, 2005 1:22 pm
Posts: 3
Hi,
I'm developing an application using Struts + hibernate + Spring + Tomcat...
when i do unit tests, it's ok, but when i do it in a Web "part", an exception occur: "Servlet action is not available."
I'm trying to login in a system, the exception occur when i submit the page.

My Web.xml:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
                         "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/spring-hibernate.xml</param-value>
</context-param>

<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>
  <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
  <servlet-name>action</servlet-name>
  <url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
  <welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<taglib>
  <taglib-uri>/WEB-INF/struts-bean</taglib-uri>
  <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
  <taglib-uri>/WEB-INF/struts-logic</taglib-uri>
  <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
<taglib>
  <taglib-uri>/WEB-INF/struts-html</taglib-uri>
  <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
   
   <taglib>
      <taglib-uri>http://java.sun.com/jstl/fmt-rt</taglib-uri>
      <taglib-location>/WEB-INF/fmt-1_0-rt.tld</taglib-location>
   </taglib>
   <taglib>
      <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
      <taglib-location>/WEB-INF/c-1_0-rt.tld</taglib-location>
   </taglib>
   
</web-app>


My Login form:
Code:
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/c-1_0-rt.tld" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Intranet</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript" src="securepass.js"></script>
<link href="styles/login.css" rel="stylesheet" type="text/css">
</head>
<link rel="STYLESHEET" type="text/css" href="styles.css"><!--- bgcolor="#182031"--->
<body leftmargin="0" topmargin="0" marginwidth="0" scroll="no" marginheight="0" background="img/backloginscreen.jpg"    onload=document.entrada.txtUsuario.focus()>
<script language=JavaScript>
   <!--
   if (window.top != window.self) {
    window.top.location = window.location;
   }
   if (parseInt(navigator.appVersion)>3) {
    if (navigator.appName=="Netscape") {
     if (top.screenX>0||top.screenY>0) {
      top.moveTo(0,0);
     } if (top.outerWidth<screen.availWidth) {
      top.outerWidth=screen.availWidth;
     } if (top.outerHeight<screen.availHeight) {
      top.outerHeight=screen.availHeight;
     }
    } else {
     top.moveTo(-4,-4);
     top.resizeTo(screen.availWidth+8,screen.availHeight+8);
    }
   }
   //-->
</script>

<SCRIPT language=JavaScript>
<!--
   function disableRightClick(e)
   {
     var message = 'Right click disabled';
    
     if(!document.rightClickDisabled) // initialize
     {
       if(document.layers)
       {
         document.captureEvents(Event.MOUSEDOWN);
         document.onmousedown = disableRightClick;
       }
       else document.oncontextmenu = disableRightClick;
       return document.rightClickDisabled = true;
     }
     if(document.layers || (document.getElementById && !document.all))
     {
       if (e.which==2||e.which==3)
       {
         //alert(message);
         return false;
       }
     }
     else
     {
       //alert(message);
       return false;
     }
   }
   

</SCRIPT>

<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="middle"><table width="558" height="346" border="0" cellpadding="0" cellspacing="0" background="img/loginscreen.jpg">
        <tr>
          <td><img src="img/t.gif" width="1" height="219"></td>
          <td><img src="img/t.gif" width="1" height="219"></td>
        </tr>
        <tr>
          <td><img src="img/t.gif" width="306" height="1"></td>
          <td>
       
       
        <html:form action="/usuario/action?act=login" method="post" target="_self" onsubmit="return validateLoginForm(this);">

                        <TABLE cellSpacing=2 cellPadding=2 border=0>
                          <TBODY>
                          <TR align=middle>
                            <TD class=FontStyle_1-Red colSpan=4><?=$_GET["msg"];?></TD>
                          <TR>
                            <TD noWrap rowSpan=3>&nbsp;&nbsp;</TD>
                            <TD noWrap>
                              <DIV align=right><SPAN class=FontStyle_1-Bold>Login:</SPAN></DIV></TD>

                            <TD noWrap class="form_login_input"><html:text maxlength="20" size="25" property="login" /></td>
                            <TD noWrap rowSpan=3>&nbsp;</TD></TR>
                          <TR>
                            <TD noWrap>
                              <DIV align=right><SPAN class=FontStyle_1-Bold>Senha:</SPAN></DIV></TD>
                            <TD noWrap class="form_login_input"><html:password  size="25" property="senha" /></TD></TR>

                          <TR>
                            <TD><DIV align=center>&nbsp;&nbsp;</DIV></TD>

                            <TD><DIV align=center class="StyleBotton_1"><html:submit>ENTRAR</html:submit></DIV></TD>
                          </TR>   
                       </TBODY>

                </TABLE>     
            
                     <html:hidden property="modulo" name="modulo" value="login"/>

                  <html:hidden name="acao" property="acao" value="valida_usuario"/>
</html:form>


       
        </td>
        </tr>
        <tr>
          <td valign="bottom"><img src="img/t.gif" width="306" height="22"></td>
          <td align="left" valign="top"><img src="img/t.gif" width="252" height="22"></td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>
<html:javascript formName="loginForm"/>


My spring-hibernate.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
   
   <bean name="dataSource"
         class="oracle.jdbc.pool.OracleDataSource"
         destroy-method="close">

       <property name="user">
           <value>xxx</value>
       </property>
       <property name="password">
           <value>xxx</value>
       </property>
   </bean>
   
   
   <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
      <property name="configLocation">
          <value>/WEB-INF/hibernate.cfg.xml</value>
      </property>
   </bean>
   
   <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
      <property name="sessionFactory" ref="sessionFactory"/>
   </bean>
   
   <bean name="/usuario/action" singleton="false" autowire="byName" class="br.gov.pa.tj.usuario.actions.Action">
      
   </bean>
   
   <bean id="baseDAO" class="br.gov.pa.tj.util.BaseDAOImpl">
      
      <property name="sessionFactory">
         <ref bean="sessionFactory"/>
      </property>
      
   </bean>
   
   
   
   <bean id="usuarioDAO" class="br.gov.pa.tj.usuario.dao.UsuarioDAOImpl" parent="baseDAO">
      
   </bean>
   
   <bean id="usuarioFacadeImpl" class="br.gov.pa.tj.usuario.facade.UsuarioFacadeImpl">
      <property name="usuarioDAO">
         <ref bean="usuarioDAO"/>
      </property>
   </bean>
   
   <bean id="usuarioFacade"
      class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
      <property name="transactionManager" ref="transactionManager"/>
      <property name="target" ref="usuarioFacadeImpl"/>
      <property name="transactionAttributes">
         <props>
            <prop key="inserir*">PROPAGATION_REQUIRED</prop>
            <prop key="alterar*">PROPAGATION_REQUIRED</prop>
            <prop key="*">PROPAGATION_SUPPORTS,readOnly</prop>
         </props>
      </property>
   </bean>
</beans>


Struts-config.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">

<struts-config>
      <form-beans>
            <form-bean name="loginForm" type="org.apache.struts.validator.DynaValidatorForm">
                  <form-property name="login" type="java.lang.String"/>
                  <form-property name="senha" type="java.lang.String"/>
            </form-bean>
         
      </form-beans>
      <global-exceptions/>
      <global-forwards>
         
      </global-forwards>
      <action-mappings>
            <action path="/Welcome" forward="/index.jsp"/>
         
            <action path="/usuario/action" type="org.springframework.web.struts.DelegatingActionProxy" parameter="act" name="loginForm" scope="request" validate="false">
                  <forward name="login-ok" path="/index.jsp" redirect="false"/>
            </action>
         
      </action-mappings>
      <controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>
      <message-resources parameter="MessageResources"/>
      <plug-in className="org.apache.struts.tiles.TilesPlugin">
            <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml"/>
            <set-property property="moduleAware" value="true"/>
      </plug-in>
      <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
            <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
      </plug-in>
      <plug-in className="org.springframework.web.struts.ContextloaderPlugIn">
            <set-property property="contextConfigLocation" value="/WEB-INF/spring-hibernate.xml"/>
      </plug-in>
</struts-config>


Someone knows where is my error?? :(


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 9:41 am 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
Well it's not a hibernate error so you'd be better off asking in a struts forum. Also you didn't post the stack trace so the error would have been very hard to diagnose if it had been a hibernate error.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 9:45 am 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
Using my rusty struts knowledge it would appear that you do not have an action called login, but there is one called loginForm.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.