Hi Aman,

> 3. Is the process under test still running when you execute the dump goal? - 
> No process is running during dump goal.

In this case the dump goal will not be able to connect. The dump tool is for 
advanced use cases only where the application under test is e.g. a long running 
server process.


> I just wanted to create a simple maven project which will execute single 
> JUnit classes and it is produce jacoco.exec and also execute jacoco:dump goal.

Then why do you want to use the dump goal? The standard behaviour of the JaCoCo 
agent is to write execution data to disc when the test JVM terminates.

Please see documentation which also includes such a simple example.

Regards,
-marc


> On 26. Sep 2023, at 05:10, Aman Singh Tomar <amansinghtomar2...@gmail.com> 
> wrote:
> 
> Hi Marc,
> 
> Answering to your questions below :
> 1. What exactly is the command line? Is the JaCoCo agent properly configured 
> here? -> In the command line agent is getting set but it is not coming up. 
> 2. Are there any log messages on stderr when the process starts? - No logs or 
> anything related to it.
> 3. Is the process under test still running when you execute the dump goal? - 
> No process is running during dump goal.
> 
> Not sure what exactly is happening or am  I missing.
> 
> I just wanted to create a simple maven project which will execute single 
> JUnit classes and it is produce jacoco.exec and also execute jacoco:dump goal.
> 
> Maybe you have some working project then I will look into that too.
> 
> Thanks and Regards
> 
> 
> 
> On Monday, September 25, 2023 at 10:13:54 PM UTC+5:30 Marc R. Hoffmann wrote:
> Hi Aman,
> 
> in this case you have to analyse the process under test. I would start with 
> the following questions:
> 
> 1) What exactly is the command line? Is the JaCoCo agent properly configured 
> here?
> 2) Are there any log messages on stderr when the process starts?
> 3) Is the process under test still running when you execute the dump goal?
> 
> Regards,
> -marc
> 
> 
> 
> 
> 
>> On 25. Sep 2023, at 18:39, Aman Singh Tomar <amansingh...@gmail.com 
>> <applewebdata://C07D0F19-3672-49C4-91C9-8D8E7066AF14>> wrote:
>> 
> 
>> Hi Marc,
>> 
>> So we are using this dump goal in CI. 
>> So earlier we were working on jdk 8 but when we migrated to jdk 17, this 
>> goal started failing.
>> 
>> so I am been struggling to find the root cause and to fix this .
>> 
>> Not sure what exactly is breaking it.
>> 
>> Thanks & Regards
>> 
>> On Monday, September 25, 2023 at 9:56:53 PM UTC+5:30 Marc R. Hoffmann wrote:
>> Hi Aman,
>> 
>> why do you think you need the dump goal? It is for advanced use cases only..
>> 
>> JaCoCo documentation comes with a basic, working example. I would recommend 
>> to start from there: https://www.jacoco.org/jacoco/trunk/doc/ 
>> <https://www.jacoco.org/jacoco/trunk/doc/>
>> 
>> Regards,
>> -marc
>> 
>> 
>>> On 25. Sep 2023, at 12:55, Aman Singh Tomar <amansingh...@gmail.com <>> 
>>> wrote:
>>> 
>> 
>>> Hi Marc, 
>>> Can you please suggest what shall I do to make it work ?
>>> 
>>> 
>>> On Monday, September 25, 2023 at 3:49:14 PM UTC+5:30 Aman Singh Tomar wrote:
>>> Hi,
>>> 
>>> Thanks for replying...
>>> 
>>> Can you please help me to identify why this jacoco agent is not running ?
>>> Am I missing something in configuration of jacoco ? or Do I need to attach 
>>> it to some lifecycle phase ?
>>> Or what exactly do I need to do in order to make it work ?
>>> 
>>> I am been struggling many weeks to figure out this.
>>> 
>>> Thanks in advance.
>>> 
>>> On Monday, September 25, 2023 at 2:01:14 PM UTC+5:30 Marc R. Hoffmann wrote:
>>> Hi,
>>> 
>>> this simply means there is no JaCoCo agent running on localhost port 36320 
>>> at the point in time when you try to generate the dump.
>>> 
>>> With linux tools like netstat -a you can get a list of all ports which are 
>>> currently bound.
>>> 
>>> Regards,
>>> -marc
>>> 
>>> 
>>> 
>>>> On 25. Sep 2023, at 09:48, Aman Singh Tomar <amansingh...@gmail.com <>> 
>>>> wrote:
>>>> 
>>> 
>>>> Hi Developers,
>>>> 
>>>> Can you please assist me on the below Jacoco maven plugin issue;
>>>> 
>>>> I am getting connection refused error during jacoco:dump goal.
>>>> 
>>>> Below is my pom file :
>>>> 
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <project xmlns="http://maven.apache.org/POM/4.0.0 
>>>> <http://maven.apache.org/POM/4.0.0>" 
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
>>>> <http://www.w3.org/2001/XMLSchema-instance>"
>>>> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
>>>> <http://maven.apache.org/POM/4.0.0> 
>>>> https://maven.apache.org/xsd/maven-4.0.0.xsd 
>>>> <https://maven.apache.org/xsd/maven-4.0.0.xsd>">
>>>> <modelVersion>4.0.0</modelVersion>
>>>> <parent>
>>>> <groupId>org.springframework.boot</groupId>
>>>> <artifactId>spring-boot-starter-parent</artifactId>
>>>> <version>3.1.3</version>
>>>> <relativePath/> <!-- lookup parent from repository -->
>>>> </parent>
>>>> <groupId>com.example</groupId>
>>>> <artifactId>jacoco</artifactId>
>>>> <version>0.0.1-SNAPSHOT</version>
>>>> <name>jacoco</name>
>>>> <description>jacoco</description>
>>>> <properties>
>>>> <java.version>17</java.version>
>>>> <jacoco.agent.argLine>-javaagent:/Users/tomara/.m2/repository/org/jacoco/org.jacoco.agent/0.8.10/org.jacoco.agent-0.8.10-runtime.jar=destfile=/Users/tomara/Documents/git/jacoco/target/jacoco.exec</jacoco.agent.argLine>
>>>> <jacoco.propertyName>coverageAgent</jacoco.propertyName>
>>>> <jacoco.destFile>${project.build.directory}/coverage.exec</jacoco.destFile>
>>>> <jacoco.append>false</jacoco.append>
>>>> <!-- 
>>>> <jacoco.exclClassLoaders>sun.reflect.DelegatingClassLoader:MyClassLoader</jacoco.exclClassLoaders>-->
>>>> <!-- <jacoco.inclBootstrapClasses>true</jacoco.inclBootstrapClasses>-->
>>>> <!-- <jacoco.inclNoLocationClasses>true</jacoco.inclNoLocationClasses>-->
>>>> <!-- <jacoco.sessionId>session</jacoco.sessionId>-->
>>>> <jacoco.dumpOnExit>true</jacoco.dumpOnExit>
>>>> <jacoco.output>file</jacoco.output>
>>>> <jacoco.address>localhost</jacoco.address>
>>>> <jacoco.port>36320</jacoco.port>
>>>> <jacoco.classDumpDir>${project.build.directory}/classdumps</jacoco.classDumpDir>
>>>> <!-- <jacoco.jmx>true</jacoco.jmx>-->
>>>> 
>>>> <jacoco.dataFile>${jacoco.destFile}</jacoco.dataFile>
>>>> 
>>>> 
>>>> </properties>
>>>> <dependencies>
>>>> <dependency>
>>>> <groupId>org.springframework.boot</groupId>
>>>> <artifactId>spring-boot-starter</artifactId>
>>>> </dependency>
>>>> 
>>>> <dependency>
>>>> <groupId>org.springframework.boot</groupId>
>>>> <artifactId>spring-boot-devtools</artifactId>
>>>> <scope>runtime</scope>
>>>> <optional>true</optional>
>>>> </dependency>
>>>> <dependency>
>>>> <groupId>org.springframework.boot</groupId>
>>>> <artifactId>spring-boot-starter-test</artifactId>
>>>> <scope>test</scope>
>>>> </dependency>
>>>> <dependency>
>>>> <groupId>org.ow2.asm</groupId>
>>>> <artifactId>asm</artifactId>
>>>> <version>9.5</version>
>>>> </dependency>
>>>> <dependency>
>>>> <groupId>org.ow2.asm</groupId>
>>>> <artifactId>asm-commons</artifactId>
>>>> <version>9.5</version>
>>>> </dependency>
>>>> <dependency>
>>>> <groupId>org.ow2.asm</groupId>
>>>> <artifactId>asm-tree</artifactId>
>>>> <version>9.5</version>
>>>> </dependency>
>>>> <dependency>
>>>> <groupId>org.ow2.asm</groupId>
>>>> <artifactId>asm-analysis</artifactId>
>>>> <version>9.5</version>
>>>> </dependency>
>>>> <dependency>
>>>> <groupId>org.ow2.asm</groupId>
>>>> <artifactId>asm-util</artifactId>
>>>> <version>9.5</version>
>>>> </dependency>
>>>> <!-- https://mvnrepository.com/artifact/org.jacoco/org.jacoco.cli 
>>>> <https://mvnrepository.com/artifact/org.jacoco/org.jacoco.cli> -->
>>>> <dependency>
>>>> <groupId>org.jacoco</groupId>
>>>> <artifactId>org.jacoco.cli</artifactId>
>>>> <version>0.8.10</version>
>>>> </dependency>
>>>> 
>>>> </dependencies>
>>>> 
>>>> <build>
>>>> <plugins>
>>>> <!-- Configure Surefire plugin for unit tests -->
>>>> <plugin>
>>>> <groupId>org.apache.maven.plugins</groupId>
>>>> <artifactId>maven-surefire-plugin</artifactId>
>>>> <version>3.0.0</version> <!-- Use a version compatible with JaCoCo 0.8.10 
>>>> -->
>>>> <configuration>
>>>> <argLine> ${coverageAgent}</argLine>
>>>> </configuration>
>>>> </plugin>
>>>> 
>>>> <!-- Configure Failsafe plugin for integration tests -->
>>>> <plugin>
>>>> <groupId>org.apache.maven.plugins</groupId>
>>>> <artifactId>maven-failsafe-plugin</artifactId>
>>>> <version>3.0.0</version> <!-- Use a version compatible with JaCoCo 0.8.10 
>>>> -->
>>>> <configuration>
>>>> <argLine> ${coverageAgent}</argLine>
>>>> </configuration>
>>>> </plugin>
>>>> <plugin>
>>>> <groupId>org.jacoco</groupId>
>>>> <artifactId>jacoco-maven-plugin</artifactId>
>>>> <version>0.8.8</version>
>>>> <executions>
>>>> <execution>
>>>> <goals>
>>>> <goal>prepare-agent</goal>
>>>> <goal>dump</goal>
>>>> </goals>
>>>> </execution>
>>>> </executions>
>>>> </plugin>
>>>> </plugins>
>>>> </build>
>>>> 
>>>> 
>>>> 
>>>> 
>>>> </project>
>>>> 
>>>>  And Below is the maven error :-
>>>> 
>>>>  --- jacoco-maven-plugin:0.8.8:dump (default) @ jacoco ---
>>>> [DEBUG] Loading mojo org.jacoco:jacoco-maven-plugin:0.8.8:dump from plugin 
>>>> realm ClassRealm[plugin>org.jacoco:jacoco-maven-plugin:0.8.8, parent: 
>>>> jdk.internal.loader.ClassLoaders$AppClassLoader@531d72ca]
>>>> [DEBUG] Configuring mojo execution 
>>>> 'org.jacoco:jacoco-maven-plugin:0.8.8:dump:default' with basic 
>>>> configurator -->
>>>> [DEBUG]   (f) address = localhost
>>>> [DEBUG]   (f) append = false
>>>> [DEBUG]   (f) destFile = 
>>>> /Users/tomara/Documents/git/jacoco/target/coverage.exec
>>>> [DEBUG]   (f) dump = true
>>>> [DEBUG]   (f) port = 36320
>>>> [DEBUG]   (f) project = MavenProject: com.example:jacoco:0.0.1-SNAPSHOT @ 
>>>> /Users/tomara/Documents/git/jacoco/pom.xml
>>>> [DEBUG]   (f) reset = false
>>>> [DEBUG]   (f) retryCount = 10
>>>> [DEBUG]   (f) skip = false
>>>> [DEBUG] -- end configuration --
>>>> [INFO] Connecting to localhost/127.0.0.1:36320 <http://127.0.0.1:36320/>
>>>> [INFO] Connection refused
>>>> [INFO] Connecting to localhost/127.0.0.1:36320 <http://127.0.0.1:36320/>
>>>> [INFO] Connection refused
>>>> [INFO] Connecting to localhost/127.0.0.1:36320 <http://127.0.0.1:36320/>
>>>> [INFO] Connection refused
>>>> [INFO] Connecting to localhost/127.0.0.1:36320 <http://127.0.0.1:36320/>
>>>> [INFO] Connection refused
>>>> [INFO] Connecting to localhost/127.0.0.1:36320 <http://127.0.0.1:36320/>
>>>> [INFO] Connection refused
>>>> 
>>>> 
>>>> Please help mates.... Not able to understand why this is happening
>>>> 
>>> 
>>>> -- 
>>>> 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 jacoco+un...@googlegroups.com <>.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/jacoco/6f96a049-153c-48bb-b418-cee6b4cb02c3n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/jacoco/6f96a049-153c-48bb-b418-cee6b4cb02c3n%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 jacoco+un...@googlegroups.com <>.
>> 
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/jacoco/4ece8884-6321-455b-870a-60597e681753n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/jacoco/4ece8884-6321-455b-870a-60597e681753n%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 jacoco+un...@googlegroups.com 
>> <applewebdata://C07D0F19-3672-49C4-91C9-8D8E7066AF14>.
> 
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jacoco/89c48d5f-57be-463f-b4c0-696beb163db3n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jacoco/89c48d5f-57be-463f-b4c0-696beb163db3n%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 jacoco+unsubscr...@googlegroups.com 
> <mailto:jacoco+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jacoco/4f4313eb-dc5e-475d-95bb-729524f6999cn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jacoco/4f4313eb-dc5e-475d-95bb-729524f6999cn%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 jacoco+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/6521A989-5FC1-49BA-A556-11D3AF1E0D30%40mountainminds.com.

Reply via email to