Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Enable JSR356 with jetty-runner

I think I solved. Was mandatory this piece of configuration also:

// This webapp will use jsps and jstl. We need to enable the
        // AnnotationConfiguration in order to correctly
        // set up the jsp container
        org.eclipse.jetty.webapp.Configuration.ClassList classlist = org.eclipse.jetty.webapp.Configuration.ClassList.setServerDefault(server);
        classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration", "org.eclipse.jetty.annotations.AnnotationConfiguration");

        // Set the ContainerIncludeJarPattern so that jetty examines these
        // container-path jars for tlds, web-fragments etc.
        // If you omit the jar that contains the jstl .tlds, the jsp engine will
        // scan for them instead.
        webapp.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
                ".*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\.jar$|.*/[^/]*taglibs.*\\.jar$");

Hope someone can confirm that this is the correct solution :-)

Thanks

2014-10-16 15:09 GMT+02:00 Daniele Renda <daniele.renda@xxxxxxxxx>:
Thanks Joakim,
your explanation is very clear.

I followed your hint 6.3. Howewer seems that also in this case websocket are not active!!! I followed example from tutotial on Jetty 9 documentation page.

This is my code:


        String jetty_home = System.getProperty("jetty.home", ".");
        System.setProperty("jetty.home", jetty_home);

      
        Server server = new Server();
      
        HttpConfiguration http_config = new HttpConfiguration();
        http_config.setSecureScheme("https");
        http_config.setSecurePort(443);
        http_config.setOutputBufferSize(32768);
      
        ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(http_config));
        http.setPort(8083);
        http.setIdleTimeout(30000);

   
        // Set the connectors
        server.setConnectors(new Connector[] { http});

     
        WebAppContext webapp = new WebAppContext();
        webapp.setContextPath("/gateway");
        webapp.setWar("C:\\gateway.war");

     
        server.setHandler(webapp);

        // Start the server
        server.start();
        server.join();

Do you see something that prevent from loading Websocket?? As yet say, using jatty-maven-plugin my app works fine with websockets!

Thanks for your help!

2014-10-15 21:26 GMT+02:00 Joakim Erdfelt <joakim@xxxxxxxxxxx>:
Sorry, I have no direct answers.
I stopped using jetty-runner in the early Jetty 7 days (late 2008-ish)
Barely used it then.

Seeing as I had a hand in getting the JSR-356 support into Jetty, I decided to look into jetty-runner ...
Yeah, it has no integrated JSR-356 support built-in.
Jetty runner just simply doesn't have everything built-in, as that would be ridiculous and often contradictory/conflicting.

Your options at this point:
  1. Manage a classpath, add the missing jars - javax-websocket-client-impl-{version}.jar, javax-websocket-server-impl-{version}.jar, and javax.websocket-api-1.0.jar.
  2. Build your own jetty-runner with those integrated
  3. Use jetty-maven-plugin to launch jetty with your webapp maven build (testing only! not for production)
  4. Use gradle's jetty plugins to launch jetty with your webapp's gradle build (testing only! not for production)
  5. Use the jetty-distribution and the start.jar, along with the {jetty.home} vs {jetty.base} separation
    1. Your project directory becomes a {jetty.base}, your {jetty.home} is a different directory with your as-is (unmodified) jetty-distribution.  At bare minimum it will mean a single start.ini file in your project directory.
  6. Build your project to utilize embedded-jetty techniques
    1. You can make it an uberjar with everything included (jetty + your webapp)
    2. You can make your war file self-executable, capable of launching an embedded jetty itself (included in your war)
    3. You can make an embedded-jetty launcher of your own design (as an uber-jar) to deploy and number of webapps you want.





--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts

On Wed, Oct 15, 2014 at 12:04 PM, Daniele Renda <daniele.renda@xxxxxxxxx> wrote:
Thanks for the clarification Joakim.

I'd like to have a single jar in order to start jetty; for this reason I used jetty-runner. Which is your suggestion in my case?

Thanks very much

2014-10-15 19:33 GMT+02:00 Joakim Erdfelt <joakim@xxxxxxxxxxx>:
Anu,

Daniele is using Jetty Runner, which is different than the Jetty Distribution's start.jar mechanism.

Frankly, the start.jar mechanism is loads easier than the jetty-runner.jar process with Jetty 9.
It used to be the reverse in older versions of Jetty, jetty-runner was simpler, but that's no longer true.



--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts

On Wed, Oct 15, 2014 at 10:21 AM, Padki, Anuradha <anuradha.padki@xxxxxxxx> wrote:

Yes I too run 9.2

Did you have all .ini set up already? Which directory are you running it from?

Did you run this in the folder from where you will start the app.

java -jar $JETTY_HOME/start.jar --add-to-startd=http,deploy,websocket,jsp

 

-          Anu

 

From: jetty-users-bounces@xxxxxxxxxxx [mailto:jetty-users-bounces@xxxxxxxxxxx] On Behalf Of Daniele Renda
Sent: Wednesday, October 15, 2014 11:33 AM
To: JETTY user mailing list
Subject: Re: [jetty-users] Enable JSR356 with jetty-runner

 

Thanks Anu,

I forgot to say that I'm using Jetty 9.2.3.v20140905.

I continue to have the same problem.

Thanks very much

 

2014-10-15 17:24 GMT+02:00 Padki, Anuradha <anuradha.padki@xxxxxxxx>:

I run  jsr356 app it with start.jar and it runs fine.

-          Anu

 

From: jetty-users-bounces@xxxxxxxxxxx [mailto:jetty-users-bounces@xxxxxxxxxxx] On Behalf Of Daniele Renda
Sent: Tuesday, October 14, 2014 7:00 AM
To: jetty-users@xxxxxxxxxxx
Subject: [jetty-users] Enable JSR356 with jetty-runner

 

Hi,

I developed a Java server application (spring+hibernate) that use websockets. When I run the app with jetty-maven-plugin all works fine, but if I try to run my application with jetty-runner, then seems that JSR356 are not enabled.

To load my app I run: java -jar c:\jetty.jar --port 8083 --path gateway gateway

Is supposed JSR356 included into jetty-runner? In the opposite case how I can enable it?

Thanks very much


--
Daniele Renda


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users




--
Daniele Renda


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--
Daniele Renda

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--
Daniele Renda



--
Daniele Renda

Back to the top