Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cometd - websocket initialization returns NoClassDefFound error #1022

Closed
clemsongrad opened this issue Apr 14, 2021 · 8 comments
Closed

cometd - websocket initialization returns NoClassDefFound error #1022

clemsongrad opened this issue Apr 14, 2021 · 8 comments

Comments

@clemsongrad
Copy link

clemsongrad commented Apr 14, 2021

Hi,

We are using cometd 4.0.4 because we need to support older versions of android as well. When we attempt to run the client on android 6 for example (j5) we get the following error

Caused by java.lang.ClassNotFoundException
Didn't find class "java.time.format.DateTimeFormatter" on path: DexPathList[[zip file "/data/app/xyz-1/base.apk"],nativeLibraryDirectories=[xyz]]
org.eclipse.jetty.util.DateCache. (DateCache.java:150)
org.eclipse.jetty.util.DateCache. (DateCache.java:86)
org.eclipse.jetty.util.log.StdErrLog. (StdErrLog.java:121)
org.eclipse.jetty.util.log.Log.initStandardLogging (Log.java:209)
org.eclipse.jetty.util.log.Log.initialized (Log.java:188)
org.eclipse.jetty.util.log.Log.getLogger (Log.java:311)
org.eclipse.jetty.util.log.Log.getLogger (Log.java:301)
org.eclipse.jetty.util.ajax.JSON. (JSON.java:91)
org.cometd.common.JettyJSONContext. (JettyJSONContext.java:30)
org.cometd.common.JettyJSONContextClient. (JettyJSONContextClient.java:20)
org.cometd.client.transport.ClientTransport.init (ClientTransport.java:68)
org.cometd.websocket.client.common.AbstractWebSocketTransport.init (AbstractWebSocketTransport.java:80)
org.cometd.websocket.client.okhttp.OkHttpWebsocketTransport.init (OkHttpWebsocketTransport.java:70)
org.cometd.client.BayeuxClient.prepareTransport (BayeuxClient.java:995)
org.cometd.client.BayeuxClient.access$2200 (BayeuxClient.java:101)
org.cometd.client.BayeuxClient$SessionState.handshaking (BayeuxClient.java:1410)
org.cometd.client.BayeuxClient$SessionState.access$3800 (BayeuxClient.java:1285)
org.cometd.client.BayeuxClient.lambda$handshake$1 (BayeuxClient.java:300)
org.cometd.client.BayeuxClient.lambda$handshake$1$BayeuxClient (BayeuxClient.java)
org.cometd.client.-$$Lambda$BayeuxClient$CLSKPUuTd_14JUUoJP5L2VfPYks.run (-.java)
org.cometd.client.BayeuxClient$SessionState.process (BayeuxClient.java:1606)
org.cometd.client.BayeuxClient$SessionState.submit (BayeuxClient.java:1579)
org.cometd.client.BayeuxClient$SessionState.access$500 (BayeuxClient.java:1285)
org.cometd.client.BayeuxClient.handshake (BayeuxClient.java:300)
org.cometd.bayeux.client.ClientSession.handshake (ClientSession.java:69)
org.cometd.common.AbstractClientSession.handshake (AbstractClientSession.java)
org.cometd.bayeux.client.ClientSession.handshake (ClientSession.java:60)
org.cometd.common.AbstractClientSession.handshake (AbstractClientSession.java)

Is there any work around for this?

If we upgrade to 5.X of the cometd, it requires min API version of 26 (android 8) which effectively leaves older versions out.

Any help is greatly appreciated.

Thanks!

@sbordet
Copy link
Member

sbordet commented Apr 14, 2021

Support for Android is in CometD 3.1.x using Jetty 9.2.x, or CometD 5.0.x using the OkHttp transport.

Since CometD 4.0.x, like 5.0.x, requires Java 8 and Jetty 9.4.x, I would skip CometD 4.0.x entirely and move to CometD 5.0.x.
You'd have the java.time.format.DateTimeFormatter problem in both, so if you really need to support old Androids you need to downgrade to CometD 3.1.x.

@clemsongrad
Copy link
Author

@sbordet

Thank you for your quick response and insight. We will give it a try. Once again appreciate your help!!!

@sbordet
Copy link
Member

sbordet commented Nov 16, 2021

@clemsongrad is this issue solved for you?

@clemsongrad
Copy link
Author

@sbordet

Sadly no.

@sbordet
Copy link
Member

sbordet commented Nov 16, 2021

@clemsongrad have you tried to replace the standard Jetty logging with an SLF4J implementation that works on Android?

@clemsongrad
Copy link
Author

@sbordet

Yes indeed that is one of the suggestions we received. I do not recall on why that did not work. In the end we moved away from the project and did not see it finish.

@sbordet
Copy link
Member

sbordet commented Nov 16, 2021

This issue can be closed then?

@clemsongrad
Copy link
Author

Thank you @sbordet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants