[
http://www.stripesframework.org/jira/browse/STS-389?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tim Fennell resolved STS-389.
-----------------------------
Resolution: Fixed
Fix Version/s: Release 1.5
Assignee: Tim Fennell
I believe this should be fixed by all the ResolverUtil changes that are made in
1.5. We're now *much* less dependent on the type of ClassLoader used - to the
point that we should support all well-behaved loaders. However, it's way too
much work to setup a JNLP Jetty instance to re-test this. Please re-open if
you can still produce this with the trunk code or the 1.5 beta when it comes
out in a few days.
> Stripes ActionResolver doesn't work with JNLPClassLoader in Jetty 6.1
> ---------------------------------------------------------------------
>
> Key: STS-389
> URL: http://www.stripesframework.org/jira/browse/STS-389
> Project: Stripes
> Issue Type: Improvement
> Components: ActionBean Dispatching
> Affects Versions: Release 1.4.3
> Environment: MacOSX; Windows XP with JDK 6.0
> Reporter: Sean Doyle
> Assignee: Tim Fennell
> Fix For: Release 1.5
>
>
> When attempting to load Stripes from inside Jetty which was in turn loaded
> via JNLP (Java Web Start) ResolverUtil generates errors of the following
> form:
> INFO [javawsApplicationMain] (Log.java:166) - Checking URL
> '/DDL/app/jsp-api.jar' for instances of
> net.sourceforge.stripes.action.ActionBean
> ERROR [javawsApplicationMain] (Log.java:144) - Could not search jar file
> '/DDL/app/jsp-api.jar' for implementations of
> net.sourceforge.stripes.action.ActionBeandue to an IOException:
> /DDL/app/jsp-api.jar (No such file or directory)
> [This is true of all jar files on the path]
> The main issue is that loadImplementationsInJar expects the location to be a
> file reference which is not available via the JNLPClassLoader. Instead -
> files are accessed in the cache via the URL.,
> A proposed fix follows (I know that this is all getting upgraded for 1.5 and
> will be cleaner than this):
> In loadImplementationsFromContextClassloader - add the following logic:
> // Only process the URL if it matches one of our filter strings
> if ( matchesAny(path, locationFilters) ) {
> log.info("Checking URL '", path, "' for instances of ",
> parentType.getName());
> if (location.isDirectory()) {
> loadImplementationsInDirectory(parentType, null,
> location);
> }
> else {
> if (path.indexOf("http")== -1)
> loadImplementationsInJar(parentType, null,
> path);
> else
> loadImplementationsInJNLPJar(parentType, null,
> url);
> }
> }
> and the new method loadImplementionsInJNLPJar is
> private void loadImplementationsInJNLPJar(Class<? extends T> parentType,
> InputStream inputStream,
> URL url) {
> try {
> JarEntry entry;
> HttpURLConnection httpConnection = (HttpURLConnection)
> url.openConnection();
> httpConnection.setDoOutput (true);
> httpConnection.setRequestMethod ("GET");
> httpConnection.connect();
>
>
> if (inputStream == null) inputStream =
> httpConnection.getInputStream();
> int code = httpConnection.getResponseCode ( ) ;
> if ( (code >= 200) && (code < 300 )) {
> JarInputStream jarStream = new JarInputStream(inputStream);
>
> while ( (entry = jarStream.getNextJarEntry() ) != null) {
> String name = entry.getName();
> if (!entry.isDirectory() && name.endsWith(".class")) {
> if (matchesAny(name, this.packageFilters)) {
> addIfAssignableTo(parentType, name);
> }
> }
> }
>
> }
> else{
> log.error("Unable to search url " + url + " for implementations
> of " +
> parentType.getName() + " due to http status
> code " + code +
> httpConnection.getResponseMessage());
> }
> }
> catch (IOException ioe) {
> log.error("Could not search url '", url, "' for implementations
> of ",
> parentType.getName(), "due to an IOException: ",
> ioe.getMessage());
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://www.stripesframework.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development