Here is the client code that I use to recreate the "problem": public static void main(String[] args) throws Exception {
String currentDir = new File(".").getCanonicalPath(); String tomcatDir = currentDir + File.separatorChar + "tomcat"; String webRoot = currentDir + File.separatorChar + "examples"; Tomcat tomcat = new Tomcat(); tomcat.setBaseDir(tomcatDir); tomcat.setPort(8080); tomcat.addWebapp("/examples", webRoot); // this code gets the JarScanner and sets scanClassPath to false: // with this setting the websockets are not deployed Container[] containers = tomcat.getService().getContainer().findChildren(); StandardHost host = (StandardHost)containers[0]; containers = host.findChildren(); StandardContext ctx = (StandardContext)containers[0]; StandardJarScanner jarScanner = (StandardJarScanner)ctx.getJarScanner(); jarScanner.setScanClassPath(false); // if this is set to true the websockets are deployed successfully tomcat.start(); while (true) { Thread.sleep(999999999); } } I run this code from a folder containing the "examples" webapp and the Tomcat jars. Is there a way to deploy successfully the websockets with setScanClassPath(false) ? Thanks, Jacopo On Feb 13, 2014, at 6:47 PM, Jacopo Cappellato <jacopo.cappell...@gmail.com> wrote: > Hello all, > > I did further tests and I have now implemented a test client that executes a > Tomcat embedded instance that is successfully running websockets. > The client code resembles quite closely what we are doing in OFBiz to prepare > the Tomcat instance... and I think I have found the settings that is causing > the issue in OFBiz. > When in OFBiz we create the Context objects we set in their JarScanner (we > use the StandardJarScanner): setScanClassPath(false) > > I have noticed that if in my test client I set the same the websockets are > not mounted; they only work with setScanClassPath(true). > > Since I doubt we will be able to set it to true in OFBiz, I would really > appreciate if you could provide some hints about the mechanism that Tomcat > uses to deploy websockets. > > Am I completely off track? > > Thanks, > > Jacopo > > On Jan 29, 2014, at 4:42 PM, Jacopo Cappellato <jacopo.cappell...@gmail.com> > wrote: > >> Hello all, >> >> I am trying to deploy and use Websockets using the Tomcat 7.0.50 *Embedded* >> distribution [*]. >> >> Some more details on my environment: >> * I have the following jars in my classpath: >> ** tomcat-7.0.50-tomcat-embed-core.jar >> ** tomcat-7.0.50-tomcat-embed-jasper.jar >> ** tomcat-7.0.50-tomcat-embed-logging-log4j.jar >> ** tomcat-7.0.50-tomcat7-websocket.jar >> ** tomcat-7.0.50-websocket-api.jar >> ** ecj-4.2.2.jar >> ** annotations-api-3.0.jar >> ** jsp-api-2.2.jar >> ** servlet-api-3.0.jar >> * I have mounted the "examples" webapp that comes with Tomcat (Core >> distribution) using the Embedded Tomcat instance: all the examples work fine >> (including the websocket-deprecated ones) except for the Websockets JSR356 >> ones >> >> When I try to run the Websockets JSR356 examples, when I try to "Connect" >> (either using the programmatic API or the annotation API) I get the message: >> Info: WebSocket connection closed. >> Nothing appears in the console. >> >> Any hints would be greatly appreciated. Thanks in advance >> >> Jacopo >> >> [*] The reason I am using the Embedded version of Tomcat is that I am trying >> to add support for Websockets to Apache OFBiz (ofbiz.apache.org) and OFBiz >> runs Tomcat in embedded mode. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >> For additional commands, e-mail: users-h...@tomcat.apache.org >> > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org