Menu
  • HOME
  • TAGS

WebSockets on DIY cartridge on OpenShift

Tag: websocket,glassfish,openshift,grizzly

I'm trying to build DIY application on OpenShift that implements WebSockets. I started with this example:

https://www.openshift.com/blogs/how-to-build-java-websocket-applications-using-the-jsr-356-api

If I run it locally, it works perfectly. When I upload the code to a DIY OpenShift cartridge and compile it, I get an error. I modified the code so that the Server connects to $OPENSHIFT_DIY_IP on port 8000, but when the code reaches the line server.start(); it crashes with the following error.

What am I doing wrong? I tried other ports (17500 and on) without any luck.

Error:

Binding server to 127.7.177.1:8000
Jun 04, 2014 10:28:02 AM org.glassfish.tyrus.server.ServerContainerFactory create
INFO: Provider class loaded: org.glassfish.tyrus.container.grizzly.GrizzlyEngine
java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:444)
at sun.nio.ch.Net.bind(Net.java:436)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.glassfish.grizzly.nio.transport.TCPNIOBindingHandler.bindToChannelAndAddress(TCPNIOBindingHandler.java:131)
at org.glassfish.grizzly.nio.transport.TCPNIOBindingHandler.bind(TCPNIOBindingHandler.java:87)
at org.glassfish.grizzly.nio.transport.TCPNIOBindingHandler.bind(TCPNIOBindingHandler.java:64)
at org.glassfish.grizzly.AbstractBindingHandler.bind(AbstractBindingHandler.java:140)
at org.glassfish.grizzly.AbstractBindingHandler.bind(AbstractBindingHandler.java:159)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.bind(TCPNIOTransport.java:470)
at org.glassfish.grizzly.http.server.NetworkListener.start(NetworkListener.java:658)
at org.glassfish.grizzly.http.server.HttpServer.start(HttpServer.java:264)
at org.glassfish.tyrus.container.grizzly.GrizzlyEngine$1.start(GrizzlyEngine.java:88)
at org.glassfish.tyrus.server.TyrusServerContainer.start(TyrusServerContainer.java:119)
at org.glassfish.tyrus.server.Server.start(Server.java:122)
at org.neo.wordgame.server.WebSocketServer.runServer(WebSocketServer.java:23)
at org.neo.wordgame.server.WebSocketServer.main(WebSocketServer.java:11)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
at java.lang.Thread.run(Thread.java:744)
Please press a key to stop the server.Jun 04, 2014 10:28:04 AM org.glassfish.tyrus.server.Server stop
INFO: Websocket Server stopped.

Best How To :

Your application needs to listen on port 8080 on your $OPENSHIFT_DIY_IP, but you need to connect to it from the outside at http://app-domain.rhcloud.com:8000 or http://app-domain.rhcloud.com:8443 (ssl). Binding to port 8000 on your $OPENSHIFT_DIY_IP won't work.

Wait for Websocket Rails event to finish in test environment

ruby-on-rails,selenium,rspec,websocket,capybara

I solved this by writing a helper method that accepts a block of code. The helper method records the current time, then adds a function to the ajax start event that records the time that the ajax started in a sessionStorage variable. I can then run the code block passed...

Best way redirect REST service request on glassfish + JAX-RS to https URL?

rest,glassfish,jax-rs

you could answer requests to http with 301 (Moved permanently, telling the client to use the new location in future requests) pointing to the https equivalent in the location header of the response.

Java-webservice: Glassfish3.0 error “org.codehaus.jackson.jaxrs.JacksonJsonProvider”

java,web-services,glassfish

I don't know your exact setup but the problem is that you are providing Jersey/Jackson 2.x libs but you are obviously using Jersey/Jackson 1.x. Note that Glassfish 3.x comes with Jersey/Jackson 1.x by default (Glassfish 4.x comes with Jersey/Jackson 2.x by default). The error message shows it can't find class...

Glassfish service throws an error

