AnsweredAssumed Answered

Class Not found exception java.lang.ClassNotFoundException: com.osisoft.jdbc.Driver

Question asked by kjelavankal on Jan 12, 2015
Latest reply on Jul 19, 2018 by rishkyjohn

Hi All,

 

I was able to teats a java code that connects to some PI servers and gets data on my PC .

 

I am now trying to deploy my java code to our test server . I installed the following softwares  on the test server

 

a) OSI Prerequiste Kit

b) PI OLEDB-Enetrprise software

c) PI sql Data access server

d) PI JDBC

 

I setup connections to the different PI servers

 

I was able to connect through PIOLEDBTester.exe and run my queries and get data back from PI servers.

 

I verified that a class path is setup on the server . It has the value of C:\Program Files\PIPC\JDBC\PIJDBCDriver.jar;.

 

I added the PIJDBCDriver.jar file to my project library and deployed the  code. I verified that the Driver file is included on my project jar file .

 

When i run my code on the server i get the following error 

 

java.lang.ClassNotFoundException: com.osisoft.jdbc.Driver

 

 

My code

          String driver = "com.osisoft.jdbc.Driver";

          Properties plist = new Properties();

          plist.put("user",prop.getProperty("PIUN"));

          plist.put("password",prop.getProperty("PIPW"));  

          System.out.println("DATA COLLECTION: Connect to PI" );

          Class.forName(driver).newInstance();    

          conn = DriverManager.getConnection(connectionString,plist);


I am getting the error at the line " Class.forName(driver).newInstance();     "

 

Java Error

 

java.lang.ClassNotFoundException: com.osisoft.jdbc.Driver

01/12/2015 11:40:37 -  at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

01/12/2015 11:40:37 -  at java.security.AccessController.doPrivileged(Native Method)

01/12/2015 11:40:37 -  at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

01/12/2015 11:40:37 -  at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

01/12/2015 11:40:37 -  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

01/12/2015 11:40:37 -  at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

01/12/2015 11:40:37 -  at java.lang.Class.forName0(Native Method)

01/12/2015 11:40:37 -  at java.lang.Class.forName(Class.java:169)

 

Any help will be highly appreciated.

 

Thanks

Kiran

Outcomes