Axon.ivy 7.0 - the Digital Business Platform - is out now...

Hi ivyTeam

I need to have a WebSocket in an ivyProject. I thought about using Primefaces Push Endpoints for this. I know about this solution for ivy 4.x and 5.x but this doesn't seem to work anymore. I get the following errors and no endpoints are available:

13:56:58.687 WARN [org.atmosphere.cpr.AsynchronousProcessor] [http-nio-8081-exec-3] [requestId=3] 
  Websocket protocol not supported
13:57:09.974 WARN [org.apache.catalina.loader.WebappClassLoaderBase] [localhost-startStop-2] [] 
  The web application [ivy] appears to have started a thread named [Atmosphere-Scheduler-4] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
   sun.misc.Unsafe.park(Native Method)
   java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
   java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
   java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.poll(ScheduledThreadPoolExecutor.java:1134)
   java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.poll(ScheduledThreadPoolExecutor.java:809)
   java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1066)
   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
   java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   java.lang.Thread.run(Thread.java:745)
13:57:09.975 WARN [org.apache.catalina.loader.WebappClassLoaderBase] [localhost-startStop-2] [] 
  The web application [ivy] appears to have started a thread named [Atmosphere-Scheduler-5] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
   sun.misc.Unsafe.park(Native Method)
   java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
   java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
   java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.poll(ScheduledThreadPoolExecutor.java:1129)
   java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.poll(ScheduledThreadPoolExecutor.java:809)
   java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1066)
   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
   java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   java.lang.Thread.run(Thread.java:745)
13:57:46.830 WARN [] [main] [executionContext=SYSTEM] 
  the logger can't be the child of org.eclipse.birt
13:59:28.618 WARN [org.atmosphere.cpr.DefaultAsyncSupportResolver] [http-nio-8081-exec-2] [requestId=1] 
  Found multiple containers, please specify which one to use: org.atmosphere.container.Tomcat7CometSupport, org.atmosphere.container.TomcatCometSupport,  until you do, Atmosphere will use:class org.atmosphere.container.Tomcat7CometSupport
13:59:28.638 ERROR [org.primefaces.push.PushServlet] [http-nio-8081-exec-2] [requestId=1] 
  No Annotated class using @PushEndpoint found. Push will not work.
13:59:28.664 WARN [org.atmosphere.cpr.AsynchronousProcessor] [http-nio-8081-exec-2] [requestId=1] 
  Websocket protocol not supported
14:02:04.718 WARN [org.apache.catalina.loader.WebappClassLoaderBase] [localhost-startStop-2] [] 
  The web application [ivy] appears to have started a thread named [Atmosphere-Scheduler-0] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
   sun.misc.Unsafe.park(Native Method)
   java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
   java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
   java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.poll(ScheduledThreadPoolExecutor.java:1134)
   java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.poll(ScheduledThreadPoolExecutor.java:809)
   java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1066)
   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
   java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   java.lang.Thread.run(Thread.java:745)
14:02:04.720 WARN [org.apache.catalina.loader.WebappClassLoaderBase] [localhost-startStop-2] [] 
  The web application [ivy] appears to have started a thread named [Atmosphere-Scheduler-6] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
   sun.misc.Unsafe.park(Native Method)
   java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
   java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
   java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.poll(ScheduledThreadPoolExecutor.java:1129)
   java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.poll(ScheduledThreadPoolExecutor.java:809)
   java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1066)
   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
   java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   java.lang.Thread.run(Thread.java:745)
14:03:26.818 WARN [] [main] [executionContext=SYSTEM] 
  the logger can't be the child of org.eclipse.birt
14:04:38.170 WARN [org.atmosphere.cpr.DefaultAsyncSupportResolver] [http-nio-8081-exec-2] [requestId=2] 
  Found multiple containers, please specify which one to use: org.atmosphere.container.Tomcat7CometSupport, org.atmosphere.container.TomcatCometSupport,  until you do, Atmosphere will use:class org.atmosphere.container.Tomcat7CometSupport
14:04:38.189 ERROR [org.primefaces.push.PushServlet] [http-nio-8081-exec-2] [requestId=2] 
  No Annotated class using @PushEndpoint found. Push will not work.
14:04:38.209 WARN [org.atmosphere.cpr.AsynchronousProcessor] [http-nio-8081-exec-2] [requestId=2] 
  Websocket protocol not supported
14:09:54.778 WARN [org.apache.catalina.loader.WebappClassLoaderBase] [localhost-startStop-2] [] 
  The web application [ivy] appears to have started a thread named [Atmosphere-Scheduler-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
   sun.misc.Unsafe.park(Native Method)
   java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
   java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
   java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.poll(ScheduledThreadPoolExecutor.java:1134)
   java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.poll(ScheduledThreadPoolExecutor.java:809)
   java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1066)
   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
   java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   java.lang.Thread.run(Thread.java:745)
