This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Product Version = NetBeans IDE 7.2.1 (Build 201210100934) Operating System = Windows 7 version 6.1 running on amd64 Java; VM; Vendor = 1.7.0 Runtime = Java HotSpot(TM) 64-Bit Server VM 21.0-b17 Tomcat = apache-tomcat-7.0.42.0 I'm building a JSP/Javascript web application that uses websockets, and couldn't get the Javascript command ws = new WebSocket(URL) to properly open a connection. To make sure I was using the command correctly I loaded the apache-tomcat example 'websocket' from my tomcat release, listed above, as a project in NetBeans. As expected, NetBeans deployed my project in place at NetBeansProjects/proj_name/build/web . When I ran the application from the IDE, the application was found using a context path that identical to the deployment in build and the application loads and ran fine. However, when my Javascipt code tries to open a connection with new WebSocket(URL), the javascript uses CATALINA_BASE as the context path, so it does not find the WebSocketServlet class in build/web/WEB-INF/classes, which was loaded at startup. It ends up instantiating a new WebSocketServlet from CATALINA_BASE, not the one in the build/web path. Any work around appears tedious, either requiring me to manually deploy my project to CATALINA_BASE, or to declare the build/web directory to be CATALINA_BASE.
Created attachment 138318 [details] IDE log
Probably JavaEE area?
A test project demonstrating this problem would make it easier for me to reproduce the problem and provide help. Having said that this does not sound like a NetBeans problem but rather an issue in how project is setup or deployed. Could you give an example of URL you expect and URL which NetBeans uses? I'd think that you deploy an app to Tomcat, eg. "http://localhost:8080/myapp/" and from your HTML page you do new WebSocket("ws://localhost:8080/myapp/mywebsocket").
The problem was resolved by creating a separate WebSocketServlet, rather than extending the existing HttpServlet, and by declaring both servlets with unique URL patterns in web.xml .