Link to home
Start Free TrialLog in
Avatar of Lalita_jonnalagadda
Lalita_jonnalagadda

asked on

struts appliation problem on WAS 5.1.1

My war file is deploying fine.But when I click on submit on my jsp I get the following error in the browser:
Error 503: Failed to load target servlet [action]
logs show the followng message:
E SRVE0020E: [Servlet Error]-[action]: Failed to load servlet: javax.servlet.UnavailableException
      at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:880)
      at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)
      at javax.servlet.GenericServlet.init(GenericServlet.java:258)
      at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doInit(StrictServletInstance.java:82)
      at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._init(StrictLifecycleServlet.java:147)
      at com.ibm.ws.webcontainer.servlet.PreInitializedServletState.init(StrictLifecycleServlet.java:270)
      at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.init(StrictLifecycleServlet.java:113)
      at com.ibm.ws.webcontainer.servlet.ServletInstance.init(ServletInstance.java:189)
      at javax.servlet.GenericServlet.init(GenericServlet.java:258)
      at com.ibm.ws.webcontainer.webapp.WebAppServletManager.addServlet(WebAppServletManager.java:876)
      at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet(WebAppServletManager.java:224)
      at com.ibm.ws.webcontainer.webapp.WebAppServletManager.getServletReference(WebAppServletManager.java:455)
      at com.ibm.ws.webcontainer.webapp.WebApp.getServletReference(WebApp.java:652)
      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcherInfo.calculateInfo(WebAppRequestDispatcherInfo.java:187)
      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcherInfo.<init>(WebAppRequestDispatcherInfo.java:68)
      at com.ibm.ws.webcontainer.webapp.WebApp.getRequestDispatcher(WebApp.java:1464)
      at com.ibm.ws.webcontainer.webapp.WebApp.getRequestDispatcher(WebApp.java:1423)
      at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
      at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
      at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
      at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
      at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
      at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:615)
      at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:912)
What could be the problem.I downloaded the Struts 1.2.7 from apache.org.
 I have a the following folder structutre
-x
  my.jsp
  MTEA-INF
  WEB-INF
    - all tlds and dtds
    -lib all jars
    -classes
       -yyy
        -zzz
         -aaaction
           .class file
          -fffform
            .class file
       -resources
        -Application .prop
       

I war this folder and I'm deploying it on WAS 5.1.1
My Action.java and Form.java are stored in another location with the package structure yyy,zzz,.

Please give some answer.
Thanks
Avatar of boonleng
boonleng
Flag of Malaysia image

It seems that struts encountered problem initilise the plugin, what plugin are you configured in the struts-config.xml?
Check whether the files used by the plugin exist and are in the correct path.
Avatar of Lalita_jonnalagadda
Lalita_jonnalagadda

ASKER

Here's my struts-config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
          "struts-config_1_1.dtd">


<struts-config>
 
  <form-beans>
      <form-bean name="PinForm" type="xx.yy.zz.pinrequest.form.PinForm"/>
      
 </form-beans>
 
 <action-mappings>
   <action path="/pin" type="xx.yy.zz.pinrequest.action.PinAction" name="PinForm"
            scope="request" input="/pin.jsp" validate="true">
             <forward name="pin" path="/pin.jsp" />
   </action>
 </action-mappings>

 <message-resources
     parameter="resources.ApplicationResources"
     null="false" />


 <!-- Validator Configuration -->
<plug-in className="org.apache.struts
.validator.ValidatorPlugIn">
  <set-property property="pathnames"
               value="/WEB-INF/
  validator-rules.xml, /WEB-INF/
  validation.xml"/>
</plug-in>


</struts-config>

What should I do when you said I should put mu plugin in right path
The value for the attribute should be on the same line.
This is because xml parser will not remove the "\n" from the value when it read the struts-config.xml.

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
  <set-property property="pathnames"
               value="/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml"/>
</plug-in>