14:09:54.779 WARN [org.apache.catalina.loader.WebappClassLoaderBase] [localhost-startStop-2] [] 
  The web application [ivy] appears to have started a thread named [Atmosphere-Scheduler-11] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
   sun.misc.Unsafe.park(Native Method)
   java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
   java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
   java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.poll(ScheduledThreadPoolExecutor.java:1129)
   java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.poll(ScheduledThreadPoolExecutor.java:809)
   java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1066)
   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
   java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   java.lang.Thread.run(Thread.java:745)
14:10:30.830 WARN [] [Worker-0] [executionContext=SYSTEM] 
  the logger can't be the child of org.eclipse.birt

Here's what I added to the web.xml:

  <servlet>
        <servlet-name>Push Servlet</servlet-name>
        <servlet-class>org.primefaces.push.PushServlet</servlet-class>
        <async-supported>true</async-supported>
        <init-param>
            <param-name>org.atmosphere.useWebSocketAndServlet3</param-name>
            <param-value>true</param-value>
        </init-param>
        <init-param>
            <param-name>org.atmosphere.websocket.suppressJSR356</param-name>
            <param-value>true</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>Push Servlet</servlet-name>
        <url-pattern>/primepush/*</url-pattern>
    </servlet-mapping>

And what I added to the webapps/ivy/WEB-INF/lib directory:

atmosphere-runtime-native-2.4.14.jar
atmosphere-compat-tomcat-2.0.1.jar
atmosphere-compat-jbossweb-2.0.1.jar
atmosphere-compat-tomcat7-2.0.1.jar

I saw that you implemented a websocket for the chat feature in the Portal (XIVY-519) so it should still work. But in the Portal project, the atmosphere jar is directly in the project so the old way in the question linked above probably doesn't work anymore...

TLDR; Could you give me a hint how I can create my own WebSocket endpoints in ivy 6.x?

asked 31.08 at 08:55

Lars%20Tuchel's gravatar image

Lars Tuchel
2664813
accept rate: 60%

edited 31.08 at 09:27

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
5.9k11033


Sounds like you do not have any accessible endpoints:

14:04:38.189 ERROR [org.primefaces.push.PushServlet] [http-nio-8081-exec-2] [requestId=2] 
  No Annotated class using @PushEndpoint found. Push will not work.
14:04:38.209 WARN [org.atmosphere.cpr.AsynchronousProcessor] [http-nio-8081-exec-2] [requestId=2] 
  Websocket protocol not supported

classes with push endpoints must be copied to /webapps/ivy/web-inf/classes or jared into /webapps/ivy/web-inf/lib. so you have no convenient way to use push with ivyProjects.

Another thing to mention. Push will not work if you will use a IIS as SSO provider.

link

answered 31.08 at 09:31

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
5.9k11033
accept rate: 68%

Right, should have paid more attention to the linked page :/ The No Annotated class using... is gone now but the Websocket protocol not supported is still there and the client gets a 501 when trying to connect to the socket.

(01.09 at 05:30) Lars Tuchel Lars%20Tuchel's gravatar image

14:04:38.170 WARN [org.atmosphere.cpr.DefaultAsyncSupportResolver] [http-nio-8081-exec-2] [requestId=2] Found multiple containers, please specify which one to use: org.atmosphere.container.Tomcat7CometSupport, org.atmosphere.container.TomcatCometSupport, until you do, Atmosphere will use:class org.atmosphere.container.Tomcat7CometSupport

I think you should set the implementation to use in the web.xml. But I do not know the parameter. But Tomcat7Comet will for sure not work. Now we have tomcat 8.5 in the product

(01.09 at 05:54) Reguel Werme... ♦♦ Reguel%20Wermelinger's gravatar image

There is a good example how WebSockets could work in the Axon.ivy 6.3 engine. As back then the Portal was delivered with a Chat that used this technology stack. This simplest way is may be to download this version and track it's configuration. The magic is in the /webapps/ivy/lib/portal-chat-endpoints.jar. What i like about it, the jar does not only contain the endpoint classes, but also a web-fragment.xml that configures the parts of the global web.xml without the need to write manually into it. So you have all WebSocket related artifacts in one place and the engine setup is easy. alt text

I assume that this configuration of the push servlet still works. Even tough 6.3 was based on Tomcat 8.0 and 6.7 comes with Tomcat 8.5 now.

link

answered 07.09 at 02:46

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
5.9k11033
accept rate: 68%

edited 07.09 at 02:50

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×4
×3
×1

Asked: 31.08 at 08:55

Seen: 80 times

Last updated: 07.09 at 02:50