WebsocketRegister Error

I am having a problem using the Websocket Extension. The RegisterWebsocket Function throws an error: ClassFormatError:net/twentyonesolutions/lucee/websocket/functions/WebsocketRegister : Unsupported major.minor version 52.0. I am running Lucee 5.1.3.18. I also have updated my version of Java to the most recent version. Does anyone have any ideas?

Your error message indicates that you are using the wrong Java version.

If you check the requirements at GitHub - isapir/lucee-websocket: Enables server WebSockets for Lucee via JSR-356 compliant servlet containers (e.g. Tomcat 8, Jetty 9.1, etc.) you will see that Java 8 is required.

Igal

Also note that the function RegisterWebsocket() has been deprecated in favor of WebsocketRegister() which takes the same arguments, so for the sake of future-proofing your code I recommend that you update it to reflect the new name.

See also WebsocketRegister Function · isapir/lucee-websocket Wiki · GitHub

Igal

Here is my Java setup, are these not the correct versions?

java version “1.8.0_121”
Java™ SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot™ 64-Bit Server VM (build 25.121-b13, mixed mode)

awesome, Thank you!

Are you sure? Can you show the result of

dump(Server.java)

?

Okay, so it appears Lucee is still using 1.7. Centos is showing 1.8 as installed. Is there a configuration somewhere in Lucee to point to it the correct Java version?

Yep, that explains it.

There is a configuration for that, yes, but it depends on your setup and is the subject for another topic. Please post a separate post for that.

Awesome. Thanks! I am excited to start working with WebSockets!

1 Like

Please let us know how you use WebSockets with Lucee. It will inspire others, and might give us ideas for improving the extension.

1 Like

Hi I encountered similar problem on Windows.

What can possibly be wrong?

This is my java setup.

Please paste the full stack trace.

Also, if you upgraded to the extension version 1.1.3.1 from a previous version, please restart the JVM (Tomcat, or whatever) in which Lucee runs.