However, you can set the path to multiple lines coz the plugin will split the value using the delimeter ",".
  <set-property property="pathnames"
               value="/WEB-INF/validator-rules.xml,
                          /WEB-INF/validation.xml"/>
Thank you very much ..I don't see that error any more but I don't see the validation  error message  displayed when I enter 999999999 or 000000000 for ssn.
I see the following message in logs:

364d4e6c PropertyMessa I org.apache.struts.util.PropertyMessageResources  Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true

In my jsp I have 3 passowrd fields with properties SSN1,SSn2,SSN3
I added  <html:errors property="ssn"/> to my jsp just below my <html:html>

here is my action:

package xx.yy.zz.pinrequest.action;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.Action;
import us.ny.state.otda.dcse.pinrequest.form.PinForm;

public class PinAction extends Action
{

   public ActionForward execute(ActionMapping mapping, ActionForm form,  HttpServletRequest request,  HttpServletResponse response)
        throws Exception
      {
              ActionErrors errors = new ActionErrors();
                 
             PinForm pinForm = (PinForm) form;
       boolean ssnValidity = true;
          String ssn = pinForm.getSSN();

         /**  PinBD pinBD=nul;
             pinBD=new PinBD();

            String valid= pinBD.getSSN(ssn);
            String mesg=pinBD.getResponseMessage();*/
            
             
            try
            {
                               if(ssn.equals( "000000000") || ssn.equals ("999999999"))
                    {
                                ssnValidity = false;
                }
            }catch(Exception e){
             errors.add("ssn", new ActionError("error.invalidSsn.errorMsg"));
                  saveErrors(request,errors);
                  return mapping.findForward("pin");
              }
           return mapping.findForward("pin");
      }
      
  }  
             

Mu config.xml is above in yesterdays' comment and my ApplicationResources is below
 
        error.invalidSsn.errorMsg= Please enter a valid SSN.
  error.noRecordFound.errorMsg= No record found for this SSN.
   
 
 
 
 # Struts Validator Error Messages
   errors.required={0} is required.
   errors.minlength={0} can not be less than {1} characters.
   errors.maxlength={0} can not be greater than {1} characters.
   errors.invalid={0} is invalid.

   errors.byte={0} must be a byte.
   errors.short={0} must be a short.
   errors.integer={0} must be an integer.
   errors.long={0} must be a long.
   errors.float={0} must be a float.
   errors.double={0} must be a double.

   errors.date={0} is not a date.
   errors.range={0} is not in the range {1} through {2}.
   errors.creditcard={0} is an invalid credit card number.
   errors.email={0} is an invalid e-mail address.


Since I'm doing validation in action I guess  I don't need to worry about validation.xml         

Thbaks a lot for the earlier anwser and please let me know what I'm doing wrong here.    




I'm getting below error when I put my validation in my form.
Error 500: Server caught unhandled exception from servlet [action]: null

I also changed my validation.xml and added   pinForm.ssn1 =SSN1 to applicationproperties

my validation.xml islike this now

<form-validation>
  <formset>
    <form name="PinForm">
      <field property="ssn1"
            depends="required">
        <arg0 key="pinForm.ssn1  "/>
      </field>
     </form>
   </formset>
 </form-validation>

and my validation in form is as follows:

public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
      {
       
            ssn=getSSN();
             System.out.println("1:"+ssn);    
        ActionErrors errors = new ActionErrors();
       errors = super.validate(mapping,request);
       System.out.println("hello1");
      System.out.println("2:"+getSSN());
        if(this.getSSN().equals( "000000000") ||  this.getSSN().equals ("999999999"))
          {
                                System.out.println("hello2");
                   // errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.invalidSsn.errorMsg"));
                      errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("pinForm.ssn1 "));
                        
                                System.out.println("hello3");
               
          }
          return errors;
      }

