Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tomcat6: Can't resolve The absolute uri: http://java.sun.com/jsp/jstl/core

 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Based on some google searching, I've added jstl-impl-1.2.jar and jstl-api.1.2.jar to my project's WEB-INF/lib directory, and added them into the project. Made zero different, no joy.

I've been using Glassfish to develop and test my Jee/servlet/jstl application.
I'm trying to deploy it on Tomcat 6.0.28

I'm getting a stack dump starting with:

org.apache.jasper.JasperException: /index.jsp(12,9) The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

where my index.jsp page contains


<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

What do I need to change to get this to work with tomcat?

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65226
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the TLD file with that URI is present inside one of those jar files, Tomcat should find it with no problem.

You didn't explicitly say: this works fine with Glassfish?
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:If the TLD file with that URI is present inside one of those jar files, Tomcat should find it with no problem. You didn't explicitly say: this works fine with Glassfish?


Sorry, works perfectly with Glassfish started by Netbeans.

What TLD are you talking about? Perhaps Netbeans makes one that I have never looked at???
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65226
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The .tld files are in the jars.
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:The .tld files are in the jars.


well, in the standard Tomcat distro
jstl-impl-1.2.jar contains


/Users/pfarrell/sandbox/wayserver/webapi/web/WEB-INF/lib/jstl-impl-1.2/META-INF

pfarrell@way:~/sandbox/wayserver/webapi/web/WEB-INF/lib/jstl-impl-1.2/META-INF$ ls
MANIFEST.MF c.tld fmt.tld permittedTaglibs.tld sql-1_0.tld x-1_0.tld
c-1_0-rt.tld fmt-1_0-rt.tld fn.tld scriptfree.tld sql.tld x.tld
c-1_0.tld fmt-1_0.tld maven sql-1_0-rt.tld x-1_0-rt.tld


The two .jar files are in the war.

I'm not sure that they are right, here I'm a bit out of my depth.

Pat
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65226
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like the .tld files are there, and I'd be surprised if the c.tld file didn't specify the correct URI... so I'm kinda outa ideas.

I've never had any issues, but I'm sure that those aren't the JSTL implementation that I'm using as the file names are not the same (in fact, the implementation I'm using has a single jar file).
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where did you get your jstl jar? Its easy to try them and see if it fixes stuff.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65226
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
/ducks-for-cover

I don't remember.

But it's attached if you want to give it a whirl.
Filename: jstl-1.2.jar
Description: JSTL 1.2
File size: 405 Kbytes
[Download jstl-1.2.jar] Download Attachment
 
D. Ogranos
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe try and delete the app's folder in the TOMCAT_HOME/webapps, then deploy again. Make sure the correct libraries are contained in the WEB-INF/libs folder then. Other than this...no idea what might be wrong. I'm also using the JSTL implemenation with the two files (you probably got them from here?) and it works for me, although in a slightly older tomcat (6.0.18).
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65226
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another thing to check is to make sure that your WEB-INF/lib does not have the servlet and jsp implementation jars. That makes things act wonky in odd ways that usually defy logic.
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Another thing to check is to make sure that your WEB-INF/lib does not have the servlet and jsp implementation jars. That makes things act wonky in odd ways that usually defy logic.

No servlet or jsp, but I thought the jstl-1.2.jar was supposed to (required to) be in the WEB-INF/lib

Tried @bear's one file jstl-1.2.jar and still no joy
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65226
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pat Farrell wrote:No servlet or jsp, but I thought the jstl-1.2.jar was supposed to (required to) be in the WEB-INF/lib

Yes, the JSTL jars go in WEB-INF/lib. But sometimes people copy the JSP and servlet jars from the container to their WEB-INF/lib and that causes no end of hard-to-debug mayhem. It's one of the first things I advises checking for when otherwise inexplicable behavior arises.

Pat Farrell wrote:Tried @bear's one file jstl-1.2.jar and still no joy

OK, that means it's something environmental and not an issue with the JSTL jar file(s).

Is this a brand spanking new Tomcat install?

If so, what I'd do next is to create a minimal alternate web app and see if the JSTL loads correctly without anything else possibly getting in its way. If it loads, then it's likely something in your app, if not, there's likely an issue with the Tomcat install.
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Is this a brand spanking new Tomcat install?


Yep.

I'll try your idea
 
Stefan Evans
Bartender
Posts: 1784
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My guess would be the WEB-INF folder is in the wrong place.

The path was listed as:
~/sandbox/wayserver/webapi/web/WEB-INF/lib


Which one of these would be the Tomcat web context root? /sandbox/wayserver/webapi/web/ ?
How have you specified this in Tomcat?

What URL do you use to access your jsp page?

 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stefan Evans wrote:My guess would be the WEB-INF folder is in the wrong place.

The path was listed as:
~/sandbox/wayserver/webapi/web/WEB-INF/lib

Which one of these would be the Tomcat web context root? /sandbox/wayserver/webapi/web/ ?
How have you specified this in Tomcat?

What URL do you use to access your jsp page?


Entirely possible to be wrong. Where is this "specified"?
There is no /sandbox or even ~/sandbox on the Tomcat server, that's cruft from my development machine. All of the specs are supposed to be relative.

Official testing URL for the app is

http://bert.wayfinderdigital.com:8080/webapi/

So the files should all be relative to 'webapi' then the proper relative path is 'webapi/web/WEB-INF/lib'

I'm just using the tomcat "manager" application, so the details of the actual setup are opaque to me. I just uploaded the war, and then have tried to run it from the 'manager' link
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65226
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens if you simply drop the war into Tomcat's webapps folder?
 
Stefan Evans
Bartender
Posts: 1784
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WEB-INF folder has to be in the root of a web application.
ie if your context root is: http://bert.wayfinderdigital.com:8080/webapi/

Then I would expect to see on Tomcat something like

[TOMCAT]/webapps/webapi/WEB-INF/lib

If you have bundled the application in a WAR, then again, WEB-INF needs to be a top level directory, not packaged under "web"
If it can't find your WEB-INF/lib directory, it won't find the JSTL jar, and thus won't locate the uri for the tag library.
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:What happens if you simply drop the war into Tomcat's webapps folder?

I don't even know what, precisely, you mean here.

I've only used the user-friendly, information-free GUI

I trust that there is a directory tree somewhere. I'll go look. Hints appreciated.
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For a quick test, I ran some the example JSP "applications" that come with tomcat.

Most of the work fine. But there are three listed under "Tag Plugins"
with choices of: If ForEach Choose

None of these work. All get a stackdump, the same one:

The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65226
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pat Farrell wrote:
Bear Bibeault wrote:What happens if you simply drop the war into Tomcat's webapps folder?

I don't even know what, precisely, you mean here.

Take your war file, and just copy it into the webapps folder. By default, Tomcat will auto-deploy any war file in webapps (if the war file is properly formed).
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear, that works.
Now all I have to do is figure out why it was broken using the easy-to-use-and-understand GUI

I am curious as to why the sample JSP applications fail
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65226
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pat Farrell wrote:Bear, that works.

Cool. Means your war file and Tomcat are fine.

Now all I have to do is figure out why it was broken using the easy-to-use-and-understand GUI

THis is why I avoid them.

I am curious as to why the sample JSP applications fail

Not uncommon, I fear. I wouldn't sweat it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic