• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3416
  • Last Modified:

org.apache.jasper.JasperException: File "/tags/struts-logic" not found Error

My struts application is working fine with Tomcat 5.5.28 but when i put my application in Tomcat 5.0.25 I am getting this error.
org.apache.jasper.JasperException: File "/tags/struts-logic" not found
     org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:50)
     org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:378)
     org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:118)
     org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:159)
     org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:418)
     org.apache.jasper.compiler.Parser.parseDirective(Parser.java:483)
     org.apache.jasper.compiler.Parser.parseElements(Parser.java:1539)
     org.apache.jasper.compiler.Parser.parse(Parser.java:126)
     org.apache.jasper.compiler.ParserController.doParse(ParserController.java:220)
     org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
     org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203)
     org.apache.jasper.compiler.Compiler.compile(Compiler.java:461)
     org.apache.jasper.compiler.Compiler.compile(Compiler.java:442)
     org.apache.jasper.compiler.Compiler.compile(Compiler.java:430)
     org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:274)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

Does anyone know what could be the issue

Thanks
0
sbalasani
Asked:
sbalasani
  • 17
  • 15
  • 6
  • +1
1 Solution
 
JavatmCommented:
Did you put just the war file? or just the pages? its missing the tags/libraries required for struts you should add it too ;)
0
 
sbalasaniAuthor Commented:
I have copied the whole folder to 5.0.25 webapps directory.    Also  struts.jar and commons jars are in WEB-INF/lib folder.
0
 
fargoCommented:
Hi,

It could be that the web.xml is refering to tags/struts-logic for the tld and the tld files are not in position at your webapps.

Check the web.xml for tags/struts-logid taglib-uri and then check the taglib-location for the files. Is it there?

fargo
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
radarshCommented:
Which version of Servlet are you using? I mean what is the version at the top of your web.xml file?
You can find it in the DTD declaration.

If it is 2.4, you can't have a taglib declaration in your web.xml file. In that case, you have to
use the correct URI by checking from the .tld file in your JSPs.

Otherwise, if it's 2.3 and below, you've to make sure the the <taglib-location> tag points to the
proper file. You should be having something like this:

<taglib>
    <taglib-uri>http://com/foo/tags</taglib-uri>
    <taglib-location>/WEB-INF/tags/struts-logic.tld</taglib-location>
</taglib>

You should import in your JSP file using the URI

<%@ taglib prefix="something" uri="http://com/foo/tags" %>

The URI can be anything. It should only match.

________
radarsh
0
 
radarshCommented:
I've just added on to whatever fargo has already hinted.

________
radarsh
0
 
sbalasaniAuthor Commented:
here is my web.xml
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

  <taglib>
    <taglib-uri>/WEB-INF/tlds/struts-logic.tld</taglib-uri>
    <taglib-location>/WEB-INF/tlds/struts-logic.tld</taglib-location>
  </taglib>

and in my JSP i am using <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>

i have put the struts-logic.tld in /WEB-INF/tlds folder

And I want to remind you one more time that this application is working in 5.5.16 but not in 5.0.25

Thanks a lot
0
 
JavatmCommented:
If your jsp pages are just inside your folder just before the web-inf then that should be correct already :
/WEB-INF/tlds/struts-logic.tld

In any case see if it happens in a different tomcat again and see it it happens again :D
0
 
fargoCommented:
ok.

After a bit of search, it seems that you have to add struts-legacy.jar in your WEB-INF/lib folder.
I will check where you can download this.

fargo
0
 
radarshCommented:
Hey just a trial and error. Change the URI (both in web.xml and your JSP) to something like this:

/WEB-INF/tlds/struts-logic

And see.

If that also doesn't work,

Give http://struts.apache.org/tags-logic as the URI and check.


________
radarsh
0
 
sbalasaniAuthor Commented:
I have added struts-legacy.jar in WEB-INF/lib folder but that did'nt help.
Tomcat 5.5.16 is running on windows and  tomcat 5.0.25 is running on unix machine  Could that be the reason??

Thanks
0
 
fargoCommented:
Hi,

Just a wild guess, after adding the changes you are always restarting the tomcat or reloading the context for the check...correct?

fargo
0
 
radarshCommented:
Did the URI change I suggested also not help?


________
radarsh
0
 
