You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Anthony Martin <An...@TRAMS.com> on 2002/03/07 00:34:17 UTC

Exception creating bean ...

This one is a little hard to describe due to how it manifests.  I'd
appreciate any suggestions.

>From time to time when we start our server, we get a JspException that
doesn't go away until we restart the server.  So it comes and goes *without*
making changes to code or configuration files, and we're not sure what the
root cause is.  In one place, the JspException reads:

javax.servlet.jsp.JspException: Exception creating bean of class
com.trams.struts.LoginForm: {1}
	at
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:610)
	at org.apache.jsp.login$jsp._jspService(login$jsp.java:357)
	at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	.
	.
	.

I've traced it down to the org.apache.struts.util.RequestUtil, on or about
line 557 of the nightly build where it reads:

  try {
    // FIXME - thread context class loader?
    Class clazz = Class.forName(config.getType());
    instance = (ActionForm) clazz.newInstance();
  } catch (Throwable t) {
    LOG.error(servlet.getInternal().getMessage
    ("formBean", config.getType()), t);
    return (null);
  }

It throws a ClassNotFound exception on the forName line, and indeed returns
a null value and adds an ERROR log entry as it's coded to do in case a
Throwable is thrown.  It's interesting that just doing a restart fixes it.
This happens even on our production server.  When it does, I just restart
the Apache Tomcat service, and it's fine again.

We're on Struts Nightly Build, Apache Tomcat 4.0.3, JDK 1.3.1, Windows 2000.


Anthony

"Were it not for my little jokes, I could not bear the burdens of this
office." - Abraham Lincoln

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Exception creating bean ...

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Wed, 6 Mar 2002, Anthony Martin wrote:

> Date: Wed, 6 Mar 2002 15:34:17 -0800
> From: Anthony Martin <An...@TRAMS.com>
> Reply-To: Struts Developers List <st...@jakarta.apache.org>
> To: "Struts Developer's List (E-mail)" <st...@jakarta.apache.org>
> Subject: Exception creating bean ...
>
> This one is a little hard to describe due to how it manifests.  I'd
> appreciate any suggestions.
>

One scenario that would cause this exception (but it wouldn't go away on a
restart, it would be repeatable) is if you had struts.jar in Tomcat's
"lib" directory, instead of /WEB-INF/lib of your webapp.  I just committed
a fix (will show up in the 20020310 nightly build) that makes this
particular scenario work -- but it won't help your problem ;-(.

> >From time to time when we start our server, we get a JspException that
> doesn't go away until we restart the server.  So it comes and goes *without*
> making changes to code or configuration files, and we're not sure what the
> root cause is.  In one place, the JspException reads:
>
> javax.servlet.jsp.JspException: Exception creating bean of class
> com.trams.struts.LoginForm: {1}
> 	at
> org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:610)
> 	at org.apache.jsp.login$jsp._jspService(login$jsp.java:357)
> 	at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> 	.
> 	.
> 	.
>
> I've traced it down to the org.apache.struts.util.RequestUtil, on or about
> line 557 of the nightly build where it reads:
>
>   try {
>     // FIXME - thread context class loader?
>     Class clazz = Class.forName(config.getType());
>     instance = (ActionForm) clazz.newInstance();
>   } catch (Throwable t) {
>     LOG.error(servlet.getInternal().getMessage
>     ("formBean", config.getType()), t);
>     return (null);
>   }
>
> It throws a ClassNotFound exception on the forName line, and indeed returns
> a null value and adds an ERROR log entry as it's coded to do in case a
> Throwable is thrown.  It's interesting that just doing a restart fixes it.
> This happens even on our production server.  When it does, I just restart
> the Apache Tomcat service, and it's fine again.
>
> We're on Struts Nightly Build, Apache Tomcat 4.0.3, JDK 1.3.1, Windows 2000.
>

There has been a recently discovered problem in the Tomcat class loader --
if you have a JAR file that doesn't have the intervening directory levels
in the JAR, the class would not be recognized as being present, although
other classes could be loaded.  It's been fixed in the most recent Tomcat
nightly builds, and will be fixed in 4.0.4-beta-2 for the current
production branch.  But, again, this kind of thing should happen or not
happen consistently ... the sporadic nature is definitely mysterious.

>
> Anthony
>

Craig


> "Were it not for my little jokes, I could not bear the burdens of this
> office." - Abraham Lincoln
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>