Thanks for your reply, Daniel. I wasn't able to have my Pedestal server run in 
this mode yet; however, trying to activate the hot-deploy mode of the 
underlying Jetty server, like this

(import 'org.eclipse.jetty.deploy.DeploymentManager)
(import 'org.eclipse.jetty.deploy.providers.WebAppProvider)
(import 'org.eclipse.jetty.server.handler.ContextHandlerCollection)
(def s-map (http/create-server {
  :io.pedestal.http/port 8083,
  :io.pedestal.http/join? false,
  :io.pedestal.http/routes (route/expand-routes #{["/*" :get (fn [_] "Hello!") 
:route-name :hello]}),
  :io.pedestal.http/type :jetty}))
(def my-server (:io.pedestal.http/server s-map))
(def deployer (DeploymentManager.))
(def contexts (ContextHandlerCollection.))
(doto deployer
  (.setContexts contexts)
  (.setContextAttribute 
"org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
                
".*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\.jar$|.*/[^/]*taglibs.*\\.jar$")
)
(def provider (WebAppProvider.))
(doto provider
  (.setMonitoredDirName 
"/home/stefano/Documenti/Clojure/pedistal-tests/servlets/webapps")
  (.setScanInterval 1)
)
(.addAppProvider deployer provider)
(.addBean my-server deployer)
(def s (http/start s-map))

I got these log lines:

  INFO  org.eclipse.jetty.server.Server - jetty-9.4.8.v20171121
  INFO  o.e.j.server.handler.ContextHandler - Started 
o.e.j.s.ServletContextHandler@14ba1148{/,null,AVAILABLE}
  INFO  o.e.j.d.p.ScanningAppProvider - Deployment monitor 
[file:///home/stefano/Documenti/Clojure/pedistal-tests/servlets/webapps/] at 
interval 1

  CompilerException java.lang.NoSuchMethodError: 
org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.<init>(Lorg/eclipse/jetty/util/thread/ExecutionStrategy$Producer;Ljava/util/concurrent/Executor;Lorg/eclipse/jetty/util/thread/Invocable$InvocationType;)V,
 compiling:(form-init6693391245051507822.clj:1:8) 

which I interpret as if the embedded Jetty server has indeed started watching 
the hot-deploy folder (from within the Pedestal server).

I should try to configure the Server object correctly before running the 
pedistal server, and this requires understanding Jetty a bit more deeply; I was 
wondering if anybody has tried this already, and if there is an easy way of 
doing it with Pedistal, without diving into the underlying Jetty classes.

Thanks!

Stefano

On Monday, March 12, 2018 at 8:43:57 PM UTC+1, Daniel Compton wrote:
> My previous understanding was that "embedded Jetty" means that the Jetty 
> library is built into your Uberjar and when you run java -jar myapp.jar, 
> Jetty handles all of the web traffic. 
> 
> 
> Reading those docs though I see that you can also specify a path to a 
> separate WAR file if you want to. I suspect that the hot deployment 
> capabilities of Jetty might require it to be run as a separate application, 
> rather than embedding it, but now I'm not sure. You could try configuring the 
> embedded Jetty with the same options that you would for a standalone one to 
> allow hot deployments and see what happens?
> 
> 
> On Sat, Mar 10, 2018 at 3:52 AM <stefano....@sinapsi.com> wrote:
> Hi!
> 
> 
> 
> I'm new to servlet containers, but as far as I understand an embedded Jetty 
> (as Pedestal servers with ::type :jetty) can be configured to watch a path on 
> the filesystem and deploy .war files copied into it while the server is live.
> 
> 
> 
> For Jetty, the configuration for this is described here:
> 
> 
> 
> https://www.eclipse.org/jetty/documentation/9.4.x/embedding-jetty.html#_like_jetty_xml
> 
> 
> 
> I'm wondering if this is actually possible also for Pedistal servers, and 
> what is the best way to achieve it.
> 
> 
> 
> My eventual goal would be to make my Pedistal server dynamic, in the sense 
> that it can start erogating new services at runtime without a restart: 
> deploying a new servlet into it could be a way to achieve this. It would be 
> even better to have it serve new routes on the same port, but I wouldn't know 
> how to do this.
> 
> 
> 
> Has anybody tried anything similar, or any ideas about this?
> 
> 
> 
> Thanks!
> 
> 
> 
> Stefano
> 
> 
> 
> --
> 
> You received this message because you are subscribed to the Google Groups 
> "pedestal-users" group.
> 
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to pedestal-user...@googlegroups.com.
> 
> Visit this group at https://groups.google.com/group/pedestal-users.

-- 
You received this message because you are subscribed to the Google Groups 
"pedestal-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pedestal-users+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/pedestal-users.

Reply via email to