You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Julio Cesar Flores <ju...@gmail.com> on 2006/05/23 22:15:43 UTC

exception: cannot find bean in any scope.

Good Afternoon,
I'm  working an application under struts with jsp pages, under oc4j server
and i need to load the application on a tomcat server 4.1.31.
i have an jsp who should get the value of three request variables and put
in the jps with html:optionsCollection.
i'm execute the query to populate a variable that put in the servlet
context, then i get the value and set into request to the jsp.
the problem is when i'm trying to populate the optionsCollection, this
throws an exception like that: cannot find bean in any scope.
that ocurrs just when i'm running the application on tomcat, but when the
application is running on Oc4j it run without problems

this is my jsp code:

    <html:form action="consultaValorInma.do" method="post">
                 <table cellpadding="2" cellspacing="2" border="0"
align="center">
                   <tr>
                     <td class="etiqueta">Marca</td>
                     <td align="left">
                       <html:select property="marca"
onchange="triggerServerEvent('SelectMarca');">
                           <html:option value="0">Seleccione</html:option>
                           <html:optionsCollection name="marcas"
value="idMarca" label="descripcionMarca"/>


                        </html:select>
                     </td>

                   </tr>

this is my action code:

public ActionForward onConsultaInma (ActionMapping mapping, ActionForm
form, HttpServletRequest request, HttpServletResponse response) throws
IOException, ServletException, Exception
{
     DynaActionForm          actionForm;
   ActionForward           actionForward = mapping.findForward("success1");
   ActionErrors            errors = new ActionErrors ();
   PortalSegurosCaraboboBf portalSegurosCaraboboBf;
   Integer                 marca = null;
   Integer                 modelo = null;
   Integer                 version = null;
   Integer                 anno = null;
   actionForm    = (DynaActionForm) form;
   int pageSize;
   pageSize      = Integer.parseInt (getResources (request).getMessage ("
page.size"));
   ServletContext servletContext = request.getSession
().getServletContext();

   MarcaTo[] listaMarca;
   ModeloTo[] listaModelo;
   VersionTo[] listaVersion;
try
{
     listaMarca = (MarcaTo[])servletContext.getAttribute("marca");
     request.setAttribute("marcas",listaMarca);
     listaModelo = (ModeloTo[])servletContext.getAttribute("modelo");
     request.setAttribute("modelos",listaModelo);
     listaVersion = (VersionTo[])servletContext.getAttribute("version");
     request.setAttribute("versiones",listaVersion);

}
catch (Exception e)
   {
     loggerError.error ("ConsultaValorInmaAction.execute: ", e);
     throw (e);
   }

   if (errors.size () == 0)
     {
       actionForward = mapping.findForward ("success1");
       loggerDebug.info("ConsultaValorInmaAction Perfecto");
     }
   saveErrors (request, errors);
   return (actionForward);
}

/*********************************************/
Here, is where the collection of elements is set:


try {
               ServletContext servletContext = request.getSession
().getServletContext();

               if (servletContext.getAttribute("marca") == null) {
                   marca = consultaBf.consultaMarcaVehiculo(marcaVehiculo,
DataGridParameters.getDataGridPageIndex (request, "datagrid"),
Integer.parseInt (getResources (request).getMessage ("page_sucursal.size"))
);
                   //listaMarcas = consultaBf.consultaMarcaVehiculo
(marcaVehiculo,DataGridParameters.getDataGridPageIndex (request,
"datagrid"), Integer.parseInt (getResources (request).getMessage
("page_sucursal.size")) );
                   servletContext.setAttribute("marca", marca);
               }
                if (servletContext.getAttribute("modelo") == null) {
                   modelo = consultaBf.consultaModeloVehiculo
(marcaVehiculo,modeloVehiculo,DataGridParameters.getDataGridPageIndex(request,
"datagrid"),
Integer.parseInt (getResources (request).getMessage
("page_sucursal.size")));
                   //listaModelos = consultaBf.consultaModeloVehiculo
(marcaVehiculo,modeloVehiculo,DataGridParameters.getDataGridPageIndex(request,
"datagrid"),
Integer.parseInt (getResources (request).getMessage
("page_sucursal.size")));
                   servletContext.setAttribute("modelo", modelo);
               }
               if (servletContext.getAttribute("version") == null) {
                   version =
consultaBf.consultaVersionVehiculo(marcaVehiculo,modeloVehiculo,
versionVehiculo,DataGridParameters.getDataGridPageIndex (request,
"datagrid"), Integer.parseInt (getResources (request).getMessage
("page_sucursal.size")));
                   //listaVersiones =
consultaBf.consultaVersionVehiculo(marcaVehiculo,modeloVehiculo,
versionVehiculo,DataGridParameters.getDataGridPageIndex (request,
"datagrid"), Integer.parseInt (getResources (request).getMessage
("page_sucursal.size")));
                   servletContext.setAttribute("version", version);
The objects marca,modelo,version are a collection of objects of type
MarcaTo[], ModeloTo[], VersionTo[].

Am I forgetting anything or making an error?

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org