Tomcat 7 + IntelliJ The absolute uri: http://java.sun.com/jsp/jstl/core Issue

Hi,
I'm having really big problem with running webapp on tomcat 7 from IntelliJ (Ultimate) IDE. The problem is, that I can't get working `taglib`s for my jsp. Doesn't really matter what kind of taglib I'm trying to add, it's not working anyway. The JSP only have taglibs:

    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <%@ taglib prefix="dec" uri="http://www.opensymphony.com/sitemesh/decorator" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
    <%@ taglib uri="http://displaytag.sf.net" prefix="display" %>

And the exception:

   java.lang.RuntimeException: org.apache.jasper.JasperException: 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
 at com.opensymphony.sitemesh.webapp.decorator.BaseWebAppDecorator.render(BaseWebAppDecorator.java:39)
 at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:84)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83)
 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 at pl.com.suadeo.utils.UnhandledExceptionsFilter.doFilter(UnhandledExceptionsFilter.java:30)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
 at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:123)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
 at org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:171)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
 at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
 at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
 at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
 at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
 at java.lang.Thread.run(Thread.java:662)


And it goes for every taglib I declared. My pom looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.test</groupId>
    <artifactId>powiazania</artifactId>
    <name>Powiązania</name>
    <packaging>war</packaging>
    <version>1.0.0</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java-version>1.6</java-version>
        <org.springframework-version>3.1.0.RELEASE</org.springframework-version>
        <org.springsecurity-version>3.1.0.RELEASE</org.springsecurity-version>
        <org.aspectj-version>1.6.9</org.aspectj-version>
        <jstl-version>1.2</jstl-version>
        <hibernate-version>4.1.4.Final</hibernate-version>
        <log4j-version>1.2.16</log4j-version>
        <commons-collections-version>3.2</commons-collections-version>
        <jackson-jaxrs-version>1.9.8</jackson-jaxrs-version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.2</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>${jstl-version}</version>
        </dependency>

        <dependency>
            <groupId>oro</groupId>
            <artifactId>oro</artifactId>
            <version>2.0.8</version>
        </dependency>

        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>${commons-collections-version}</version>
        </dependency>

        <!-- Spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${org.springframework-version}</version>
            <exclusions>
                <!-- Exclude Commons Logging in favor of SLF4j -->
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <!-- Spring Security -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${org.springsecurity-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${org.springsecurity-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${org.springsecurity-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>${org.springsecurity-version}</version>
        </dependency>

        <!-- Related to Spring Security -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.6.4</version>
        </dependency>

        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>1.6.4</version>
        </dependency>

        <!-- Hibernate library -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate-version}</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-ehcache</artifactId>
            <version>${hibernate-version}</version>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j-version}</version>
        </dependency>

        <!-- Display tag do paginacji -->
        <dependency>
            <groupId>displaytag</groupId>
            <artifactId>displaytag</artifactId>
            <version>1.2</version>
        </dependency>

        <!-- jsony do ajaxowych requestow przez jquery -->
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-jaxrs</artifactId>
            <version>${jackson-jaxrs-version}</version>
        </dependency>

        <!-- do zarzadzania annotacjami "scope" -->
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <version>2.2.2</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-io</artifactId>
            <version>1.3.2</version>
        </dependency>

        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.2.2</version>
        </dependency>

        <!-- SiteMesh -->
        <dependency>
            <groupId>opensymphony</groupId>
            <artifactId>sitemesh</artifactId>
            <version>2.4.2</version>
        </dependency>

        <!--  Gson: Java to Json conversion -->
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.2.2</version>
        </dependency>


        <!--  JSR 303 with Hibernate Validator -->
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>4.1.0.Final</version>
        </dependency>

        <dependency>
            <groupId>commons-validator</groupId>
            <artifactId>commons-validator</artifactId>
            <version>1.3.1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.axis</groupId>
            <artifactId>axis</artifactId>
            <version>1.4</version>
        </dependency>

        <dependency>
            <groupId>commons-discovery</groupId>
            <artifactId>commons-discovery</artifactId>
            <version>0.5</version>
        </dependency>

        <dependency>
            <groupId>commons-configuration</groupId>
            <artifactId>commons-configuration</artifactId>
            <version>1.6</version>
        </dependency>

        <dependency>
            <groupId>com.jolbox</groupId>
            <artifactId>bonecp</artifactId>
            <version>0.7.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.26</version>
        </dependency>

    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.zeroturnaround</groupId>
                <artifactId>jrebel-maven-plugin</artifactId>
                <version>1.1.1</version>
                <configuration>
                    <relativePath>/</relativePath>
                    <war>`
                        <path>
                            D:/java-stuff/intellij-workspace/powiazania/target
                        </path>
                    </war>
                    <alwaysGenerate>true</alwaysGenerate>
                </configuration>
                <executions>
                    <execution>
                        <id>generate-rebel-xml</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <compilerArgument>-Xlint:all</compilerArgument>
                    <!--<showWarnings>true</showWarnings>-->
                    <!--<showDeprecation>true</showDeprecation>-->
                </configuration>
            </plugin>

        </plugins>
    </build>
</project>


Yet it's not working anyway. What's most interesting, is that when I copy the exact war generated into `../webapps` directory in Tomcat, and run manually, it works. Any clue why it's not working from IDE?

I'm using IntelliJ Ultimate 12.0.4

5 comments

Two things I'd check to make sure first.

1. Do you have the TLD in your web.xml?

http://comments.gmane.org/gmane.comp.web.sitemesh.general/1202


2. Do you have a depedency for sitemesh? Do you have the jars for it? I don't see it in your maven depedencies.

http://mavenhub.com/mvn/opensymphony-releases/opensymphony/sitemesh/2.4

Also what steps do you have listed under run/debug config -> tomcat server -> your server -> deployment tab -> before launch (bottom)? Are you running your maven build before you have tomcat deploy? Maybe you're delegating the build process to intelliJ instead of Maven with a maven based project and it's not pulling in the sitemesh jars.

0

MIchael, isn't <taglib> declaration obsolete for JSP 2.0+? Anyway I've edited my question, including full pom file.
As for sitemesh taglib problem, it's just an example, if I comment out sitemesh, same exception is thrown for jstl, spring security, spring...in otherwords, its like taglibs are not found anywhere within my webapp

0

Looks like you're correct, the JSP 2.0 container should look in the following places if you don't make the declaration in your web.xml

1 <appName>/WEB-INF folder
2 All subfolders of <appName>/WEB-INF
3 Inside each JAR file in <appName>/WEB-INF/lib, in the META-INF folder of the JAR. This method is prefered for easy deployment of a JAR containing a taglib.

Are the JAR files beign placed in the correct place for #3?

Also what do the before steps your deploy tab say as I mentioned in the post earlier?

0

AD 3. Yes, everything is in perfect order :(

Moreover, I've downloaded Apache 6.0.x, and tried there... and it's working! I think it's some IntelliJ issue, as I mentioned earlier, everything works for Tomcat 7 outside IDE (manually deploying and running Tomcat 7) and works with TOmcat 6.

Also what do the before steps your deploy tab say as I mentioned in the post earlier?

I've tried such combinations:
Make
Make, Build artifact
Make, Build, Run Maven goal Install

0

Try removing the make/build and just leave the maven install there. I think you can just let it go to maven package.

0

Please sign in to leave a comment.