Software Defined Networking
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem when generating skeleton for version 2.3.5

 
SOLVED
Go to solution
Highlighted
Frequent Advisor

Problem when generating skeleton for version 2.3.5

Hello,

I've just upgraded from version 2.0 to version 2.3.5.
I notice it is NOW no more possible to DEPLOY application I created in my previous version, because library changed :(

For testing the version 2.3.5 I then reinstalled the new SDK (2.3.5) with the folwing command line:

./install-sdk

Then, I tried to generate a new skeleton.
However I obtained the following ERROR:

ci-17-119:bin admin$ ./gen-sdn-app /Users/admin/Documents/DataSerge/DEVELOPEMENT/HP/sdn-apps_2.3.5/dhcpsdnapp dhcpsdn unil DhcpSdn "DHCP SDN BUNDLE" "unil-ci" "gestion DHCP" dhcpsdn
./gen-sdn-app: line 22: [: -v: unary operator expected
Unsupported option /Users/admin/Documents/DataSerge/DEVELOPEMENT/HP/sdn-apps_2.3.5/dhcpsdnapp!
/tmp/sdn-app already exists!\n
./gen-sdn-app: line 54: [: -v: unary operator expected
Creating module /tmp/sdn-app/opo-bl...
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/hp/util/pgen/ProjectGenerator : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
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:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

Can you help me ?

 

5 REPLIES 5
Highlighted
Occasional Advisor

Re: Problem when generating skeleton for version 2.3.5

The newer version of the tool requires that you name the parameters

 

See below from the programming guide.

 

bin/gen-sdn-app --directory /dev/sdm-apps/health-monitor --template skeleton \ --app hm --company hp --subject Switch --app-name “Device Health Monitor” \ --company-name “Hewlett Packard” --description “Application for monitoring \ health of network devices.” --rest-path switches

 

 

Highlighted
Frequent Advisor

Re: Problem when generating skeleton for version 2.3.5

Hello, 

 

Even by naming parameters, I have the same kind of error.

 

ci-17-232:bin admin$ ./gen-sdn-app --directory "/Users/admin/Documents/DataSerge/DEVELOPEMENT/HP/sdn-apps_2.3.5/health-monitor" --template skeleton --app hm --company hp --subject Switch --app-name "Device Health Monitor" --company-name "Hewlett Packard" --description "Application for monitoring health of network devices." --rest-path switches
./gen-sdn-app: line 22: [: -v: unary operator expected
./gen-sdn-app: line 22: [: -v: unary operator expected
Unsupported option /Users/admin/Documents/DataSerge/DEVELOPEMENT/HP/sdn-apps_2.3.5/health-monitor!
./gen-sdn-app: line 54: [: -v: unary operator expected
Creating module /Users/admin/Documents/DataSerge/DEVELOPEMENT/HP/sdn-apps_2.3.5/health-monitor/opo-bl...
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/hp/util/pgen/ProjectGenerator : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
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:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
ci-17-232:bin admin$

 

 

As you can see, there is still some problem with options but also with class library "com/hp/util/pgen/ProjectGenerator"

An other idea ?

 

Regards, 

 

Serge

Highlighted
Trusted Contributor

Re: Problem when generating skeleton for version 2.3.5

Hello Serge,

The error “ Unsupported major.minor version 51.0”  is because the “jar” is compiled with  some version of java (e.g. JDK 1.7), and  you might be trying to run in some other java version(e.g. JDK 1.6 environment).

You can check the java version by following command

    java -version

This might show 1.6 version


To solve the problem please follow these steps
 1) sudo update-alternatives --config java  
Please select the no here which corresponds to java-7-openjdk-amd64
2) check java version now
java –version
it should show version 1.7

In case you don’t see java-7-openjdk-amd64  in step 1 ,then you have to first install the same by running the command as below
sudo apt-get install openjdk-7-jdk openjdk-7-jre

and then again repeat steps 1 & 2 as mentioned above.

Please let us know if this helps.

Thanks,
HP SDN Team

Highlighted
Frequent Advisor

Re: Problem when generating skeleton for version 2.3.5

Hello, 

 

It is a little better but not perfect yet.

 

First my SDK version was effectively the 1.6.

 

I've installed the 1.7:

 

Result:

 

java -version
    java version "1.7.0_67"
   Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
   Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

 

I tried to recreate the skeleton:

 

./gen-sdn-app --directory "/Users/admin/Documents/DataSerge/DEVELOPEMENT/HP/sdn-apps_2.3.5/health-monitor" --template skeleton --app hm --company hp --subject Switch --app-name "Device Health Monitor" --company-name "Hewlett Packard" --description "Application for monitoring health of network devices." --rest-path switches
./gen-sdn-app: line 22: [: -v: unary operator expected
./gen-sdn-app: line 22: [: -v: unary operator expected
Unsupported option /Users/admin/Documents/DataSerge/DEVELOPEMENT/HP/sdn-apps_2.3.5/health-monitor!
./gen-sdn-app: line 54: [: -v: unary operator expected
Creating module /Users/admin/Documents/DataSerge/DEVELOPEMENT/HP/sdn-apps_2.3.5/health-monitor/opo-bl...
Created /Users/admin/Documents/DataSerge/DEVELOPEMENT/HP/sdn-apps_2.3.5/health-monitor/opo-bl/opo.descriptor
Created /Users/admin/Documents/DataSerge/DEVELOPEMENT/HP/sdn-apps_2.3.5/health-monitor/opo-bl/pom.xml
Created /Users/admin/Documents/DataSerge/DEVELOPEMENT/HP/sdn-apps_2.3.5/health-monitor/opo-bl/src/main/java/com/hp/opo/
Created /Users/admin/Documents/DataSerge/DEVELOPEMENT/HP/sdn-apps_2.3.5/health-monitor/opo-bl/src/main/java/com/hp/opo/OnePingOnly.java

 

 

It is better than before but  the only directory that was created was:

 /Users/admin/Documents/DataSerge/DEVELOPEMENT/HP/sdn-apps_2.3.5/health-monitor/opo-bl/  

as you can see on the log above. This  strange strucutre contains different folder  and a java file called : OnePingOnly.java.

 

With the previous version (=HP SDN controler 2.0) I obtained a structure that contained different folder like: hm,  hm-api, hm-app, hm-bl, hm-root, ...

 

Why is it different ? 

Did my "gen-sdn-app" works correctly ?

 

 

 

 

 

Highlighted
Frequent Advisor
Solution

Re: Problem when generating skeleton for version 2.3.5

After modifiying your script, it works...

 

Thanks