BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
KSAS56
Fluorite | Level 6

I have downloaded and installed Anaconda and successfully ran below in the terminal from Jupyter Notebook:
pip install saspy

pip install sas-kernel

 

However when I tried to connect to SAS after
import os
import sys
import saspy

 

using:

sas = saspy.SASsession(cfgname = 'winlocal')

I am getting Java Error:

Java Error:
java.lang.NoClassDefFoundError: com/sas/services/connection/ConnectionFactoryException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
at java.lang.Class.getMethod0(Class.java:2774)
at java.lang.Class.getMethod(Class.java:1663)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: com.sas.services.connection.ConnectionFactoryException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 6 more
Exception in thread "main"

Subprocess failed to start. Double check your settings in sascfg_personal.py file.

----------------------------------------------------------------------------------------------------------------

I have read lots of posts and made sure below:
1.added the file sspiauth.dll to the Path variable
2. Below are in the sascfg.py file:

    SAS_config_names=['winlocal']
3.

cpW  =  "C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94472__prt__xx__sp0__1\\deploywiz\\sas.svc.connection.jar"
cpW += ";C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94472__prt__xx__sp0__1\\deploywiz\\log4j.jar"
cpW += ";C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94472__prt__xx__sp0__1\\deploywiz\\sas.security.sspi.jar"
cpW += ";C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94472__prt__xx__sp0__1\\deploywiz\\sas.core.jar"
cpW += ";C:\\ProgramData\\Anaconda3\\Lib\\site-packages\\saspy\\java\\saspyiom.jar"
winlocal = {'java'      : 'java',
            'encoding'  : 'windows-1252',
            'classpath' : cpW
            }

also I am not sure why "sascfg_personal.py" matters, I can't locate the sascfg_personal.py, but only modified sascfg.py

Can anyone help with the java error, thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
sastpw
SAS Employee

What version of Java do you have? The NoClassDefFoundError seems strange, if the jars you're using are from a real SAS 9.4 install, as it appears based upon the files in your classpath. BTW, you don't put the sspiauth.dll file itself in the path, but rather the directory it's in. Though, that doesn't appear to be the problem at this point.

Also, as for the sascfg_personal.py, that is so when you update saspy in the future, and the example sascfg.py file has been updated, it will overwrite the one you've editied. But sascfg_personal.py won't ever be replaced or messed with. https://sassoftware.github.io/saspy/install.html#sascfg-personal-py

 

So, what version of java, and can you confirm the jars you're pointing at are a SAS 9.4 install?

 

Thanks,

Tom

View solution in original post

3 REPLIES 3
sastpw
SAS Employee

What version of Java do you have? The NoClassDefFoundError seems strange, if the jars you're using are from a real SAS 9.4 install, as it appears based upon the files in your classpath. BTW, you don't put the sspiauth.dll file itself in the path, but rather the directory it's in. Though, that doesn't appear to be the problem at this point.

Also, as for the sascfg_personal.py, that is so when you update saspy in the future, and the example sascfg.py file has been updated, it will overwrite the one you've editied. But sascfg_personal.py won't ever be replaced or messed with. https://sassoftware.github.io/saspy/install.html#sascfg-personal-py

 

So, what version of java, and can you confirm the jars you're pointing at are a SAS 9.4 install?

 

Thanks,

Tom

KSAS56
Fluorite | Level 6
The Java was the issue, I have an old version of Java and I need the latest one for it to work properly, thanks!
sastpw
SAS Employee

Hey, that's great. Java 7 and 8 work best. In Java9, the Corba module, which IOM depends on isn't loaded by default, though it's still in there. You can see the workaround for the problem that causes here in #2 https://sassoftware.github.io/saspy/troubleshooting.html#classpath-problems

 

Java10 no longer ships that, so it won't work; saspy issue here https://github.com/sassoftware/saspy/issues/206

But, there is a working solution to that, in house. I don't know when that will be available though. I'll touch base with them again to see where they are with that. 

 

Thanks,

Tom

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1262 views
  • 1 like
  • 2 in conversation