I'm so confused.
Hmm... the codes looks fine.
Can you post the entire error stack trace.
Stck trace when I put validation In Action
/20/05 8:20:52:417 EDT] 77d237bc WebGroup      I SRVE0180I: [pin] [/pin] [Servlet.LOG]: /pin.jsp: init
[7/20/05 8:20:52:432 EDT] 77d237bc PropertyMessa I org.apache.struts.util.PropertyMessageResources  Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[7/20/05 8:20:52:432 EDT] 77d237bc PropertyMessa I org.apache.struts.util.PropertyMessageResources  Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
[7/20/05 8:20:52:448 EDT] 77d237bc PropertyMessa I org.apache.struts.util.PropertyMessageResources  Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[7/20/05 8:20:52:448 EDT] 77d237bc PropertyMessa I org.apache.struts.util.PropertyMessageResources  Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[7/20/05 8:20:52:464 EDT] 77d237bc PropertyMessa I org.apache.struts.util.PropertyMessageResources  Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[7/20/05 8:20:52:479 EDT] 77d237bc PropertyMessa I org.apache.struts.util.PropertyMessageResources  Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[7/20/05 8:20:52:479 EDT] 77d237bc PropertyMessa I org.apache.struts.util.PropertyMessageResources  Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[7/20/05 8:20:52:511 EDT] 77d237bc PropertyMessa I org.apache.struts.util.PropertyMessageResources  Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true

THis ius my action file:

package xx.xx.xxx.pinrequest.action;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.Action;
import xx.xx.xx..pinrequest.form.PinForm;

public class PinAction extends Action
{

   public ActionForward execute(ActionMapping mapping, ActionForm form,  HttpServletRequest request,  HttpServletResponse response)
        throws Exception
      {
       //System.out.println("1");
       ActionErrors errors = new ActionErrors();
        // Boolean ssnValid= true;
            
             PinForm pinForm = (PinForm) form;
       boolean ssnValidity = true;
          String ssn = pinForm.getSSN();

         /**  PinBD pinBD=nul;
             pinBD=new PinBD();

            String valid= pinBD.getSSN(ssn);
            String mesg=pinBD.getResponseMessage();*/
            
       //System.out.println("action:"+ ssn);
        
       
            //ssn=getSSN();
            //System.out.println("1:"+ssn);    
        //ActionErrors errors = new ActionErrors();
       // errors = super.validate(mapping,request);
        //System.out.println("hello1");
        //System.out.println("2:"+getSSN());
            try
            {
          if(ssn.equals( "000000000") || ssn.equals ("999999999"))
             {
                 ssnValidity = false;
                }
            }catch(Exception e){
             errors.add("ssn", new ActionError("error.invalidSsn.errorMsg"));
                  saveErrors(request,errors);
                  return mapping.findForward("pin");
              }
           return mapping.findForward("pin");
      }
        
             
 
      }



stack trace when I put my validation in form:


stack trace when I put validation in Form

SystemOut     O 1:999999999
[7/20/05 8:15:39:323 EDT] 27a437bc SystemOut     O hello1
[7/20/05 8:15:39:323 EDT] 27a437bc SystemOut     O 2:999999999
[7/20/05 8:15:39:323 EDT] 27a437bc SystemOut     O hello2
[7/20/05 8:15:40:417 EDT] 27a437bc WebGroup      E SRVE0026E: [Servlet Error]-[action]: java.lang.NullPointerException
      at us.ny.state.otda.dcse.pinrequest.form.PinForm.validate(PinForm.java:102)
      at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:942)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
      at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
      at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
      at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
      at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
      at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
      at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
      at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1019)
      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:592)
      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:204)
      at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)
      at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:286)
      at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
      at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:116)
      at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
      at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
      at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
      at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:615)
      at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:912)

My form is in teh earlier commnet added.

Thank you.





            
In Action stack trace do you notice 'config='org.apache.struts.taglib.html.LocalStrings', returnNull=true'
Does that mean something
ASKER CERTIFIED SOLUTION
Avatar of boonleng
boonleng
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial