Hi. Does anyone know how to run some.war file under immutant as well as usual handler?
I need to run external servlet under the same web server as the main application
there is the following in docstring (immutant.web/run):
I'm not sure about the following: handler can be a Ring handler function, a Servlet, or an Undertow HttpHandler.
. How to pass some.war file name to immutant?
I suppose I have to create an instance of my HttpServlet class and I wonder if I can just set path to my *.war file.
@abtv: if you must use the war file, you're going to need an app server like wildfly
@jcrossley3: I have the main app which is deployed as jar file. I call immutant.web/run function with my handler. Is it possible to make jar file with all batteries included? I have an alternative to run my.war file under any web server separately. The only reason why I wanted to deploy it in the same jar file is simplicity of deployment.
As I understand I can use either wildfly or any other web server like jetty, right?
I can also run it from folder (extracted war file)
Can it help to run it under embedded web server?
you can use anything that can deploy a war file. typically, that's some external process that monitors a directory for war files to deploy. but that's not immutant, which is just a library, a collection of jar files.
you can create an uberjar, but that's just a big fat jar. no web.xml or anything, just a main class.
@abtv: why do you need a war file?
I have a big project (written in java) I need to integrate it with my main app. Usually the java project it is deployed under jetty. I run my main app as an usual jar file. I'm trying to investigate if it's possible to run the java project in the same way, without a separate web server like jetty @jcrossley3
docs ^ say that handler can be a Servlet instance (immutant.web/run fn)
yes, it can, but that Servlet is an instance of a Java class.
that's a surprisingly difficult thing to get from a war file :simple_smile:
that feature is mostly used to support Pedestal, btw
I see, but what if I extract war file to a folder? Could you give me a hint how to run my servlet?
I've found the following: http://lists.jboss.org/pipermail/undertow-dev/2015-February/001146.html , but haven't tested it yet
Is it the right way?
war file is just packaging. the behavior of your app is contained in the class/jar files within your war file. if those are available in your local maven repository, then your clojure project can depend on them, too.
I see. The java project is about 250 Megabytes with hundreds of jar files. I'm not sure it's worth putting all the files on class_path
i strongly doubt it is :simple_smile:
@jcrossley3: I see. And what do you think about the link: http://lists.jboss.org/pipermail/undertow-dev/2015-February/001146.html ?
I mean code
that article says exactly what i told you: if you need a war file, you need an app server like wildfly. undertow alone is not enough.
ah, you mean that it doesn't matter if I use war file or a folder with extracted war file content, right?
no
undertow provides an implementation of the Servlet interfaces
but it has no idea how to parse a web.xml
does that make sense?
I don't have prior experience with java and java deployments.
Is there something specific in web.xml?
well, then you, my friend, are screwed! 😄
As I understand I have to provide some settings to undertow (which is stored in web.xml), right?
imho, you are swimming upstream going that route.
how are you currently deploying your war file?
I use Jetty, just put war file in webapps folder
It looks simple enough, but I have to run 2 jar files (the main app and jetty)
do you actually build the war file prior to deploying it?
I did jar -cvf projectname.war *
But it doesn't matter, I can use a folder as well
btw, I use XWiki Enterprise project (I downloaded war file and have made some customizations) - it's my java project
well, i guess i'm asking who created that folder structure. were your customizations made to actual *.class files?
you're not describing a typical course of java development
I just added a couple of jar files to WEB-INF/lib folder
all the other things are untouched (I also changed several config files, but as I said I didn't change the folder structure)
well, if you're stuck with a war file, then you need an app server. jetty can operate in two modes: as an app server (to deploy war files) and as an embeddable web server. i'm not sure it's possible (or advisable) for it to do both in the same process.
but undertow is not an app server. just an embeddable web server and Servlet implementation.
I see, thanks a lot! You spare a lot of time for me :simple_smile:
good luck!