jerryc (9) [Avatar] Offline
#1
I first created a simple stock quoter (Stock) application, without XDoclet, consisting of a Struts action that calls an entity CMP bean to look up a stock in a mySql database. I built a .war for the webapp and a .jar for the EJB and dropped them into the deployment directory of JBoss 3.0.6. Everything deployed and ran just fine.

When I recreate everything with XDoclet, following the instructions in Chapters 3-6 of the book, everything builds and deploys fine. Since my "index.jsp" view uses the Struts HTML tag library I had to generate "struts-html.tld" using the merge files "taglib-settings.xml" and "taglib-tag.xml". This seems to work OK since I recover the standard "struts-html.tld" again.

But this time when I start up JBoss and give the browser the command: "http:localhost:8080/Stock/index.jsp"
I get the error message
"HTTP ERROR: 500 File '/WEB_INF/struts-html.tld' not found". This is puzzling since I can find the file in Stock.war in the WEB-INF directory.

The message on the JBoss console is:

"14:20:10,455 INFO [Server] JBoss (MX MicroKernel) [3.0.6 (CVSTag=JBoss_3_0_6 Da
te=200301260037)] Started in 0m:13s:49ms

14:22:33,451 WARN [jbossweb] WARNING: Exception for /Stock/
org.apache.jasper.JasperException: File "/WEB_INF/struts-html.tld" not found
at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoIm
pl.java:214) etc etc etc

Can you please show me what I am doing wrong?
habuma (279) [Avatar] Offline
#2
Re: Problem with Simple Stock Quoter
Without seeing your WAR file, I can't be 100% certain what your problem is.

However, I must question why you are generating the struts-html.tld file? You should only generate TLD files for your own custom tags, not for pre-existing tag libraries (such as the Struts tags or JSTL).

Maybe I'm missing something here, but I can't imagine why you'd merge the struts-html.tld file into a generated TLD file. I'm more interested in figuring out why you're doing this than why it isn't working (because if you don't need to do this, then there's no point in figuring out why it's broke).
jerryc (9) [Avatar] Offline
#3
Re: Problem with Simple Stock Quoter
You are right; there is no need to recreate the struts tag library file. I can just include the "struts-html.tld" in the web directory of the source tree and things seem to build OK.

The original problem was that the taglib directive in the "index.jsp" file had gotten corrupted and referred to "WEB_INF" instead of "WEB-INF", so "struts-html.tld" could not be found.

I have fixed that but there are some other problems which I am now investigating.

Thanks for the prompt response.
jerryc (9) [Avatar] Offline
#4
Re: Problem with Simple Stock Quoter
I'm running into another problem. When I deploy the XDoclet files in JBoss 3.0.6 and point my browser at

"http://localhost:8080/stock"

I get the message:

"HTTP ERROR: 500 Cannot find ActionMappings or ActionFormBeans collection
RequestURI=/stock/"

I have appended some generated file fragments below.

//struts-config.xml

<form-beans>
<form-bean >
name="stock.form.LookupForm"
type="com.xdocletbook.stock.form.LookupForm"
/>

<action-mappings>
<action >
path="/Lookup"
type="com.xdocletbook.stock.struts.action.LookupAction"
name="stock.form.LookupForm"
scope="request"
input="jsp/index.jsp"
unknown="false"
validate="true"
>
<forward >
name="success"
path="jsp/quote.jsp"
redirect="false"
/>
<forward >
name="failure"
path="jsp/index.jsp"
redirect="false"
/>
</action>
</action-mappings>
----------------------------------
//LookupForm.java

/**
* @struts.form
* name="stock.form.LookupForm"
*/
public class LookupForm extends ActionForm {

-------------------------------------------
//LookupAction.java

/**
* @struts.action
* path="/Lookup"
* name="stock.form.LookupForm"
* input="jsp/index.jsp"
*
* @struts.action-forward
* name="success"
* path="jsp/quote.jsp"
*
* @struts.action-forward
* name="failure"
* path="jsp/index.jsp"
*
*/

public class LookupAction extends Action {
----------------------------------------------
habuma (279) [Avatar] Offline
#5
Re: Problem with Simple Stock Quoter
At a glance, everything you show looks fine. This looks like a Struts configuration issue, not an XDoclet issue. I'm not sure exactly what it is, but if you google for "Cannot find ActionMappings or ActionFormBeans collection", you'll find that several others have encountered the same problem.

One possible reason I saw for this problem involved not configuring your web.xml file correctly to locate struts-config.xml. It's also possible that (for some reason) your build isn't putting the struts-config.xml file into the WAR file. And I saw a half-dozen other possible explanations for this error message out there. I can't be certain which applies to your situation.
jerryc (9) [Avatar] Offline
#6
Re: Problem with Simple Stock Quoter
I followed your suggestion and looked up on the web what others had done in the same situation. I tried a bunch of their fixes and the one that solved the problem was placing the element

<load-on-startup>0</load-on-startup>

in the "servlets.xml" merge file. The struts stuff now seems to be working.

Thanks for the help.
habuma (279) [Avatar] Offline
#7
Re: Problem with Simple Stock Quoter
No problem...I wish I could've helped you more directly, but since there are a lot of things that could cause the problem, I had no idea which suited your circumstance.