You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Martin Ellis <ma...@ellis.name> on 2010/04/26 16:51:30 UTC

Fileinstall does not create directory entries

Hi,

I've been looking into using fileinstall to deploy bundles from
target/classes.  For ordinary bundles, that works great.  For webapps
(using Pax WAR extender), I figured I'd use mvn war:inplace, and get
fileinstall to watch src/main/webapp.  And that *almost* works.

The problem I'm having is that the jar file created by fileinstall
doesn't include directory entries.

The Bundle-ClassPath header in the WAR MANIFEST.MF begins:
    Bundle-ClassPath: .,WEB-INF/classes,WEB-INF/lib/jstl-1.1.2.jar,...

Each Bundle-ClassPath entry is passed to
JarContent#getEntryAsContent(String entryName), which reads:
...
    ZipEntry ze = m_jarFile.getEntry(entryName);
    if ((ze != null) && ze.isDirectory()) {
...
http://svn.apache.org/repos/asf/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java

The second entry, "WEB-INF/classes/", doesn't exist in the JAR because
fileinstall doesn't create directory entries.  Hence, this ClassPath
entry is ignored.  However, this means that files that begin with this
path are ignored, which leads to a ClassNotFoundException.

I wondered whether it'd make more sense to change JarContent to handle
the directory even if the jar didn't contain an entry for the
directory specifically, but having read FELIX-1210, I'm not sure it's
so simple:  https://issues.apache.org/jira/browse/FELIX-1210

I've attached a patch that modifies fileinstall to create the
directory entries in the JAR, and checked that this is sufficient to
run webapps as described above.

Thoughts?

Regards,
Martin


Re: Fileinstall does not create directory entries

Posted by Guillaume Nodet <gn...@gmail.com>.
I think fileinstall should generate correct jars including the directory
entries.  Please raise a JIRA as Richard said and I'll handle it asap.  If
you can provide a patch, it would be even better (and faster).

On Mon, Apr 26, 2010 at 16:51, Martin Ellis <ma...@ellis.name> wrote:

> Hi,
>
> I've been looking into using fileinstall to deploy bundles from
> target/classes.  For ordinary bundles, that works great.  For webapps
> (using Pax WAR extender), I figured I'd use mvn war:inplace, and get
> fileinstall to watch src/main/webapp.  And that *almost* works.
>
> The problem I'm having is that the jar file created by fileinstall
> doesn't include directory entries.
>
> The Bundle-ClassPath header in the WAR MANIFEST.MF begins:
>    Bundle-ClassPath: .,WEB-INF/classes,WEB-INF/lib/jstl-1.1.2.jar,...
>
> Each Bundle-ClassPath entry is passed to
> JarContent#getEntryAsContent(String entryName), which reads:
> ...
>    ZipEntry ze = m_jarFile.getEntry(entryName);
>    if ((ze != null) && ze.isDirectory()) {
> ...
>
> http://svn.apache.org/repos/asf/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java
>
> The second entry, "WEB-INF/classes/", doesn't exist in the JAR because
> fileinstall doesn't create directory entries.  Hence, this ClassPath
> entry is ignored.  However, this means that files that begin with this
> path are ignored, which leads to a ClassNotFoundException.
>
> I wondered whether it'd make more sense to change JarContent to handle
> the directory even if the jar didn't contain an entry for the
> directory specifically, but having read FELIX-1210, I'm not sure it's
> so simple:  https://issues.apache.org/jira/browse/FELIX-1210
>
> I've attached a patch that modifies fileinstall to create the
> directory entries in the JAR, and checked that this is sufficient to
> run webapps as described above.
>
> Thoughts?
>
> Regards,
> Martin
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Re: Fileinstall does not create directory entries

Posted by Guillaume Nodet <gn...@gmail.com>.
Thx, just committed your patch.

On Mon, Apr 26, 2010 at 17:31, Martin Ellis <el...@gmail.com> wrote:

> On 26 April 2010 16:02, Richard S. Hall <he...@ungoverned.org> wrote:
> > I think your patch was stripped...probably better to create an issue and
> > attach the patch...I guess I didn't realize File Install was creating JAR
> > files...
>
> It creates JAR files when deploying 'Exploded Bundles'.
> They're created under /tmp/fileinstall-XXX/... (presumably java.io.tmpdir).
>
> The patch is trivial: -1 +3 lines.  See:
> https://issues.apache.org/jira/browse/FELIX-2302
>
> Cheers,
> Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Re: Fileinstall does not create directory entries

Posted by Martin Ellis <el...@gmail.com>.
On 26 April 2010 16:02, Richard S. Hall <he...@ungoverned.org> wrote:
> I think your patch was stripped...probably better to create an issue and
> attach the patch...I guess I didn't realize File Install was creating JAR
> files...

It creates JAR files when deploying 'Exploded Bundles'.
They're created under /tmp/fileinstall-XXX/... (presumably java.io.tmpdir).

The patch is trivial: -1 +3 lines.  See:
https://issues.apache.org/jira/browse/FELIX-2302

Cheers,
Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Fileinstall does not create directory entries

Posted by "Richard S. Hall" <he...@ungoverned.org>.
I think your patch was stripped...probably better to create an issue and 
attach the patch...I guess I didn't realize File Install was creating 
JAR files...

Regarding FELIX-1210, I am going to look into that issue for the next 
major framework release, so we'll see if I can come up with a reasonable 
solution.

-> richard

On 4/26/10 10:51, Martin Ellis wrote:
> Hi,
>
> I've been looking into using fileinstall to deploy bundles from
> target/classes.  For ordinary bundles, that works great.  For webapps
> (using Pax WAR extender), I figured I'd use mvn war:inplace, and get
> fileinstall to watch src/main/webapp.  And that *almost* works.
>
> The problem I'm having is that the jar file created by fileinstall
> doesn't include directory entries.
>
> The Bundle-ClassPath header in the WAR MANIFEST.MF begins:
>      Bundle-ClassPath: .,WEB-INF/classes,WEB-INF/lib/jstl-1.1.2.jar,...
>
> Each Bundle-ClassPath entry is passed to
> JarContent#getEntryAsContent(String entryName), which reads:
> ...
>      ZipEntry ze = m_jarFile.getEntry(entryName);
>      if ((ze != null)&&  ze.isDirectory()) {
> ...
> http://svn.apache.org/repos/asf/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java
>
> The second entry, "WEB-INF/classes/", doesn't exist in the JAR because
> fileinstall doesn't create directory entries.  Hence, this ClassPath
> entry is ignored.  However, this means that files that begin with this
> path are ignored, which leads to a ClassNotFoundException.
>
> I wondered whether it'd make more sense to change JarContent to handle
> the directory even if the jar didn't contain an entry for the
> directory specifically, but having read FELIX-1210, I'm not sure it's
> so simple:  https://issues.apache.org/jira/browse/FELIX-1210
>
> I've attached a patch that modifies fileinstall to create the
> directory entries in the JAR, and checked that this is sufficient to
> run webapps as described above.
>
> Thoughts?
>
> Regards,
> Martin
>
>    
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org