This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 58167 - WAR inside EAR does not work correctly on SJAS 8.1
Summary: WAR inside EAR does not work correctly on SJAS 8.1
Status: CLOSED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: EAR (show other bugs)
Version: 4.x
Hardware: All All
: P2 blocker with 1 vote (vote)
Assignee: Marek Fukala
URL:
Keywords:
: 58393 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-04-21 14:27 UTC by mrsubscriber
Modified: 2006-05-30 11:19 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Example tag library (70.89 KB, application/octet-stream)
2005-04-26 09:54 UTC, mrsubscriber
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mrsubscriber 2005-04-21 14:27:30 UTC
The situation: standard (new) Enterprise Application project, consisting of one
EJB module and one Web module with JSPs. The web module uses a tag library,
supplied in a JAR-file. The tag library URI is NOT declared explicitly in the
web.xml.

When the Web-module is built/deployed alone, everything works fine; the
libraries to be packaged get nicely placed in WAR's WEB-INF/lib directory and
the AppServer properly resolves the tag library URI from the JAR-file.

However, when EAR is being built, the same libraries are not placed into the
WEB-INF/lib anymore, but, instead are included in root of the EAR and in the
appropriate manifest's classpath. Unfortuantely, SJAS 8.1 is unable to find any
tag library references EAR packaged this way, resulting in an error "...the tag
library absolute URI xxx is not specified in web.xml or in any libraries
deployed with the application...".

Not sure if SJAS is supposed to find them in this situation, or if it is just a
bug. But the whole situation is definitely very confusing and takes time to find
out what's gong wrong.

As a workaround, one may explicitly add the libraries that must go to
WEB-INF/lib in the Build/packaging window of the project settings.
Comment 1 Andrei Badea 2005-04-21 15:26:50 UTC
Marku, this seems to be in your area.
Comment 2 Marek Fukala 2005-04-25 14:45:29 UTC
I have a question for the reporter. 

Do you use "http-based" URIs to refer your taglibs in your JSP and tld files or
you use the URIs relative to web root? This may make a significant difference.

If you use the URIs relative to webmodule root e.g. <%@taglib 
uri="/WEB-INF/lib/mytaglib" prefix="c"%> (there is a  
<uri>/WEB-INF/lib/mytaglib</uri> element in you tld file) the webmodule deployed
as a j2ee module inside and ear will not likely work. The some situation will
happen if you use a link to a physical tld file (e.g. <%@taglib 
uri="/WEB-INF/lib/mytaglib.tld" prefix="c"%>

The solution which should work is to define an "http-URI" like
<uri>http://mydomain.org/mylib</uri> in your tld file and use this reference in
your JSP files. So the JSP will look like: 
<%@taglib  uri="http://mydomain.org/mylib" prefix="c"%>

Please let me know which mechanism do you use, or better, send me you tld file
or the entire library.
Comment 3 mrsubscriber 2005-04-26 09:54:56 UTC
Created attachment 21862 [details]
Example tag library
Comment 4 mrsubscriber 2005-04-26 09:56:19 UTC
In fact, "http-based" URI is exactly what I used. The JSP fragment looks like:

<%@page contentType="text/html;charset=ISO-8859-15"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://jsftutorials.net/htmLib" prefix="htm" %>
...

and the library, defining the "http://jsftutorials.net/htmLib" is attached
Comment 5 Marek Fukala 2005-04-26 10:15:44 UTC
Thanks for the information. 

It really seems to be an appserver problem. 

I will resend this issue to someone from the appserver team for further examination.
Comment 6 Marek Fukala 2005-05-04 09:20:05 UTC
*** Issue 58393 has been marked as a duplicate of this issue. ***
Comment 7 wqtnetbeans 2005-05-04 15:55:34 UTC
I don't think it's an appserver issue. If I understand the specs right, the
appserver is only required to scan all the jar files under WEB-INF/lib to look
for TLDs, but not for jar files in other places. Correct me if I am wrong. 
Comment 8 zikmund 2005-09-12 10:55:11 UTC
I think it's user problem. Web container works as specified in Servlet
Specification. OTOH it would be nice if IDE can help user resolve this problem -
how many users read spec? ;-)
Comment 9 Petr Blaha 2005-09-12 10:58:32 UTC
New Struts support doesn't work out-of-box for J2EE apps due this issue. The bug
should be definitely resolved very soon. I'm raising priority to p2.
Comment 10 Marek Fukala 2005-09-15 13:41:03 UTC
ufff - fixed.

Now the buildscript for webprojects built from ears searches for
/META-INF/tlds/*.tld files in project libraries and if it finds any tld/s it
puts the jarfile into /WEB-INF/lib instead of using the j2ee jars sharing mechanism.

Checking in src/org/netbeans/modules/web/project/resources/build-impl.xsl;
/cvs/web/project/src/org/netbeans/modules/web/project/resources/build-impl.xsl,v
 <--  build-impl.xsl
new revision: 1.102; previous revision: 1.10
Comment 11 Petr Blaha 2005-09-16 09:35:13 UTC
[build 20050915]