Migration issue with coderunner: Could not initialize class sun.security.ssl...

I’m trying to migrate my backend code to version 4 but having trouble deploying. Coderunner runs fine when running from Coderunner.bat. However trying to deploy the code gives the following problem:




D:\dev\repositories\backendless\bin>Deploy.bat
Starting CodeRunner
[INFO] JDK from "JAVA_HOME" - C:\Program Files\Java\jdk1.8.0_101
[INFO] CodeRunner(tm) Backendless Debugging Utility
[INFO] Copyright(C) 2017 Backendless Corp. All rights reserved.
[INFO] Version: 4.0.b18 Build date: 2017-06-21T13:51:50Z
[INFO] CodeRunner session is running for 2 hours and will be terminated on 22:22:17.029[UTC]


[INFO] Parsing event model...
[INFO] Build successfully: 2 event handlers and 0 timers and 0 services
[WARN] IMPORTANT! The business logic code will be deployed to model "default".
Any business logic which is already deployed on the server in that model
will be removed and replaced with the code from your current project.
If this is an undesired behavior, stop now and set a different deployment model
either by using the -model argument or changing the model name in runner.properties.
Would you like to continue? (Y/N)
y
[INFO] Publishing 2 event handlers and 0 timers and 0 services to the server…
[ERROR] Could not initialize class sun.security.ssl.SSLContextImpl$DefaultSSLContext
javax.ws.rs.ProcessingException: Could not initialize class sun.security.ssl.SSLContextImpl$DefaultSSLContext
 at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:234)
 at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:655)
 at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:652)
 at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
 at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
 at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
 at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:424)
 at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:652)
 at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:412)
 at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:321)
 at com.backendless.coderunner.util.CodeRunnerUtil.publish(CodeRunnerUtil.java:130)
 at com.backendless.coderunner.debugger.BusinessLogicDebugger.publishEvents(BusinessLogicDebugger.java:197)
 at com.backendless.coderunner.debugger.BusinessLogicDebugger.publish(BusinessLogicDebugger.java:152)
 at com.backendless.coderunner.debugger.InstructionsFetcher.executeCommandSafe(InstructionsFetcher.java:30)
 at com.backendless.coderunner.LocalCodeRunner.start(LocalCodeRunner.java:68)
 at com.backendless.coderunner.CodeRunnerLoader.launch(CodeRunnerLoader.java:38)
 at com.backendless.coderunner.CodeRunnerLoader.main(CodeRunnerLoader.java:25)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class sun.security.ssl.SSLContextImpl$DefaultSSLContext
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Unknown Source)
 at java.security.Provider$Service.getImplClass(Unknown Source)
 at java.security.Provider$Service.newInstance(Unknown Source)
 at sun.security.jca.GetInstance.getInstance(Unknown Source)
 at sun.security.jca.GetInstance.getInstance(Unknown Source)
 at javax.net.ssl.SSLContext.getInstance(Unknown Source)
 at javax.net.ssl.SSLContext.getDefault(Unknown Source)
 at javax.net.ssl.SSLSocketFactory.getDefault(Unknown Source)
 at javax.net.ssl.HttpsURLConnection.getDefaultSSLSocketFactory(Unknown Source)
 at javax.net.ssl.HttpsURLConnection.<init>(Unknown Source)
 at sun.net.www.protocol.https.HttpsURLConnectionImpl.<init>(Unknown Source)
 at sun.net.www.protocol.https.Handler.openConnection(Unknown Source)
 at sun.net.www.protocol.https.Handler.openConnection(Unknown Source)
 at java.net.URL.openConnection(Unknown Source)
 at org.glassfish.jersey.client.HttpUrlConnectorProvider$DefaultConnectionFactory.getConnection(HttpUrlConnectorProvider.java:284)
 at org.glassfish.jersey.client.HttpUrlConnector._apply(HttpUrlConnector.java:257)
 at org.glassfish.jersey.client.HttpUrlConnector.apply(HttpUrlConnector.java:227)
 at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:225)
 ... 16 common frames omitted
[INFO] Debugging Utility disconnected successfully
[INFO] Thank you for using Backendless


D:\dev\repositories\backendless\bin>


Apperantly either the sun.securty class is not on the classpath or somehow a different version. Does anyone else have this problem and can point me in the right direction?
FYI I use gradle to build my classes:

version '1.0'


apply plugin: 'java'


sourceCompatibility = 1.8


repositories {
 mavenCentral()
}


sourceSets {
 main {
 java {
 srcDirs = ["src"]
 }
 output.classesDir = 'classes'
 }
}


dependencies {
 compile files('lib/backendless.jar')
 testCompile group: 'junit', name: 'junit', version: '4.11'
}




task copyToLib(type: Copy) {
 into "libs"
 from configurations.runtime
}


build.dependsOn(copyToLib)

Hi Peter,

I have not seen this one before. Could you please let me know what files you have in the following directories:?
D:\dev\repositories\backendless\classes
D:\dev\repositories\backendless\libs

Hi Mark,

./libs has: backendless.jar & servlet-api-2.5.jar which come from the downloaded 4.0 sample for my app.
./classes has my compiles class files (generated by gradle). Note that this did not change and worked for the 3.x version.

I’ve since updated my JDK from 101 to 131. since it was a bit old. Unfortunately, it did not fix the issue…

Does your code use any of the referenced SSL classes?

Let’s try this: open bin/runner.properties and make the following change (changing https:// to http://):

system.server.url = http://api.backendless.com

Please let me know if it helped.

Regards,
Mark

FYI: It works fine if I change the system.server.url to use http in stead of https. However, I don’t like having to change my key every time I upload :wink:

edit: Something about great minds? :wink:

My code uses no external libraries and nothing from the jdk using SSL either. It’s all pretty basic stuff and mostly backendless methods.

We will look into it. It appears to be a windows specific issue (does not show up on all machines).

For now if you keep the file with http://, you do not need to change it every time.

Regards,
Mark

I was talking about the secret key. I would not really like it if others would be able to upload code to my app! However, since it is a different key from the rest api. It’s not a big deal since the code does not change often.

If I find anything else I will let you know. Going to try purging my local gradle cache to see if that helps.

Perhaps this link might be helpful:

Not really, neither did purging the cache. I will just use the http version for now… I think i might migrate the code to a linux box and deploy from there in the future.

Do you see the same error when running “CodeRunner.bat deploy” instead of “Deploy.bat”?