java-ee,netbeans,service,glassfish

So I have found the answer, I post it there in case someone does read this topic. I had to set another parameter to the glassfish conf, AS_JAVA, and give it the path to the JDK. I then got a 404 error. So I put my .war file in the...

asp.net 5 web application with websockets on Windows 7

websocket,signalr,asp.net-5

It's not possible... SignalR Supported Platforms for SignalR to use WebSockets, Windows Server 2012 or Windows 8 is required Does self hosted signalr require windows server 2012 in order to use websockets HTTP.SYS prior to Windows 8/2012 has no built in support for WebSockets, so although .NET 4.5 contains WebSocket...

Websocket SSL connection

javascript,node.js,ssl,websocket

The https module is rejecting your self-signed cert (as one would hope). You can force it to stop checking by passing a rejectUnauthorized: false option (which WebSocket will pass down to https): var ws = new WebSocket('wss://localhost:15449/', { protocolVersion: 8, origin: 'https://localhost:15449', rejectUnauthorized: false }); ...

How To find a WebSocket from a REST bean

rest,jboss,websocket

A Websocket connection starts with a HTTP handshake. On the handshake you also receive cookies (e.g. the session ID cookie) so you get access to the HTTP session. From the JSR 356 Java API for WebSocket spec: Because websocket connections are initiated with an http request, there is an association...

Exception in using appclient jar in EJB 3 :javax.ejb.EJBException: java.rmi.MarshalException:

java,java-ee,glassfish,ejb-3.0

it looks like your entity class is not serialize, implement Serializable interface in your Book class @Entity @NamedQuery(name = "findAllBooks", query = "select b from Book b") public class Book implements Serializable { @Id @GeneratedValue private long id; ... } hope it will help....

websocket + vuejs: screen flickering, visible mustache code

javascript,websocket,vue.js

Based on dandavis' comment, I added a "hidden" class (display: none) to the DOM, and v-class="hidden: !done", to toggle the visibility of the DOM. done is a key-value pair in the data of the ViewModel. HTML: <div class="message hidden" v-repeat="messages" v-class="hidden: !done">...</div> Javascript: onMessage: function (e) { new Vue({ el:...

Failed to send an email after migration from Glassfish 2.1 to Glassfish 4.1

java,glassfish,glassfish-4,httplistener,glassfish-4.1

On glassfish Instead of "Default-configuration" add Djava.net.preferIPv4Stack=true to server-config. I think it can fix your problem

python - When are WebSocketHandler and TornadoWebSocketClient completely deleted?

python,object,websocket,tornado,deletion

The WebSocket code currently contains some reference cycles, which means that objects are not cleaned up until the next full GC. Even worse, __del__ methods can actually prevent the deletion of an object (in python 3.3 and older: https://docs.python.org/3.3/library/gc.html#gc.garbage), so it's difficult to tell when things are actually getting deleted....

Persistent session in glassfish behind nginx proxy

java,session,nginx,proxy,glassfish

It helps if you post your NGINX proxy config. A basic reverse proxy config looks like this: ... http { .... server { listen 80; server_name www.yourdomain.com; location / { access_log off; proxy_pass http://127.0.0.1:8080; proxy_set_header Host $host; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; ... } .... } } ...

Displaying version and date of build in the xhtml page from manifest in run time

maven,glassfish,manifest,war

The correct resource name is /applications/ProjectName/META INF/MANIFEST.MF . Replace ProjectName with your project name. Updated the code according below: . . Enumeration resources = getClass().getClassLoader() .getResources("/applications/ProjectName/META INF/MANIFEST.MF"); . .

Websocket call timeout on Javascript Client

javascript,php,websocket

That specific server, PHP-Websockets, does not provide support for the wss:// protocol (secure connection, similar to https:// for HTTP traffic). Change the connection line to: socket = new WebSocket("ws://myurl.com:9000"); Alternatively, if you need TLS support, PHP-Websockets might not be the best server for you. I made the decision to not...

Tornado behind Nginx, should I use TCP nodelay config in python or nginx.conf?

nginx,tcp,websocket,tornado

In general, if you are using nodelay and proxies, you should turn it on at all levels to see any benefit. Otherwise any piece of the system that doesn't have nodelay will insert the delays you're trying to avoid. According to the nginx docs for tcp_nodelay, it applies only when...

Play: stop WebSocket actor in case of failure

scala,playframework,websocket,akka

Looking at the code of WebSocketActorSupervisor, which is where the Props is converted to actor, has default strategy overridden as override def supervisorStrategy = OneForOneStrategy() { case _ => SupervisorStrategy.Stop } So, Stop is the default behavior....

Meteor: Error during WebSocket handshake: Unexpected response code: 400

node.js,meteor,websocket

This can be caused by one of the three reasons: Some ISPs may use proxies which don't support websockets. This is more apparent over 3G networks If your app has crashed. Meteor tries to connect to the server and can't since it's not online. This can also happen if Nginx...

How to separately assign data to each connected user inside Socket.IO?

mysql,node.js,websocket,socket.io

There are ways to attach data to each socket in socket.io, but it's probably easier to put your data in an associative array, where the keys are the socket id's. Just create the key-value pair upon connection, and make sure you delete the pair on the disconnect event with the...

The most efficient notification system for a web application

node.js,websocket,notifications,xmpp

XMPP over websocket would be a good fit as it simply builds on your existing infrastructure.

File upload via h:inputfile (prettyfaces) does not work

jsf,file-upload,glassfish,jsf-2.2,prettyfaces

Found a sufficient solution, was posted here on stackoverflow.com before: Fileupload and PrettyFaces and JSF 2.2 Not pretty, but it works....

java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map

java,rest,deployment,glassfish,jersey

Ok looked at your issue. The External Glassfish v 3.1.2.2 that you are using is JAVA-EE 6 compatible. And the one through which you are running your app in eclipse is JAVA-EE 7 compatible. Have a look at both the java docs: Application class Java Doc for EE6 Application class...

Haxe server-client exchange on all platforms

sockets,websocket,client,server,haxe

What you are looking for is Haxe Remoting, which is part of the Standard Library Haxe remoting is a way to communicate between different platforms. With Haxe remoting, applications can transmit data transparently, send data and call methods between server and client side. relevant sources: http://haxe.org/manual/std-remoting.html http://api.haxe.org/haxe/remoting/ As side note,...

Creating a real-time chat with Python and websocket

python,websocket,chat,real-time

You need to use a websocket aware web server, like Tornado to handle websocket traffic. To multiplex chat messages between different chats and users, there are solutions like Redis and ZeroMQ that you can use for message multiplexing. However, it sounds like you have zero experience and starting point, so...

Change colour of Glassfish 3.1 Community Edition Domain Application Server

glassfish,glassfish-3

I didn't find an example but it looks like it is possible to change the layout of Glassfishs Admin UI via a so called integration-point which looks similar to this: <integration-point id="myOwnBrand" type="org.glassfish.admingui:customtheme" priority="2" content="myOwnBrand.properties" /> The Oracle docs for Changing the Theme or Brand of the Administration Console contains...

Play a PCM stream sampled at 16 kHz

websocket,web-audio,pcm

This is not a sample rate problem, because the AudioBufferSourceNode resamples the audio to the AudioContext's rate when playing. What you should do here, is to have a little queue of buffers you feed using the network, and then, play your buffers normally like you do, but from the buffer...

Debugging service test client: Netbeans debugger won't recognize Glassfish server

java,debugging,java-ee,netbeans,glassfish

Additional information relevant to the problem is that I was trying to get a test client working for the service. The problem turned out to be that I was simply adding another java class to the service package. The solution is: Create a new project. Add a new Web Service...

How to track 500 errors on WebSockets (ws://)

c#,asp.net,iis,websocket

The problem was with web.config. I added <httpRuntime targetFramework="4.5.1" /> to system.web section and it finally began to work...

Why I got so many connection events on Node's HTTP server?

javascript,node.js,http,websocket,socket.io

The connections you're logging from the HTTP server are to be expected and are related to the resources that are being used on your HTML pages (JS, CSS, images, favicon, etc). The port numbers you're logging are the client side port numbers. While not random, they will change for every...

Simple JavaEE HTML GET/POST application

java,java-ee,intellij-idea,glassfish,jax-rs

You need to configure Jersey (the JAX-RS implementation in Glassfish) in your web.xml. You currently only have JSF configuration <servlet> <servlet-name>jersey-serlvet</servlet-name> <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class> <init-param> <param-name>jersey.config.server.provider.packages</param-name> <param-value>the.package.where.your.resources.are</param-value> </init-param>...

Websocket (java ee) how to get role of current user

security,java-ee,websocket,wildfly

For this you will have to modify the Websocket handshake. You can do this as below: 1) Modify you websocket endpoint to use custom configurator @ServerEndpoint(value = "/someWSEndpoint", configurator = SomeCustomConfigurationClass.class) public class SomeWSService { ... } 2) Modify WS Handshake similar to public class SomeCustomConfigurationClass extends ServerEndpointConfig.Configurator { @Override...

Jetty Web Socket Timeout

javascript,sockets,websocket,jetty

From client side you are connecting to some web socket. If port (9995 in your case) is available to connect to then it means that some program (in server mode) is listening and responding. And does something - answers with some data. So, you can connect to such program if...

adding websockets to existing php application

php,ajax,node.js,websocket,socket.io

The approach that I would take is as follows: Problem: (restating to show my understanding) Notify clients when content is being edited to prevent conflicts. Hard requirements: Implemented using WebSockets -- for educational purposes. Assumptions: Sending the edited content will continue to be done via AJAX calls. Clients do not...

Faye Ruby Server Side Publish on Heroku - EventMachine buffer overflow detected

heroku,websocket,out-of-memory,publish-subscribe,faye

Ok, I realised the mistake. I was creating the client outside the EM.run block. Once i moved the initialization inside the EM.run block, everything was working fine....

@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) doesn't work

java,jpa,glassfish,ejb-3.0

deleteEmployee method is not wrapped into a new transaction because you are referencing method on this. What you can do is to inject reference to the facade itself and then call deleteEmployee method on it (it should be public). More or less something like this: @Stateless public class MyFacade {...

Why won't my JSF app deploy to GlassFish?

jsf,netbeans,glassfish

The problem was caused by a compile error in my code, which didn't show up until I did a complete "Clean and Build" ...and this couldn't be done until I shut-down the GlassFish server. Conclusion: If the problem occurs try shutting down the GlassFish server and doing a complete "Clean...

java.lang.NullPointerException at com.sun.ejb.codegen.EjbOptionalIntfGenerator.generateSubclass(EjbOptionalIntfGenerator.java:280)

java-ee,nullpointerexception,glassfish,ejb,subclass

I had written @Stateless over my interface of my service. That was the problem.

Websocket does not seem to connect

java,android,websocket

It seems the library for org.java_websocket.client.WebSocketClient is not available: The logcat messages Unable to resolve superclass of Lcom/example/chat/MainActivity$2; and java.lang.NoClassDefFoundError: com.example.chat.MainActivity$2 indicate that the anonymous class you are creating in this piece of code mWebSocketClient = new WebSocketClient(uri) { ... } Cannot be created, because the class definition for WebSocketClient...

socket io Websocket Disconnected Node js

javascript,node.js,express,websocket,socket.io

I'm going to bet that you have node inspect set to break on caught exceptions. Try unchecking "Pause On Caught Exceptions" near the right hand side of the debugger. Otherwise, you are likely using a 3rd party library that is using socket.io that is throwing this error....

How to defer reading until writing is done?

javascript,node.js,mongodb,websocket,socket.io

In a multiplayer game, you need to do important state logic on the server, or at least do some sort of state validation on the server side. You are only noticing this "hack" because it is easy to do. You have to design your multiplayer server to be resistant against...

How to improve nodejs / socket io performance?

javascript,node.js,performance,websocket,socket.io

You can actually improve performance in three ways : 1 - Reduce the size of instructions you send on the socket. You can achieve this by : Minimify your JSON Use MessagePack which is smaller than JSON 2 - Send just what you need. If you need to move the...

Flux and WebSockets

javascript,websocket,reactjs,flux

You should have a singleton module (not a store or an action creator) that handles opening the socket and directing traffic through. Then any action creator that needs to send/receive data via the socket just requires the module and makes use of its generic methods. Here's a quick and dirty...

websockets - reject a socket connection

node.js,sockets,websocket

You can either use socket.close() or socket.terminate() to close the connection.

Implementing multi user chat in iPad App

ios,websocket,xmpp,chat

I would not implement all of that on my own nor host the service myself. You should think about using an existing system for this. (I am not in any way affiliated with the next suggestions) I have used: firebase.com and parse.com Both should work for your usecase, but firebase...

Glassfish4 gzip encoding issue (corrupted responses)

java,glassfish,gzip

The reason is internal Glassfish issue. The solution could be found here. https://java.net/jira/browse/GRIZZLY-1535 Just download nucleus-grizzly-all.jar stop domain replace existing jar in glassfish\modules with downloaded one clear osgi-cache (just remove everything in glassfish\domains\YOUR_DOMAIN\osgi-cache\felix) start domain. ...

WebSocket connection failed: WebSocket opening handshake was canceled

javascript,amazon-web-services,amazon-ec2,websocket

There was an SSL certificate mismatch between the Haskell server and the Apache server. The Haskell server had to be rebuilt with information concerning the new certificates for the instance. Further complicating this the proper SSL library (libssl0.9.8 libssl-dev) was not installed on the EC2 instance which was causing me...

How to find servlet API version for glassfish server?

java,java-ee,servlets,glassfish

Look at Java EE version. Servlet (and JSP, JSF, EJB, JPA, etc) version goes hand in hand with Java EE version. Java EE 8 = Servlet 4.0 Java EE 7 = Servlet 3.1 Java EE 6 = Servlet 3.0 Java EE 5 = Servlet 2.5 J2EE 1.4 = Servlet 2.4...

How to listen to socket emit on sails.io.js?

angularjs,node.js,websocket,sails.js,sails.io.js

Following wZVanG's answer. This is how I did it, using the angular-sails angular module. $sails.get('/twitter/open').then(function(resp) { console.log(resp.status); }, function(resp) { alert('Houston, we got a problem!'); }); $sails.on('tweet', function(message) { console.log(message); }); That logs every tweet received to the browser's console....

PHP base64 encoding drops incorrect answer

php,websocket,base64

The function sha1() will already encode the hash value, so you should probably calculate the binary hash before encoding: $rawSha1Accept = sha1($rawAccept, true); // Note the second parameter $accept = base64_encode($rawSha1Accept); ...

When adding dependency: CDI deployment failure, Unsatisfied dependencies for type Set with qualifiers @Default

maven,twitter,glassfish,twitter4j,twitter-hbc

In Short: Use a newer version of Guava. Explanation I guess, you have Guava 14 or 15 on your class path. The class com.google.common.util.concurrent.ServiceManager contains an @Inject expecting a Set of services. This dependency is not available, and the container raises a DeploymentException. The solutions Use a newer Guava version...

Why does nodejs have incremental memory usage?

node.js,websocket

Seeing increased memory footprint by node.js application is completely normal behaviour. Node constantly analyses your running code, generates optimised code, reverts to unoptimised code (if needed) etc. All this requires quite a lot of memory even for the most simple of applications (Node.js itself is from a large part written...