Hi Marc,

When I ran for a specific maven project independently , things work fine. 
Only when I trigger from parent pom., agent is NOT writing to file (only 
one project have the jacoco.exec got generated).
Finally after "mvn test" got completed., I see this exception on console.

java.nio.channels.OverlappingFileLockException
        at sun.nio.ch.SharedFileLockTable.checkList(FileLockTable.java:255)
        at sun.nio.ch.SharedFileLockTable.add(FileLockTable.java:152)
        at sun.nio.ch.FileChannelImpl.lock(FileChannelImpl.java:1030)
        at java.nio.channels.FileChannel.lock(FileChannel.java:1053)
        at 
org.jacoco.agent.rt.internal_6da5971.output.FileOutput.openFile(FileOutput.java:69)
        at 
org.jacoco.agent.rt.internal_6da5971.output.FileOutput.writeExecutionData(FileOutput.java:53)
        at 
org.jacoco.agent.rt.internal_6da5971.Agent.shutdown(Agent.java:137)
        at org.jacoco.agent.rt.internal_6da5971.Agent$1.run(Agent.java:54)

It looks this is related to writeExecutionData exception. May be 
jacoco.exec's are NOT getting generated because of this exception !!!  Do 
you think this is the reason ? In what cases this exception occur ??

-Regards,
Kesav.

On Wednesday, October 19, 2016 at 11:19:01 PM UTC+5:30, Marc R. Hoffmann 
wrote:
>
> Hi, 
>
> there is a difference between how jacocoagent.jar is used: 
>
> - Java agent: jacoco.exec is generated in any case, even if no 
> instrumented class is executed 
> - Classpath: jacoco.exec is only generated when a isntrumented class has 
> been executed. 
>
> Maybe this makes the difference in your case? 
>
> As I wrote before: If jacoco is configured as a Java agent it already 
> ends up on the classpath. No need to add it again. 
>
> Regards, 
> -marc 
>
> On 2016-10-19 18:24, yajvane wrote: 
> > Hi Marc, 
> > 
> > 1] Able to add jacocoagent.jar (which was packed inside 
> > org.jacoco.agent-0.7.7.201606060606.jar) to class path & things went 
> > fine for a single project. "jacoco.exec" was getting generated. But, 
> > when I ran for a multi-module maven project., jacoco.exec was NOT 
> > getting generated for all modules. Only one of the module have the 
> > report got generated ( though configured jacoco-agent.properties with 
> > destfile and added that as part of class path !!!) . Any idea why 
> > jacocoagent.jar in classpath not able to generate jacoco.exec for all 
> > modules ?? 
> > 
> > 2] As jacoco.exec not getting generated for all modules while using 
> > jacocoagent.jar in classpath,  TRIED BOTH CLASSPATH OPTION AS WELL AS 
> > JAVA AGENT OPTION AT SAME TIME. In this case, I am able to see all 
> > jacoco.exec's got generated. Any harm using both classpath/javaagent 
> > option at same time ?? 
> > 
> > -Best Regards, 
> > 
> > Kesav. 
> > On Monday, October 17, 2016 at 5:14:28 PM UTC+5:30, Marc R. Hoffmann 
> > wrote: 
> > 
> >> Hi, 
> >> 
> >> the JaCoCo runtime needs to be accessible to by the executed 
> >> classes. One option is to put it on the application classpath, 
> >> another option is to configure the the JaCoC agent (all Java agents 
> >> are added to classpath). 
> >> 
> >> Typical pitfalls with offline instrumentations to check for: 
> >> 
> >> 1) The JaCoCo runtime must be the exact same version than the JaCoCo 
> >> instrumentation tool. 
> >> 2) The JaCoCo runtime classes must be visible to the classes under 
> >> test from a classloading perspective. This is typically only the 
> >> case for simple "main" applications. As soon as you run in 
> >> containers (J2EE, OSGi etc.) the application classpath might not be 
> >> visible to deployed components. 
> >> 
> >> Regards, 
> >> -marc 
> >> 
> >> On 17.10.16 09:55, yajvane wrote: 
> >> 
> >>> Hi, 
> >>> 
> >>> As per the documentation available at 
> >>> http://www.eclemma.org/jacoco/trunk/doc/offline.html [1] on "Using 
> >>> Pre-Instrumented Classes With the Java Agent' : 
> >>> 
> >>> "IT IS POSSIBLE to also use offline-instrumented classes with the 
> >>> JaCoCo Java agent. In this case the configuration is taken from 
> >>> the agent options. The agent must be configured in a way that 
> >>> pre-instrumented classes are excluded, e.g. with "excludes=*". 
> >>> Otherwise it will result in error messages on the console if the 
> >>> agent instruments such classes again." 
> >>> 
> >>> I tried with couple of maven projects and able to see that this 
> >>> (pre-instrumented classes with jacoco-maven-plugin:prepare-agent 
> >>> test) is working fine. But, in some projects this is NOT working 
> >>> and throwing an exception "Caused by: 
> >>> java.lang.ClassNotFoundException: 
> >>> org.jacoco.agent.rt.internal_6da5971.Offline" (I was following on 
> >>> this exception on separate thread). 
> >>> 
> >>> Please help me in understanding this ! In what scenarios it works 
> >>> and not works !!! Would request to please elaborate on the phrase 
> >>> "IT IS POSSIBLE..." 
> >>> 
> >>> I understand that offline instrumentation + placing 
> >>> jacocoagent.jar in class-path is the right way, but some how ., 
> >>> with whatever the possible maven (pom.xml) configuration ., that's 
> >>> always throwing exception. That's why trying to understand the 
> >>> things at more deeper level !!! 
> >>> 
> >>> Thank you !!! 
> >>> 
> >>> -Regards, 
> >>> Kesav. -- 
> >>> You received this message because you are subscribed to the Google 
> >>> Groups "JaCoCo and EclEmma Users" group. 
> >>> To unsubscribe from this group and stop receiving emails from it, 
> >>> send an email to [email protected]. 
> >>> To view this discussion on the web visit 
> >>> 
> >> 
> > 
> https://groups.google.com/d/msgid/jacoco/f85f8ef7-dbf6-4950-95d2-6d382e0995c6%40googlegroups.com
>  
> >>> [2]. 
> >>> For more options, visit https://groups.google.com/d/optout [3]. 
> > 
> >  -- 
> > You received this message because you are subscribed to the Google 
> > Groups "JaCoCo and EclEmma Users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to [email protected] <javascript:>. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/jacoco/0185e389-36dd-49f3-bfe6-f3bb247df4d7%40googlegroups.com
>  
> > [4]. 
> > For more options, visit https://groups.google.com/d/optout. 
> > 
> > 
> > Links: 
> > ------ 
> > [1] http://www.eclemma.org/jacoco/trunk/doc/offline.html 
> > [2] 
> > 
> https://groups.google.com/d/msgid/jacoco/f85f8ef7-dbf6-4950-95d2-6d382e0995c6%40googlegroups.com?utm_medium=email&amp;utm_source=footer
>  
> > [3] https://groups.google.com/d/optout 
> > [4] 
> > 
> https://groups.google.com/d/msgid/jacoco/0185e389-36dd-49f3-bfe6-f3bb247df4d7%40googlegroups.com?utm_medium=email&utm_source=footer
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/bed9bdc3-dce7-4ea7-8320-04aa822810ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to