Problem using Struts with Weblogic


Web tier: servlets, JSP, Web frameworks: Problem using Struts with Weblogic

  1. Problem using Struts with Weblogic (4 messages)

    I am using Eclipse - Lomboz - Weblogic 8.1 combination for application development. I have a web application developed using the struts framework. When I deploy this web application as a war file, everything works fine. But when I create a EAR package with the web application and a couple of EJB jars and try to deploy the application, I am getting the following error message when the Action Servlet is loaded by the web container:

    07/02/2005 | 14:04:15 | ERROR | Digester | startElement | Begin event threw exception
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.lang.reflect.Method.invoke(
    at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(
    at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(
    at org.apache.commons.beanutils.PropertyUtils.setProperty(
    at org.apache.commons.beanutils.BeanUtils.setProperty(
    at org.apache.commons.beanutils.BeanUtils.populate(
    at org.apache.commons.digester.SetPropertiesRule.begin(
    at org.apache.commons.digester.Rule.begin(
    at org.apache.commons.digester.Digester.startElement(
    at weblogic.apache.xerces.parsers.AbstractSAXParser.startElement(
    at weblogic.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(
    at weblogic.apache.xerces.impl.xs.XMLSchemaValidator.emptyElement(
    at weblogic.apache.xerces.impl.XMLNamespaceBinder.handleStartElement(
    at weblogic.apache.xerces.impl.XMLNamespaceBinder.emptyElement(
    at weblogic.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(
    at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(
    at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(
    at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(
    at weblogic.apache.xerces.parsers.DTDConfiguration.parse(
    at weblogic.apache.xerces.parsers.DTDConfiguration.parse(
    at weblogic.apache.xerces.parsers.XMLParser.parse(
    at weblogic.apache.xerces.parsers.AbstractSAXParser.parse(
    at weblogic.xml.jaxp.WebLogicXMLReader.parse(
    at weblogic.xml.jaxp.RegistryXMLReader.parse(
    at org.apache.commons.digester.Digester.parse(
    at org.apache.struts.action.ActionServlet.parseModuleConfigFile(
    at org.apache.struts.action.ActionServlet.initModuleConfig(
    at org.apache.struts.action.ActionServlet.init(
    at javax.servlet.GenericServlet.init(
    at weblogic.servlet.internal.ServletStubImpl$
    at weblogic.servlet.internal.ServletStubImpl.createServlet(
    at weblogic.servlet.internal.ServletStubImpl.createInstances(
    at weblogic.servlet.internal.ServletStubImpl.prepareServlet(
    at weblogic.servlet.internal.WebAppServletContext.preloadServlet(
    at weblogic.servlet.internal.WebAppServletContext.preloadServlets(
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(
    at weblogic.servlet.internal.HttpServer.preloadResources(
    at weblogic.servlet.internal.WebService.preloadResources(
    at weblogic.servlet.internal.ServletInitService.resume(
    at weblogic.t3.srvr.SubsystemManager.resume(
    at weblogic.t3.srvr.T3Srvr.resume(
    at weblogic.Server.main(
    Caused by: java.lang.NoClassDefFoundError: org/apache/struts/validator/ValidatorActionForm
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(
    at weblogic.utils.classloaders.GenericClassLoader.findClass(
    at java.lang.ClassLoader.loadClass(
    at java.lang.ClassLoader.loadClass(
    at java.lang.ClassLoader.loadClass(
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(
    at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(
    at org.apache.struts.config.FormBeanConfig.formBeanClass(
    at org.apache.struts.config.FormBeanConfig.setType(

    The cause for the IncocationTargetException is mentioned as a NoClassDefFoundError on org.apache.struts.validator.ValidatorActionForm. But the struts.jar file is in the WEB-INF\lib directory of the war file. More importantly nothing in the war file is changed when packaged as a EAR file.

    Any suggestions on where to look would be highly appreciated.


    Threaded Messages (4)

  2. none[ Go to top ]


    I think long back BEA has acknowledged a bug in that jars residing in the Application ClassLoader (included in the EAR) won't be loaded, not sure if 8.1 still has this issue. They have to be included in the EJB Jars that are placed in the EAR to be loaded and used by both EJB's and web apps. However the Struts classes shouldn't be needed from the EJBs so you could just include them in WEB-INF/lib.

  3. Problem using Struts with Weblogic[ Go to top ]

    Hi Ash,
    Thanks for your reply. The struts.jar is already available in the WEB-INF/lib folder and it is not required by any of the EJBs that I have. It is required only by the web application. The following is the dir. structure of the ear file (only the relevant paths).

    .(top level)

    Still I am getting the exception mentioned, when the application is packaged as an EAR file.

  4. none[ Go to top ]

    Set the <prefer-web-inf-classes> element of weblogic.xml to true, this will cause classes located in the WEB-INF directory of a Web application to be loaded in preference to classes loaded in the application or system classloader.

  5. Hi Ash,
    Thanks for the solution. The EJB Jar file contained the Action classes of the web application. That caused the problem because when the servlet is loaded, the root class loader loaded the servlet class from the EJB Jar, but it could not find the struts related classes as they are inside web-inf/lib of the web module and hence invisible to the root class loader. When I removed all the web module related classes from the ejb jar, the problem went away. I am sure the solution of using the <prefer-web-inf-classes> would also work.