Hi,

I'm running Maven 2 with the cobertura-maven-plugin 2.2 and
maven-surefire-plugin 2.4.3 which both uses cobertura 1.9. My build
machines are Linux SLSE 10 with a 2.6.16.53-0.16-bigsmp kernel, which
triggers a known bug in Cobertura where Java NIO and the 2.6.x kernel
doesn't work together over NFS mounted file systems,
http://cobertura.svn.sourceforge.net/viewvc/cobertura/branches/v1_9/cobe
rtura/cobertura/src/net/sourceforge/cobertura/util/FileLocker.java?view=
markup Line 126. As a workaround there is a system property called
cobertura.use.java.nio which disables the use of NIO in Cobertura,
however the cobertura-maven-plugin doesn't seam to forward this to
cobertura.

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <version>2.2</version>
        <configuration>
          <systemProperties>
            <property>
              <name>cobertura.use.java.nio</name>
              <value>false</value>
            </property>
          </systemProperties>
        </configuration>
      </plugin>

If I send in the parameter to maven-surefire-plugin in a similar way
then it works.

      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <systemProperties>
            <property>
              <name>net.sourceforge.cobertura.datafile</name>
              <value>target/cobertura/cobertura.ser</value>
            </property>
            <property>
              <name>cobertura.use.java.nio</name>
              <value>false</value>
            </property>
          </systemProperties>
        </configuration>
      </plugin>

The error.

Results :
Tests run: 8, Failures: 0, Errors: 0, Skipped: 0
---------------------------------------
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
net.sourceforge.cobertura.util.FileLocker.lock(FileLocker.java:124)
        at
net.sourceforge.cobertura.coveragedata.ProjectData.saveGlobalProjectData
(ProjectData.java:234)
        at
net.sourceforge.cobertura.coveragedata.SaveTimer.run(SaveTimer.java:31)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.IOException: No locks available
        at sun.nio.ch.FileChannelImpl.lock0(Native Method)
        at sun.nio.ch.FileChannelImpl.lock(FileChannelImpl.java:845)
        at java.nio.channels.FileChannel.lock(FileChannel.java:860)
        ... 8 more
---------------------------------------
Unable to get lock on
********************************************/target/cobertura/cobertura.
ser.lock: null
This is known to happen on Linux kernel 2.6.20.
Make sure cobertura.jar is in the root classpath of the jvm
process running the instrumented code.  If the instrumented code
is running in a web server, this means cobertura.jar should be in
the web server's lib directory.
Don't put multiple copies of cobertura.jar in different WEB-INF/lib
directories.
Only one classloader should load cobertura.  It should be the root
classloader.
---------------------------------------
[INFO] [cobertura:cobertura]
[INFO] Cobertura 1.9 - GNU GPL License (NO WARRANTY) - See COPYRIGHT
file
Cobertura: Loaded information on 4 classes.
Report time: 752ms

I would like to use both the plugins, to run the code non-instrumented
for unit testing and instrumented for code coverage. Is it possible to
workaround this problem in any other way or forward the
cobertura.use.java.nio to cobertura?

Thanks in advanced
-Andreas

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to