sassoftware / saspy

A Python interface module to the SAS System. It works with Linux, Windows, and Mainframe SAS as well as with SAS in Viya.
https://sassoftware.github.io/saspy
Other
375 stars 149 forks source link

Windows 10 connection Java error. #160

Closed jnvickery closed 6 years ago

jnvickery commented 6 years ago

Hello,

Thanks in advance for any help. Saspy has been great to use! Since switching from Windows 7 to Windows 10, I have been unable to establish a saspy connection. Following the install instructions (https://sassoftware.github.io/saspy/install.html#installation) worked for my windows 7 machine but I can't seem to get thinks working on windows 10.

I have added "C:\Program Files\SASHome\SASFoundation\9.4\core\sasext" to my system path environment variable for the sspiauth.dll file: pathenviron

I have also added .DLL to the PATHEXT variable: pathext

sascfg_personal.py settings

# build out a local classpath variable to use below for Windows clients
cpW  =  "C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94492__prt__xx__sp0__1\\deploywiz\\sas.svc.connection.jar"
cpW += ";C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94492__prt__xx__sp0__1\\deploywiz\\log4j.jar"
cpW += ";C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94492__prt__xx__sp0__1\\deploywiz\\sas.security.sspi.jar"
cpW += ";C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94492__prt__xx__sp0__1\\deploywiz\\sas.core.jar"
cpW += ";C:\\Users\\jnvicker\\AppData\\Local\\Continuum\\anaconda3\Lib\\site-packages\\saspy\\java\\saspyiom.jar"

winlocal = {'java'      : 'java',
            'encoding'  : 'windows-1252',
            'classpath' : cpW
            }

Note: I have also tried adding the full path to java as follows:

winlocal = {'java'      : "C:\\ProgramData\\Oracle\\Java\\javapath\\java.exe",
            'encoding'  : 'windows-1252',
            'classpath' : cpW
            }

Here is the error that I am getting:

import saspy
sas = saspy.SASsession()
Using SAS Config named: winlocal
Java Error:
log4j:WARN No appenders could be found for logger (com.sas.services.connection).
log4j:WARN Please initialize the log4j system properly.
com.sas.services.connection.FatalConnectionFactoryException: The application could not log on to the server. The server process terminated unexpectedly with exit value 17.
    at com.sas.services.connection.ClusterEnvelope.getConnection(ClusterEnvelope.java:240)
    at com.sas.services.connection.AggregationKernel.doGetConnection(AggregationKernel.java:242)
    at com.sas.services.connection.ConnectionFactoryKernel.getConnection(ConnectionFactoryKernel.java:325)
    at com.sas.services.connection.ConnectionFactoryShell.getConnection(ConnectionFactoryShell.java:69)
    at com.sas.services.connection.ConnectionFactoryShell.getConnection(ConnectionFactoryShell.java:51)
    at pyiom.saspy2j.main(saspy2j.java:187)
Caused by: org.omg.CORBA.BAD_PARAM: The application could not log on to the server. The server process terminated unexpectedly with exit value 17.  vmcid: 0x0  minor code: 0  completed: No
    at com.sas.iom.orb.brg.Engine$4.run(Engine.java:3471)
    at java.lang.Thread.run(Unknown Source)

We failed in getConnection
The application could not log on to the server. The server process terminated unexpectedly with exit value 17.
Subprocess failed to start. Double check you settings in sascfg.py file.

Attempted to run program java with the following parameters:['java', '-classpath', 'C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94492__prt__xx__sp0__1\\deploywiz\\sas.svc.connection.jar;C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94492__prt__xx__sp0__1\\deploywiz\\log4j.jar;C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94492__prt__xx__sp0__1\\deploywiz\\sas.security.sspi.jar;C:\\Program Files\\SASHome\\SASDeploymentManager\\9.4\\products\\deploywiz__94492__prt__xx__sp0__1\\deploywiz\\sas.core.jar;C:\\Users\\jnvicker\\AppData\\Local\\Continuum\\anaconda3\\Lib\\site-packages\\saspy\\java\\saspyiom.jar', 'pyiom.saspy2j', '-host', 'localhost', '-stdinport', '52025', '-stdoutport', '52026', '-stderrport', '52027', '-zero', '-lrecl', '1048576', '']

If no Java Error above, try running the following command (where saspy is running) manually to see if it's a problem starting Java:
java -classpath "C:\Program Files\SASHome\SASDeploymentManager\9.4\products\deploywiz__94492__prt__xx__sp0__1\deploywiz\sas.svc.connection.jar;C:\Program Files\SASHome\SASDeploymentManager\9.4\products\deploywiz__94492__prt__xx__sp0__1\deploywiz\log4j.jar;C:\Program Files\SASHome\SASDeploymentManager\9.4\products\deploywiz__94492__prt__xx__sp0__1\deploywiz\sas.security.sspi.jar;C:\Program Files\SASHome\SASDeploymentManager\9.4\products\deploywiz__94492__prt__xx__sp0__1\deploywiz\sas.core.jar;C:\Users\jnvicker\AppData\Local\Continuum\anaconda3\Lib\site-packages\saspy\java\saspyiom.jar" pyiom.saspy2j -host localhost -stdinport 52025 -stdoutport 52026 -stderrport 52027 -zero -lrecl 1048576  

No SAS process attached. SAS process has terminated unexpectedly.
No SAS process attached. SAS process has terminated unexpectedly.
No SAS process attached. SAS process has terminated unexpectedly.

Thanks! John

tomweber-sas commented 6 years ago

@jnvickery The IOM error

The application could not log on to the server. The server process terminated unexpectedly with exit value 17.

is a bit of a catch all connection error. Even w/ the rc=17, I can't find any documented information about the rc's. I find SAS Notes with this error for Enterprise Miner, which uses the IOM client; so same errors. But the only rc's I find are 111 and 115 which sem to have to do with expired licenses. I'm guessing that's not your problem?

The one case that I know of that can sometimes cause this error is the SAS startup command in the Windows Registry being messed up. That case is documented in the troubleshooting guide; see the very end of this section - https://sassoftware.github.io/saspy/troubleshooting.html#iom

It looks like your configuration is correct, since you had this working previously, you know the things to do; sspiauth.dll path in PATH. classpath correct. That's really about all it takes. Can you check on the registry, per the info in Troubleshooting), just to see if that could be it? BTW, getting this error itself shows that java is coming up, the classpath is at least correct enough to find the saspyiom jar and the sas.connection jars, as it's getting to the point of starting up SAS. So that all looks good.

I've got a query in w/ Tech Support here to see if they know what the rc=17 means. Hopefully that can tell us what the specific issue is. Maybe they have that info internally, as I can't find it.

Thanks, Tom

jnvickery commented 6 years ago

Thank you @tomweber-sas ! My apologies for not following the troubleshooting docs closely enough. Navigating to C:\Program Files\SASHome\SASFoundation\9.4 and submitting the "sas.exe /regserver" worked. Note for anyone else that runs into this problem: I needed to run CMD as administrator.

tomweber-sas commented 6 years ago

Oh, that's great news. It's just hard to be sure what the problem is with IOM sometimes. I'm glad that turned out to be the problem, and the fix! I'll close this. Let me know if there's anything else. Thanks! Tom

nicole-peltier commented 2 years ago

Anyway to fix this problem without running CMD as administrator?

Thanks

tomweber-sas commented 2 years ago

This issue, from almost 4 years ago, was that the command in the registry, to start SAS, was corrupted somehow. That gets set when you install SAS. The /regserver option re-registers the command in the registry. If you can install software and update the registry w/out bein admin, then you could do this. I'm not sure what you can or can't do on your machine with what credentials you have.