Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSTL support in Weblogic

Im trying to start working with Java EE using Weblogic, and i cant make JSTL tags work, in simpliest code i get the following errors when deploying my application:

index.jsp:1:4: No tag library could be found with this URI. Possible causes could be that the URI is incorrect, or that there were errors during parsing of the .tld file. <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

^----^ index.jsp:1:4: No tag library could be found with this URI. Possible causes could be that the URI is incorrect, or that there were errors during parsing of the .tld file. <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

^----^ index.jsp:2:4: No tag library could be found with this URI. Possible causes could be that the URI is incorrect, or that there were errors during parsing of the .tld file. <%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>

^----^ index.jsp:2:4: No tag library could be found with this URI. Possible causes could be that the URI is incorrect, or that there were errors during parsing of the .tld file. <%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>

I downloaded taglib files from this website: http://archive.apache.org/dist/jakarta/taglibs/standard/ and put two jars(standard.jar and jstl.jar) under my WEB-INF directory. I also put there all the tld files from the arcihve. Ater that i tried referencing them in my web.xml file and after validation i get the following error:

XML validation started. Checking file:/C:/Users/Brodyaga/Documents/NetBeansProjects/Eshop1/web/WEB-INF/web.xml... Referenced entity at "nbres:/org/netbeans/modules/j2ee/ddloaders/catalog/resources/XMLSchema.dtd". Referenced entity at "nbres:/org/netbeans/modules/j2ee/ddloaders/catalog/resources/datatypes.dtd". cvc-complex-type.2.4.a: Invalid content was found starting with element 'taglib'. One of '{"http://java.sun.com/xml/ns/javaee":description, "http://java.sun.com/xml/ns/javaee":display-name, "http://java.sun.com/xml/ns/javaee":icon, "http://java.sun.com/xml/ns/javaee":distributable, "http://java.sun.com/xml/ns/javaee":context-param, "http://java.sun.com/xml/ns/javaee":filter, "http://java.sun.com/xml/ns/javaee":filter-mapping, "http://java.sun.com/xml/ns/javaee":listener, "http://java.sun.com/xml/ns/javaee":servlet, "http://java.sun.com/xml/ns/javaee":servlet-mapping, "http://java.sun.com/xml/ns/javaee":session-config, "http://java.sun.com/xml/ns/javaee":mime-mapping, "http://java.sun.com/xml/ns/javaee":welcome-file-list, "http://java.sun.com/xml/ns/javaee":error-page, "http://java.sun.com/xml/ns/javaee":jsp-config, "http://java.sun.com/xml/ns/javaee":security-constraint, "http://java.sun.com/xml/ns/javaee":login-config, "http://java.sun.com/xml/ns/javaee":security-role, "http://java.sun.com/xml/ns/javaee":env-entry, "http://java.sun.com/xml/ns/javaee":ejb-ref, "http://java.sun.com/xml/ns/javaee":ejb-local-ref, "http://java.sun.com/xml/ns/javaee":service-ref, "http://java.sun.com/xml/ns/javaee":resource-ref, "http://java.sun.com/xml/ns/javaee":resource-env-ref, "http://java.sun.com/xml/ns/javaee":message-destination-ref, "http://java.sun.com/xml/ns/javaee":persistence-context-ref, "http://java.sun.com/xml/ns/javaee":persistence-unit-ref, "http://java.sun.com/xml/ns/javaee":post-construct, "http://java.sun.com/xml/ns/javaee":pre-destroy, "http://java.sun.com/xml/ns/javaee":message-destination, "http://java.sun.com/xml/ns/javaee":locale-encoding-mapping-list}' is expected. [12] XML validation finished.

My web.xml goes as following:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
        <taglib-location>/WEB-INF/fmt.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/fmt-rt</taglib-uri>
        <taglib-location>/WEB-INF/fmt-rt.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
        <taglib-location>/WEB-INF/c.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
        <taglib-location>/WEB-INF/c-rt.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
        <taglib-location>/WEB-INF/sql.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/sql-rt</taglib-uri>
        <taglib-location>/WEB-INF/sql-rt.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
        <taglib-location>/WEB-INF/x.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/x-rt</taglib-uri>
        <taglib-location>/WEB-INF/x-rt.tld</taglib-location>
    </taglib>
</web-app>

I believe that xml schema specified in the beginning of web.xml doesnt allow taglib tags, but i have no idea what schema i should use.

I'd really apprectiate some step by step tutorial for adding jstl support to weblogic. Thanks in advance.

UPDATE Removing those <taglib>'s from web.xml ends up with erros such as following:

index.jsp:18:14: The tag handler class was not found "org.apache.taglibs.standard.tag.rt.core.ForEachTag".

and by the contents of c.tld file its clear that weblogic understands that forEach corresponds to org.apache.taglibs.standard.tag.rt.core.ForEachTag, but cant find the class. But i can manually find this class in standard.jar.

like image 884
Anton Avatar asked Mar 24 '11 10:03

Anton


People also ask

Does WebLogic use Oracle client?

WebLogic JDBC provides several features that specifically require the use of Oracle Database and the Oracle Database JDBC driver.

What is Oracle WebLogic server used for?

Oracle WebLogic Server is a unified and extensible platform for developing, deploying and running enterprise applications, such as Java, for on-premises and in the cloud. WebLogic Server offers a robust, mature, and scalable implementation of Java Enterprise Edition (EE) and Jakarta EE.

Who uses Oracle WebLogic?

Companies using Oracle WebLogic Server for Apps Development include: Veolia, a France based Utilities organisation with 179718 employees and revenues of $29.88 billion, U.S. Department of the Treasury, a United States based Government organisation with 87336 employees and revenues of $20.00 billion, Dassault Systèmes, ...

What is Oracle WebLogic Server 12c?

Oracle WebLogic Server is the industry leading application server for building enterprise applications using Java EE standards, and deploying them on a reliable, scalable runtime with low cost of ownership. It is strategically integrated with Oracle's full product and cloud service portfolio.


2 Answers

You have to include both jstl.jar and standard.jar in the WEB-INF/lib folder, not in the WEB-INF folder. I guess that will solve this problem.

like image 118
mmjmanders Avatar answered Sep 29 '22 06:09

mmjmanders


add the library-ref in weblogic.xml:

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.2/weblogic-web-app.xsd">
    <wls:library-ref>
        <wls:library-name>jstl</wls:library-name>
        <wls:specification-version>1.2</wls:specification-version>
        <wls:exact-match>false</wls:exact-match>
    </wls:library-ref>
</wls:weblogic-web-app>

jstl library is deployed by default in WebLogic, so no worries on that side.

like image 37
Pierluigi Vernetto Avatar answered Sep 29 '22 06:09

Pierluigi Vernetto