Error when executing JPF from a java web application !

193 views
Skip to first unread message

naouar...@gmail.com

unread,
Apr 2, 2014, 10:37:35 AM4/2/14
to java-pa...@googlegroups.com
Hi all,

When i execute JPF from a java application it works fine , but when i try to do the same thing from a java Web app (exactly from a ManagedBean) it doesn't work although i use the same methode.

I call JPF like this : Process p =Runtime.getRuntime().exec("java -jar "+jpf_exe+" MiApp.jpf");
jpf_exe is a variable with jpf directory (C:/jpf-core/build/RunJPF.jar)
MiApp.jpf contains the target class and the arguments.

I'm using eclipse with java compiler 1.6 , java library jdk 7 and java_home jdk 7.

The error given when i execute my web app is the following:


  java.lang.UnsupportedClassVersionError: gov/nasa/jpf/tool/RunJPF : Unsupported major.minor version 51.0
  • at java.lang.ClassLoader.defineClass1(Native Method)
  • at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
  • at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
  • at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
  • at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
  • at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
  • at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
  • at java.security.AccessController.doPrivileged(Native Method)
  • at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
  • at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
  • at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
  • at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
  • Could not find the main class: gov.nasa.jpf.tool.RunJPF. Program will exit.
  • Exception in thread "main"
Any suggestion please?

Kasper Søe Luckow

unread,
Apr 2, 2014, 10:53:35 AM4/2/14
to java-pa...@googlegroups.com
Version 51.0 corresponds to j2se 7 and you need a JRE 7 to run it. Assuming you are running the web app from eclipse, my guess would be that the wrong JRE (e.g. 6) is set in the run configuration you are using. You can change that either explicitly to JRE 7 or to the project execution environment.
Out of curiosity; is there any particular reason why you are creating a process? You could just embed JPF in you application by instantiating a JPF object with the appropriate config and run it e.g.:
JPF jpf = new JPF(jpfConf);
jpf.addListener(aListener);
...
jpf.run();

Kasper


--

---
You received this message because you are subscribed to the Google Groups "Java™ Pathfinder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-pathfind...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

naouar...@gmail.com

unread,
Apr 2, 2014, 2:26:29 PM4/2/14
to java-pa...@googlegroups.com
Hi Kasper,

Thanks for answering !
I'm running jpf as a process because i think if i embed it in my application It'll run a VJM under another one so i don't know ...
regarding the error i uninstalled jdk6 i had in eclipse , so that was the problem. Now, i have another one
  • Exception in thread "main" ---------------------- JPF error stack trace ---------------------
  • JPF configuration error: error in C:\jpf-core\jpf.properties : property file does not exist: C:\glassfishv3\glassfish\domains\domain1\config\MiApp.jpf
  • at gov.nasa.jpf.Config.exception(Config.java:1098)
  • at gov.nasa.jpf.Config.loadProperties(Config.java:425)
  • at gov.nasa.jpf.Config.<init>(Config.java:218)
  • at gov.nasa.jpf.tool.RunJPF.main(RunJPF.java:88)
The jpf.properties exists in jpf-core , so i don't really understand why i have this error...
Any idea please?

Thanks in advance

Kasper Søe Luckow

unread,
Apr 2, 2014, 4:16:00 PM4/2/14
to java-pa...@googlegroups.com
jpf-core is essentially a jvm - I am not sure if I understand your answer, but if you embed jpf, it will run under the very same jvm as your (web) application. Anyway, it is your decision :)

The error you experience is not because the jpf.properties in jpf-core does not exist; it is because C:\glassfishv3\glassfish\domains\domain1\config\MiApp.jpf does not exist. I'm just guessing here, but you have probably hardcoded that path to the config_path property in the jpf.properties file.

Kasper

naouar...@gmail.com

unread,
Apr 3, 2014, 11:41:32 AM4/3/14
to java-pa...@googlegroups.com

I only want to do it easily for me :P
So you're right , i put my property file in the directory shown in the error C:\glassfishv3\glassfish\domains\domain1\config and it works fine!
 But i don't know why JPF search the property file there ... maybe because i didn't create the site.properties file ?

Actually i just created it like the following but JPF still search my property file in C:\glassfishv3\glassfish\domains\domain1\config :

# JPF site configuration

#### Change this to represent your actual path jpf #####
jpf.home = /Documents and Settings/Administrator/jpf       /***  i saved here my property file ***/

# can only expand system properties at this point
jpf-core = ${jpf.home}/jpf-core

# annotation properties extension
jpf-aprop = ${jpf.home}/jpf-aprop
extensions+=,${jpf-awt-shell}

# numeric extension
jpf-numeric = ${jpf.home}/jpf-numeric

# concurrent extension
#jpf-concurrent = ${jpf.home}/jpf-concurrent
#extensions+=,${jpf-concurrent}

jpf-shell = ${jpf.home}/jpf-shell

jpf-awt = ${jpf.home}/jpf-awt

jpf-awt-shell = ${jpf.home}/jpf-awt-shell

Any suggestion please?

Thanks!

jinjian...@gmail.com

unread,
Apr 24, 2017, 4:50:14 AM4/24/17
to Java™ Pathfinder

hi,Naouar
    I am a college student and right now I am required to build up a website which will use JPF to verify the java program uploaded by users, but after I clone the jpf I have no idea what is the next step I should do because I can't find a step by step tutorial for this kind of using JPF(JPF is complete new to me). I will use Java EE  to build this website. Could you give me some useful resource about it (I really need a STEP BY STEP tutorial because otherwise I will get lost in this tutorial since I don't know much about JPF)?

在 2014年4月2日星期三 UTC+8下午10:37:35,naouar...@gmail.com写道:
Reply all
Reply to author
Forward
0 new messages