JavatmCommented:
> Tomcat 5.5.16 is running on windows and  tomcat 5.0.25 is running on unix machine  Could that be the reason??
Can be try, r they running at the same time ? try to turn-off the other one.
0
 
sbalasaniAuthor Commented:
Yes everytime I make a change i am restarting the server.
I have tried radarsh suggestion of putting http://struts.apache.org/tags-logic in the URI but it didnt work either

Thanks
0
 
fargoCommented:
could be a dtd issue then. Can you check the order in web.xml same as defined in the dtd.

http://java.sun.com/dtd/web-app_2_3.dtd

regards,
fargo

0
 
radarshCommented:
By the way,

Your stack trace says

org.apache.jasper.JasperException: File "/tags/struts-logic" not found

and you have put your tlds under /WEB-INF/tlds??

Is it a typo error or is *this* the case?

________
radarsh

0
 
sbalasaniAuthor Commented:
This the the order of elements in my web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>app</display-name>
<servlet>
...
</servlet>
    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>
    <welcome-file-list id="WelcomeFileList">
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
  <taglib>
    <taglib-uri>/WEB-INF/tlds/struts-logic.tld</taglib-uri>
    <taglib-location>/WEB-INF/tlds/struts-logic.tld</taglib-location>
  </taglib>
  <resource-ref>
      <description>DB Connection</description>
      <res-ref-name>jdbc/TestDB</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>
</web-app>
0
 
fargoCommented:
Ok. Let's make one more try...

you have struts.jar in the WEB-INF/lib directory. Open the jar file...go to META-INF and remove the tlds file.
pack again and put inside the WEB-INF/lib directory.

Your web.xml looks fine to me.

fargo
0
 
fargoCommented:
before giving above one the try.

remove the work directory of the tomcat and check the page again.

fargo
0
 
radarshCommented:
As I said above, your exception message and your web.xlm tld location are not matching.
Check that too.

________
radarsh
0
 
sbalasaniAuthor Commented:
As fargo mentioned i have unjared struts.jar and deleted tlds folder from META-INF and put it in WEB-INF tlds but that didnt work
as radarsh said my exception should say
org.apache.jasper.JasperException: File "/WEB-INF/tlds/struts-logic.tld" not found
instead of  org.apache.jasper.JasperException: File "/tags/struts-logic" not found

because in my web.xml i am using "/WEB-INF/tlds/struts-logic.tld" as taglib-uri and in jsp i am using <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>

thats what confuses me too
0
 
fargoCommented:
r u sure u are checking the correct application and moreover the correct jsp??????
have you deleted the work directory of tomcat????

such things happen sometime, and makes one crazy.

fargo
0
 
sbalasaniAuthor Commented:
yeah everytime i am making a  change i am deleting web app from the work folder and restarting the server.

i found this respose in one of the forums
Possible resons for the error
1)Make sure (as mentioned) that your web.xml conforms to the tld.
2)And make sure your Action and Form is configured properly in the struts-config.xml file. Most likely that the Action is trying to use a form that does not exist or is not correctly configured.
0
 
fargoCommented:
Hi,

are you forwarding to some other page from the Action class? May be this page still has old directive for the taglib.

fargo
0
 
sbalasaniAuthor Commented:
I am gettting JasperException error  only when I try to create JNDI database connection pool in

$CATALINA_HOME/conf/server.xml.
<Context path="/unleashed" docBase="" reloadable="true" debug="0">
 <Resource name="jdbc/unleashed" auth="Container"
  type="javax.sql.DataSource"/>
 <ResourceParams name="jdbc/unleashed">
  <parameter><name>username</name><value>root</value></parameter>
  <parameter><name>password</name><value></value></parameter>
  <parameter><name>driverClassName</name>
   <value>org.gjt.mm.mysql.Driver</value></parameter>
  <parameter><name>url</name>
   <value>jdbc:mysql://localhost/unleashed</value></parameter>
 </ResourceParams>
</Context>


but when i delete context element in server.xml  I am not getting any error
Only problem with this is i will not be having connection pooling.

Do you know why I am getting the exception when i use context tag in server.xml
I dont see the relation between errror when using context tag in server.xml
and org.apache.jasper.JasperException: File "/tags/struts-logic" not found error

Thanks a lot

0
 
fargoCommented:
Hi,

First of all, you should not define contexts in server.xml (this is discouraged). Use a seperate context file(xml) and place them in the tomcat/conf/Catalina/localhost directory.

