Skip to content

AtmosphereHandler not being found, when using NetBeans IDE

nepa edited this page Oct 20, 2012 · 1 revision

This article might be helpful, if you use:

  • NetBeans IDE (version before 7.0.1?)
  • GlassFish 3.1.2.2
  • Atmosphere with WebSockets only
  • Java server and JavaScript client

Problem:

You might run into these exceptions right after start-up:

Schwerwiegend: 1421 [http-thread-pool-8080(1)] WARN org.atmosphere.container.GlassFishWebSocketSupport - failed to connect to web socket 
Schwerwiegend: org.atmosphere.cpr.AtmosphereMappingException: No AtmosphereHandler maps request for /WebSocketTest/

And after sending a WebSocket request:

Schwerwiegend: 21718 [http-thread-pool-8080(1)] ERROR org.atmosphere.cpr.AsynchronousProcessor - No AtmosphereHandler found. Make sure you define it inside WEB-INF/atmosphere.xml or annotate using @AtmosphereHandlerService 
Schwerwiegend: 21720 [http-thread-pool-8080(1)] WARN org.atmosphere.websocket.DefaultWebSocketProcessor - Failed invoking AtmosphereFramework.doCometSupport() 
Schwerwiegend: org.atmosphere.cpr.AtmosphereMappingException: No AtmosphereHandler found. Make sure you define it inside WEB-INF/atmosphere.xml or annotate using @AtmosphereHandlerService

In case you are having troubles with AtmosphereHandler not being found, check the file sun-web.xml (or sometimes glassfish-web.xml). Older versions of NetBeans add a "context-root" element to the file automatically. It's value will be equal to the Maven artifactId (most likely your project name).

Solution: Remove the "context-root" element or set it's value to "/".

Warning: Older NetBeans versions will recreate/refresh the element, each time you deploy your project.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Servlet 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
<sun-web-app error-url="">
    <!-- Remove the context-root element or set it to "/" -->
    <!-- <context-root>/WebSocketTest</context-root> -->
    <class-loader delegate="true"/>
  <jsp-config>
    <property name="keepgenerated" value="true">
      <description>Keep a copy of the generated servlet class' java code.</description>
    </property>
  </jsp-config>-
  </sun-web-app>

Also check out this issue in the NetBeans bugtracker: Netbeans regenerates glassfish-web.xml every deploy

Step by Step Tutorials

Concepts & Architecture

15 Minutes Tutorial

Advanced Topics

API

Known WebServer Issues

References

External Documentations

githalytics.com alpha

Clone this wiki locally