JPF with Maven projects

239 views
Skip to first unread message

Xiaopeng Liu

unread,
Oct 27, 2016, 10:16:51 PM10/27/16
to Java™ Pathfinder
Hi I am new to use JPF. I could run all examples or simple verification.
I am using basic jpf-core for now.
While I try to involve JPF into my existing Maven projects unit test (JUnit usage), I meet the class not found error as below:

Executing command: java -jar E:\Git\jpf-core\build\RunJPF.jar +shell.port=4242 E:\git\XXXX.JiraConnector\jira-connector\ConnectorEntry.jpf 
JavaPathfinder core system v8.0 (rev 31+) - (C) 2005-2014 United States Government. All rights reserved.


====================================================== system under test
com.xxxxxxx.jiraConnector.JiraImporter.main()

====================================================== search started: 10/28/16 10:06 AM

====================================================== error 1
gov.nasa.jpf.vm.NoUncaughtExceptionsProperty
java.lang.ClassNotFoundException: class not found: com.xxxxxxx.ejvqa.LoggerManager.EJVLoggerHelper
at com.xxxxxxx.jiraConnector.JiraImporter.<clinit>(com/xxxxxxx/jiraConnector/JiraImporter.java:32)


====================================================== snapshot #1
thread java.lang.Thread:{id:0,name:main,status:RUNNING,priority:5,isDaemon:false,lockCount:0,suspendCount:0}
  owned locks:java.lang.Class@b0
  call stack:
at com.xxxxxxx.jiraConnector.JiraImporter.<clinit>(JiraImporter.java:32)

Note that the com.xxxxxxx.ejvqa.LoggerManager.EJVLoggerHelper is the jar dependency which I import from the remote JFrog server, which locally stored at C:/users/xxxx/.m2/repository/......

Should I some how add the maven repository into the classpath or ?

Much appreciate if some one could help

Best regards,
Xiaopeng

Xiaopeng Liu

unread,
Oct 27, 2016, 11:06:20 PM10/27/16
to Java™ Pathfinder
OK... I read another post about classpath.
Yes, it works if I add more classpath of the jar... but I've got dozens of dependencies, how could I involve all of them? one by one with a .m2 path arrrrrrrrrrrrrf :(
And the real problem is if my dependence is depends on another dependence, the JPF still fails.
For instance, my logger is a wrap of log4j2, I added all of the in the class path as :

+classpath=\
C:/Users/xxx/.m2/repository/com/xxxxxx/ejvqa/ejv-logger/1.1.1/ejv-logger-1.1.1.jar;\
C:/Users/xxx/.m2/repository/org/apache/logging/log4j/log4j-api/2.4/log4j-api-2.4.jar;\
C:/Users/xxx/.m2/repository/org/apache/logging/log4j/log4j-core/2.4/log4j-core-2.4.jar

forgive me, I am just trying...
and result:

====================================================== system under test
com.xxxx.jiraConnector.JiraImporter.main()

====================================================== search started: 10/28/16 10:57 AM

====================================================== error 1
gov.nasa.jpf.vm.NoUncaughtExceptionsProperty
java.lang.Error: java.lang.NoSuchFieldException: tid
at java.util.concurrent.locks.ReentrantReadWriteLock.<clinit>
at org.apache.logging.log4j.status.StatusLogger.<init>(org/apache/logging/log4j/status/StatusLogger.java:67)
at org.apache.logging.log4j.status.StatusLogger.<clinit>(org/apache/logging/log4j/status/StatusLogger.java:61)
at org.apache.logging.log4j.core.config.ConfigurationFactory.<clinit>(org/apache/logging/log4j/core/config/ConfigurationFactory.java:97)
at com.thomsonreuters.ejvqa.LoggerManager.EJVLoggerHelper.setLogger(com/thomsonreuters/ejvqa/LoggerManager/EJVLoggerHelper.java:29)
at com.thomsonreuters.jiraConnector.JiraImporter.<clinit>(com/thomsonreuters/jiraConnector/JiraImporter.java:32)
Caused by: java.lang.NoSuchFieldException: tid
at java.lang.Class.getDeclaredField(gov.nasa.jpf.vm.JPF_java_lang_Class)
at java.util.concurrent.locks.ReentrantReadWriteLock.<clinit>
at org.apache.logging.log4j.status.StatusLogger.<init>(org/apache/logging/log4j/status/StatusLogger.java:67)
at org.apache.logging.log4j.status.StatusLogger.<clinit>(org/apache/logging/log4j/status/StatusLogger.java:61)
at org.apache.logging.log4j.core.config.ConfigurationFactory.<clinit>(org/apache/logging/log4j/core/config/ConfigurationFactory.java:97)
at com.thomsonreuters.ejvqa.LoggerManager.EJVLoggerHelper.setLogger(com/thomsonreuters/ejvqa/LoggerManager/EJVLoggerHelper.java:29)
at com.thomsonreuters.jiraConnector.JiraImporter.<clinit>(com/thomsonreuters/jiraConnector/JiraImporter.java:32)


====================================================== snapshot #1
thread java.lang.Thread:{id:0,name:main,status:RUNNING,priority:5,isDaemon:false,lockCount:0,suspendCount:0}
  owned locks:java.lang.Class@b0,java.lang.Class@16b,java.lang.Class@189,java.lang.Class@306
  call stack:
at java.util.concurrent.locks.ReentrantReadWriteLock.<clinit>(pc 36)
at org.apache.logging.log4j.status.StatusLogger.<init>(StatusLogger.java:67)
at org.apache.logging.log4j.status.StatusLogger.<clinit>(StatusLogger.java:61)
at org.apache.logging.log4j.core.config.ConfigurationFactory.<clinit>(ConfigurationFactory.java:97)
at com.thomsonreuters.ejvqa.LoggerManager.EJVLoggerHelper.setLogger(EJVLoggerHelper.java:29)
at com.thomsonreuters.jiraConnector.JiraImporter.<clinit>(JiraImporter.java:32)


====================================================== results
error #1: gov.nasa.jpf.vm.NoUncaughtExceptionsProperty "java.lang.Error: java.lang.NoSuchFieldException: t..."

Xiaopeng Liu

unread,
Oct 30, 2016, 10:25:59 PM10/30/16
to Java™ Pathfinder
ok... I copied all dependencies with maven dependencies plugin.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
              <execution>
                <phase>install</phase>
                <goals>
                  <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.directory}/lib</outputDirectory>
                </configuration>
              </execution>
            </executions>
</plugin>



Then in jpf properties file I could add each jar file in classpath...
Jpuzzle.classpath =\
   ${Jpuzzle}/target/classes;\
   ${Jpuzzle}/target/lib/json-20140107.jar



HOWEVER, the *.jar does NOT work.....
Does anyone know how to add all jar files in a folder into classpath ?

grze...@gmail.com

unread,
Nov 22, 2016, 8:30:36 AM11/22/16
to Java™ Pathfinder
I see two solutions : 
-- plugin for maven which will generate .jpf file for given project (you will need to write it)
-- make a fat-jar with all dependencies, therefore you will get one jar to add to *.jpf



Cheers,


Grzesiek
Reply all
Reply to author
Forward
0 new messages