Bug 389510 - org.apache.jasper.glassfish does not import several used packages
Summary: org.apache.jasper.glassfish does not import several used packages
Status: NEW
Alias: None
Product: Orbit
Classification: Tools
Component: bundles (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 minor with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Orbit Bundles CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-13 09:50 EDT by Raymond Auge CLA
Modified: 2017-03-23 09:53 EDT (History)
4 users (show)

See Also:


Attachments
A fragment bundle built using the following bnd file allowed the successfull generation of jsp files (265 bytes, application/octet-stream)
2012-09-13 09:50 EDT, Raymond Auge CLA
no flags Details
possible fix (1.70 KB, patch)
2012-09-13 14:52 EDT, Thomas Watson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Raymond Auge CLA 2012-09-13 09:50:18 EDT
Created attachment 221036 [details]
A fragment bundle built using the following bnd file allowed the successfull generation of jsp files

org.apache.jasper.glassfish is missing imports of:

	javax.xml.parsers
	javax.xml.transform
	org.w3c.dom
	org.w3c.dom.ls
	org.xml.sax
	org.xml.sax.helpers

(and perhaps others)

Bundle-Version: 2.2.2.v201112011158
Implementation: equinox (juno)
Other dependencies: satisfied (bundle starts and executes without "other" errors)
Comment 1 Thomas Watson CLA 2012-09-13 14:52:12 EDT
Created attachment 221059 [details]
possible fix

Analyzing the class files I came up with the attached patch that adds the necessary imports.  I made the ant dependencies optional since we don't use ant tasks provided by jasper in our usage scenarios.

I am not sure about the javax.annotation.processing or java.lang.model* packages.  I assume these are being used by the copy of ecj we have in the orbit bundle.  I am not sure what cases these packages are necessary or if they can be optionally imported.  That being said, I don't think it is a problem to make these packages mandatory since these packages are included in JavaSE-1.6 and that is the minimum execution environment for the org.apache.jasper.glassfish bundle anyway.
Comment 2 David Williams CLA 2012-09-13 17:08:17 EDT
Looks good to me. Hugues, want to try for Kepler M2? (i.e. in 1 day :/ 

Also, there is a version 2.1.0 still in active builds that might need similar analysis/changes? 

Tom, what did you use to "analyze the class files"? I used to use "depends" or something named similar but wonder if there's something better. Or, maybe you just look at with hex editor :) 

Hugues, it'd be good to update your email in the ip_log xml files as it appears to have changed. 

Thanks all.
Comment 3 Thomas Watson CLA 2015-01-09 16:53:06 EST
(In reply to David Williams from comment #2)

> Tom, what did you use to "analyze the class files"? I used to use "depends"
> or something named similar but wonder if there's something better. Or, maybe
> you just look at with hex editor :) 

Wish I could recall for sure.  I think I used a bnd tool.  Or perhaps I imported the jar as a bundle into PDE and had it calculate the imports.
Comment 4 David Williams CLA 2015-01-09 20:23:30 EST
(In reply to Thomas Watson from comment #3)
> (In reply to David Williams from comment #2)
> 
> > Tom, what did you use to "analyze the class files"? I used to use "depends"
> > or something named similar but wonder if there's something better. Or, maybe
> > you just look at with hex editor :) 
> 
> Wish I could recall for sure.  I think I used a bnd tool.  Or perhaps I
> imported the jar as a bundle into PDE and had it calculate the imports.

Sorry Tom .. and Raymond. I am just not seeing it. I tried 3 things to try to confirm these were needed, but none of them panned out. Which is not to say I haven't made an error, somewhere, but ... I do at least want to ask "... are you sure?" 

First I looked at the org.apache.jasper.glassfish bundle used by Jetty 8.x (latest) distribution ... thinking maybe they did the same or similar thing. But, no. pretty much just like ours. (now that we've added the optional JDT core imports). 

Next, I used "jdeps" (which comes with Java 8) to see what each package requires ... but could not "see" the requirements that are in the patch. (Granted, that is "just java" (not OSGi) but ... I've used it before and it does help find "top level" missing packages ... which, I think is all we need? 

Next, I used Eclipse itself, imported in various ways, and computed dependencies in various ways, but it never came up with any differences? 

I will say, the version that is in CVS right now (and has been for a while) has a requirement on Java 5, in the .classpath -- even though the bundle says "Java 6". I will correct that mistake soon (fixing .classpath) but I wonder if that somehow tainted your earlier results? Especially with bnd? (I did not try that) ... but, I did try, with PDE and 'jdeps' using Java 6 and Java 5, and in neither case did it say I needed more. 

So, either I don't know how to tell ... or ... the Java 5/6 issue messed things up ... or ... something. 

Are you sure? ... we need this change? (And, if so, can you account for why I don't see it, but you do?)
Comment 5 David Williams CLA 2015-01-09 20:24:32 EST
Oh, this wouldn't be one of the "Vendor" issues would it? I was using Oracle VM in all cases. Were you using IBM's?
Comment 6 David Williams CLA 2015-01-10 12:17:02 EST
(In reply to David Williams from comment #5)
> Oh, this wouldn't be one of the "Vendor" issues would it? I was using Oracle
> VM in all cases. Were you using IBM's?

The VM used didn't seem to matter. (i.e. got same non-results). 

I've only one more guess ... I am wondering if "bnd' treats the files as a "pseudo feature" and "gathers" everything needed, even by "required" bundles, if the "required" bundles do no contain what they should? 

Also, the .classpath was incorrect for the bundle in CVS, still saying "1.5" instead of the correct "1.6" -- I've just fixed, as part of bug 442310 -- but, if bnd uses the .classpath, that would certainly give incorrect results.
Comment 7 David Williams CLA 2015-01-10 13:02:18 EST
Gunnar, you are a "big bnd" user, right? 

If easy for you, was wondering if 1) you'd be willing to double check with bnd to see that it adds to MANIFEST.MF, and 2) if different from what all these other methods find, if you'd be able to explain it?
Comment 8 Gunnar Wagenknecht CLA 2015-01-12 08:45:45 EST
(In reply to David Williams from comment #7)
> Gunnar, you are a "big bnd" user, right? 

Well, let's put it this way: I realized using bnd is much more reliable for computing packages to import as well as "uses" clauses than PDE that I do trust it more.


> If easy for you, was wondering if 1) you'd be willing to double check with
> bnd to see that it adds to MANIFEST.MF, and 2) if different from what all
> these other methods find, if you'd be able to explain it?

For 1) I check the org.apache.jasper.glassfish 2.2.2 bundle published by the Jetty team. It came up with the following.

--------------------------
Import-Package: 

javax.el
javax.servlet
javax.servlet.descriptor
javax.servlet.http
javax.servlet.jsp
javax.servlet.jsp.el
javax.servlet.jsp.tagext
javax.tools
javax.xml.parsers
javax.xml.transform
javax.xml.transform.dom
javax.xml.transform.stream
javax.xml.validation
org.eclipse.jdt.core.compiler
org.eclipse.jdt.internal.compiler
org.eclipse.jdt.internal.compiler.classfmt
org.eclipse.jdt.internal.compiler.env
org.eclipse.jdt.internal.compiler.problem
org.w3c.dom
org.w3c.dom.ls
org.xml.sax
org.xml.sax.ext
org.xml.sax.helpers


Export-Package: 

org.apache.jasper
  uses:
    javax.servlet
    javax.servlet.jsp.tagext
    org.apache.jasper.compiler
    org.apache.jasper.runtime
    org.apache.jasper.servlet
org.apache.jasper.compiler
  uses:
    javax.el
    javax.servlet
    javax.servlet.jsp.tagext
    javax.tools
    org.apache.jasper
    org.apache.jasper.compiler.tagplugin
    org.apache.jasper.servlet
    org.xml.sax
org.apache.jasper.compiler.tagplugin
org.apache.jasper.resources
org.apache.jasper.runtime
  uses:
    javax.el
    javax.servlet
    javax.servlet.http
    javax.servlet.jsp
    javax.servlet.jsp.el
    javax.servlet.jsp.tagext
    org.apache.jasper
    org.glassfish.jsp.api
org.apache.jasper.security
org.apache.jasper.servlet
  uses:
    javax.servlet
    javax.servlet.descriptor
    javax.servlet.http
    javax.servlet.jsp.tagext
    org.apache.jasper
    org.apache.jasper.compiler
org.apache.jasper.tagplugins.jstl
  uses:
    org.apache.jasper.compiler.tagplugin
org.apache.jasper.xmlparser
  uses:
    org.apache.jasper
    org.apache.jasper.compiler
    org.w3c.dom
    org.xml.sax
org.glassfish.jsp.api
  uses:
    javax.servlet.jsp.tagext
--------------------------

As for 2), the differences between PDE and bnd are (I'm 100% certain on this) deficiencies in PDE when calculating imports.

(In reply to Thomas Watson from comment #1)
> Created attachment 221059 [details]
> possible fix

The patch created by Thomas contains additional imports (Ant, javax.annotation.*, javax.lang.model.*). The Jetty version doesn't seem to contain the ECJ compiler. I did use the download published by Jetty in Maven: http://mvnrepository.com/artifact/org.eclipse.jetty.orbit/org.apache.jasper.glassfish/2.2.2.v201112011158.
Comment 9 David Williams CLA 2015-01-12 17:12:17 EST
Thanks Gunnar, 

I'm not 100% convinced :) but also comparing to jetty's version would give different results, since they don't have embedded JDT. 

So ... what I'll do is take Tom's "possible fix" patch, and if/when anyone finds other issues, please open a new bug. 

Even though this is a "minor" bug, the change will be in Luna SR2, since it will be part of the "blocker" bug 442310.
Comment 10 David Williams CLA 2015-01-14 11:34:08 EST
I am "backing out" this fix, since it seems to cause trouble for consumers, by adding new dependencies. That should be avoided, especially in maintenance streams.
Comment 11 David Williams CLA 2016-08-11 15:22:58 EDT
Doing a mass "reset to default assignee" of 21 bugs to help make clear it will (very likely) not be me working on things I had previously planned to work on. I hope this will help prevent the bugs from "getting lost" in other people's queries. Feel free to "take" a bug if appropriate.
Comment 12 Marco Descher CLA 2017-03-23 05:29:08 EDT
It is also missing javax.servlet.jsp.resources as pointed out in https://java.net/projects/glassfish/lists/users/archive/2014-04/message/21

Overall ... i checked out the source in Neon.2 and there are several build errors

it is missing e.g. an import-package on 
* org.apache.tools.ant 
* org.apache.tools.ant.taskdefs
* org.apache.tools.ant.types

for org.apache.jasper.compiler.AntJavaCompiler to even compile!

Same goes for org.apache.jasper.runtime.PerThreadTagHandlerPool which misses the Tag class import!

What is the state of this?! I got this from Neon.2 and it has all this errors?!
Comment 13 Gunnar Wagenknecht CLA 2017-03-23 09:25:33 EDT
I'm not sure that anyone is actually looking at this. The issue isn't linked to any JSP related bug in Equinox. Thus, I think it's best to close it as "cannot do" unless someone shows up with a new recipe.
Comment 14 Marco Descher CLA 2017-03-23 09:53:54 EDT
I am not sure, whether such a bug report would be required. As described in https://www.eclipse.org/forums/index.php/t/1085156/ I was trying to get JSTL with JSP in osgi jetty up an running - and horribly failed after >10h of trying.

During my attempts, this was one of the things that seemed to just not fit?! So currently I am trying to get any information on whether anybody managed to use JSLT/JSP in osgi jetty at all!