How to make a standalone lift application? Which tools/libraries to use? How does the performance compare to using lift application as a war in some application server?
With onejar maven plugin http://onejar-maven-plugin.googlecode.com/svn/mavensite/usage.html and maven I could package jetty and project with dependencies inside one jar.
The part of the question on performance doesn't really fit with the rest. You are primarily asking how to package the Lift application as a single JAR/WAR. This doesn't have anything to do with the runtime.
At runtime you will still be running inside a Servlet container (could be Jetty, Tomcat or a full-blown Java EE server). How you package your application won't affect the performance.
You could take a look at Hudson (a great Continuous Integration Server) to see how they deliver as a single WAR file that contains an embedded Servlet container. You can download the WAR file and run it from the command line: java -jar hudson.war
I know this is an old question, but...
If you are using sbt, I wrote a plugin to produce 'executable' wars like those mentioned above.
https://github.com/glenford/sbt-jetty-embed
Related
I was trying to start learning about Apache Wicket (as it looked like an easy to use UI for Java) and as I like to work with Eclipse and Maven. I also like to work with Tomcat, however, Wicket seems to prefer Jetty at least in its tutorials. I do not know nothing about Jetty, however should not take ages to learn.
I tried the Wicket Quick Start and successfully imported the generated Maven project to Eclipse workspace.
But errors appear: e.g.
import org.eclipse.jetty.server.HttpConfiguration;
It seems Eclipse cannot find the jetty server classes. How to add these to the Eclipse project?
Does the creater of the Wicket Quick Start assumed that Jetty is already installed on the machine?
I installed it. However: what is the recommended way to make what jar file available to a maven project to have jetty server classes available? I would assume via the pom.xml but I doubt that is the case here - the given pom.xml would contain it.
Or is there some special plugin for Eclipse (Photon)?Run-Jetty-Run?. I wasn't brave enough to try that.
I would love to get the Wicket Quick Start running.
I also tried Eclipse + Tomcat + Apache Wicket Maven Setup with Hello World Example but it seems that it is outdated. I was not able to install qwickie to Eclipse as described.
I am using Eclipse Proton with Java 10.0.2 on Debian Stretch.
If you are using https://wicket.apache.org/start/quickstart.html then you can start the application these ways:
mvn jetty:run - this will use jetty-maven-plugin
Open in Eclipse src/test/java/com/example/Start.java and run it as a normal Java class with a main(String[]) method. This will use Jetty Maven dependencies to start an embedded Jetty server.
Wicket's Quickstart prefers Jetty because Jetty developers made it easy to use it in non production way, i.e. in development mode, for faster dev cycles. No need to build a .war file and deploy it.
On the other side Tomcat devs (disclaimer: I am a member of both Wicket and Tomcat teams) never spent time in this direction. Tomcat's Maven plugin has been abandoned long time ago. The best integration for starting embedded Tomcat is provided by Spring Boot project (I recommend it if you use Spring!).
So, just remove the Jetty related dependencies and plugin in pom.xml and the Start.java in src/test/java/.... Then you can continue developing with Eclipse and Tomcat the way you like to do it.
While working with Scala frameworks such as Play! and Lift I was really amazed how these frameworks manage to create a full development stack from the source code up to the web application container (Jetty).
Right now I'm trying to configure a project on my own with the following features:
Automatic deployment on Tomcat 7 (I'm not using Jetty as I require JEE6 support)
WAR file packaging
Is it possible to do it with a build tool such as SBT or Maven?
Note: My goal is to create my own project structure, not using an existing framework (even though I'm taking some ideas from them).
There is a web plugin for SBT:
https://github.com/JamesEarlDouglas/xsbt-web-plugin
It gives you war packaging, but not automatic deployment (other than on Jetty, which it integrates, but which you don't have to use).
That said, I'd like to see a fork of that plugin that removes the Jetty dependency and adds an automatic external deployment option. Shouldn't be too hard to do.
Ok I'm having quite some issues setting both jbpm and jboss working together...something as simple as running the jbpm process from a servlet is trunning to be a pain and all because jBoss can't find classes.
I made a Dynamic Web Project and didn't use Maven project so things are cleaner...and because it should work.
I just want to load a jbpmn2.0 from the repository in a servlet and run it using a WorkItemHanlder....but I get this:
java.lang.ClassNotFoundException: org.drools.runtime.process.WorkItemHandler
For some reason jBoss can't find a class from jBPM that should work on JBoss. What I did....and I think it's not the right solution...was add the knowledge-api.jar to the WEB-INF/lib. Although I can now deploy the app when I try to run it I get:
Error Unable to instantiate service for Class 'org.drools.builder.KnowledgeBuilderFactoryService'
I Honestly don't get why is it so hard to make a Jboss Web app using jBpm.
You need to make sure all dependencies are on your classpath, this is the same for all Java applications (not just jbpm) and application servers (not just JBossAS).
Which jars did you add? Depending on which features you are using, there could be quite a number of jars that you need to add. One option would for example would be to extract the jars in the jBPM runtime zip that is part of the jBPM downloads into your WEB-INF/lib.
If you use Maven, you would be able to automatically derive all required jars.
Kris
We are looking at rearchitecting our web application and want to move to a more modular solution, OSGi seems to meet a lot of our needs.
I've come across the Apache Felix project and taken it for a spin. It looks solid yet I find the development cycle a bit slow as it requires a maven build of the bundle(s) to make any code changes effective.
Instead I would like to be able to reload a bundle once classes have been compiled by Eclipse, without any extra building/packaging. Similar to how Tomcat and other servlet containers support deployment of "exploded" war files.
Is this possible to do with Felix or any other OSGi container?
In the Gogo shell, you can do:
install reference:file:/path/to/exploded/directory
This will install an exploded bundle. The format of the exploded directory should be exact that of a bundle JAR file.
Apache Felix FileInstall supports exploded bundles out of the box. Just install it, and put a directory with your bundle in the load directory (or configure FileInstall to look somewhere else).
Not exactly answering your question, but if you have issues with the build cycle, you should take a look at bndtools, which is a plugin for Eclipse that a.o. automatically builds and deploys your bundles in a running framework when your code changes.
I develop scala application using IntelliJ IDEA. I'd like my application modules to be OSGi bundles.
In Eclipse it is possible to create a project which is both scala project and plug-in project. Eclipse also supports launching of Equinox platform and provides great configuration tool of which bundles to start and how. But I can't use Eclipse because of poor and slow scala plugin, so I need to use IntelliJ IDEA.
In IDEA I tried Osmorc for running OSGi but this solution is very immature and doesn't work well. What are the other ways of launching and configuring an OSGi application from IDEA?
Not an exact answer, but one possibility would be to:
set up a scala project with sbt and Intellij
use bnd4sbt (It enables you to create OSGi bundles for your SBT projects)
use scalamodules (a domain specific language for OSGi development)
(All thanks to the work of WeigleWilczek, including Heiko Seeberger who contributes here)
All the OSGi frameworks can be launched as standard Java processes. For example to launch Felix:
java -jar path/to/felix.jar
To launch Equinox:
java -jar path/to/org.eclipse.osgi_version.jar
And so on.
Unfortunately the initial configuration differs substantially between framework implementations. For Felix you need a config.properties file, which is typically in the conf directory of the Felix installation directory (or you can set the felix.config.properties system property to point it elsewhere).
I'm using PAX runner from inside Intellij IDEA to provision (deploy) OSGI bundles to Apache Felix and run the framework, but this is very annoying: I have to run "mvn install" first, then stop the running pax provisioning session, then restart it - for every change I make in the bundle. There got to be be a better way...