Moreover, i don't see any docBase? What are u refering your resources to then?

fargo

0
 
sbalasaniAuthor Commented:
I have put unleashed.xml in tomcat/conf/Catalina/localhost directory  but getting the same error.

Regarding docBase can I give it as webapps/unleashed , if unleashed is my web application name

Thanks
0
 
fargoCommented:
docBase="unleased" should work

as your sources are already in webapps. You need not to put webapps there.

fargo
0
 
fargoCommented:
well it seems that i m getting into your problem. Can you tell me the following?

which version of struts are u using? assuming struts 1.2.x
is the struts.jar is somewhere in your classpath except the application/WEB-INF/lib directory? If it is, remove it from anywhere else.

fargo

0
 
sbalasaniAuthor Commented:
My struts.jar is only in WEB-INF/lib directory of my web app.

and here is what my manifest.mf says in struts.jar
Manifest-Version: 1.0
Created-By: Apache Ant 1.5.1
Extension-Name: Struts Framework
Specification-Title: Struts Framework
Specification-Vendor: Apache Software Foundation
Specification-Version: 1.1
Implementation-Title: Struts Framework
Implementation-Vendor: Apache Software Foundation
Implementation-Vendor-Id: org.apache
Implementation-Version: 1.1
Class-Path:  commons-beanutils.jar commons-collections.jar commons-dig
 ester.jar commons-logging.jar commons-validator.jar jakarta-oro.jar s
 truts-legacy.jar

so i guess my struts verions is 1.1
0
 
fargoCommented:
is your problem solved?
and r u sure there is no other struts jar anywhere in the classpath?

fargo
0
 
sbalasaniAuthor Commented:
thanks a lot fargo and radarsh that problem has been solved eventhough it does'nt make any sense to me

0
 
fargoCommented:
tell me one thing, do u had docBase defined in the server.xml for the context?

fargo
0
 
sbalasaniAuthor Commented:
no i have created unleashed.xml  in tomcat\conf\Catalina\localhost\ and used context tag there like this

<Context path="/unleashed" docBase="unleashed" reloadable="true" debug="0">
 <Resource name="jdbc/unleashed" auth="Container"
  type="javax.sql.DataSource"/>
 <ResourceParams name="jdbc/unleashed">
  <parameter><name>username</name><value>root</value></parameter>
  <parameter><name>password</name><value></value></parameter>
  <parameter><name>driverClassName</name>
   <value>org.gjt.mm.mysql.Driver</value></parameter>
  <parameter><name>url</name>
   <value>jdbc:mysql://localhost/unleashed</value></parameter>
 </ResourceParams>
</Context>
0
 
fargoCommented:
I mean, earlier do u had docBase when u were defining the context in server.xml ?

fargo
0
 
sbalasaniAuthor Commented:
no it was empty like this <Context path="/unleashed" docBase="" reloadable="true" debug="0">

Thanks
0
 
fargoCommented:
there is the catch.

 If it was empty then what resources you were trying to access and how?

http://localhost:8080/unleashed....???????

fargo
0
 
sbalasaniAuthor Commented:
Yeah I was just concentrating on the error did'nt pay much attention to that. And the error was little misleading too.
:-)

shiva
0
 
fargoCommented:
Hi,

As you haven't define the docBase before, so the changes in the web.xml was not taking any effect :-) And we were trying to fix your web.xml...lolf

next is how the /tags/struts-logic is coming, so the point is how? As u haven't define the docBase...there is no way to get into the sources of unleased. Now is there anything like index.jsp available in webapps folder?

If yes, then the problem is almost clear. It tries to access this index.jsp from the default web.xml and this index.jsp must be having some struts tags and as the docBase was not defined, the /tags/struts-logic is not clear for the context.

lot of guesses. But at last, it slowly gets senseful.

fargo
0
 
fargoCommented:
hey sbalasani,

thank you very much. I got my masters level crossed in JSP section and i m delighted...atleast my efforts spent in this website is started making sense now. This month especially was good for me...because after a long break of almost 2.5  years i started here again....

Thanks once again.

i m off for a beer now...

fargo
0
 
sbalasaniAuthor Commented:
yeah you are exactly right there is a index.jsp file in my web apps folder

<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<logic:redirect forward="welcome"/>

Now that makes sense. :-)   .

You are the best

shiva
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 17
  • 15
  • 6
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now