Apache Wicket Quick Start - eclipse

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.

Related

Unable to run mavenized GWT application in eclipse with embedded Tomcat

I have a proof of concept GWT 2.4 / Spring 3.1 / Maven 3 / Eclipse Indigo project that I have been working on. I am able to run the application in Dev Mode using the embedded Jetty server. I am able to create a war (mvn package with help of the gwt-maven-plugin) and run the application on an installed Tomcat server. But when I try to Run as > Run on Server, it does not use/copy the generated/compiled JavaScript. When I go to the wtpwebapps dir, all is there but the generated/compiled JavaScript. The generated/compiled JavaScript is in the correct location in the maven target dir, it seems, but the eclipse process that copies the code the applcation to the wtpwebapps dir doesn't pick it up.
I'm not sure if I need to give more info to solve this problem, but any help is appreciated.
You could use a custom com.google.gwt.core.ext.ServletContainerLauncher using the embedded Tomcat API, or much more simply run your server code in Tomcat (using WTP or the tomcat7-maven-plugin) and then run DevMode in -noserver mode.
See https://developers.google.com/eclipse/docs/faq#gwt_with_maven and https://developers.google.com/web-toolkit/doc/latest/DevGuideCompilingAndDebugging#How_do_I_use_my_own_server_in_development_mode_instead_of_GWT's
I'm using the second approach in https://github.com/tbroyer/gwt-maven-archetypes
The archetype uses Jetty for now, but I'm successfully using the tomcat7-maven-plugin on a project based on the archetype (with too many tricks preventing me to set it as the default in the archetype; those tricks only being needed because of the multi-module nature of the project; but there are tricks for Jetty too).
I encountered a similar problem with GWT-dev 2.8.0-beta1 and jetty 9 in my eclipse maven project. Since the GWT-dev jar includes Jetty and other code directly in its jar (which is bad), it conflicts with the jetty I import in my project. The work around was to create a separate module just for running super dev mode, importing GWT-dev and my project's code but excluding the jetty jars. I then run super dev mode via the main below. This way, the super dev mode runs without seeing my jetty libs.
import com.google.gwt.dev.codeserver.CodeServer;
public class SuperDevModeMain {
public static void main(String[] pArgs) throws Exception {
System.out.println("Starting management-station-web-sdm!");
String[] options = "-port 9876 com.something.ms.web.MsWeb".split(" ");
CodeServer.main(options);
}
}

How to set up eclipse with GWT and (regular servlet) Jetty backend

Does anybody know how to set up a project in Eclipse with GWT and a jetty backend (regular web app, not app engine)? Or know of a good link (tried googling it, but no dice)
I've been trying to set up this all evening, but just ran into a number of strange problems, some seems to be bugs in WST/Jetty and the other is that the host page just doesn't work :-(
There are three ways to run your own jetty server together with GWT.
If you run your own jetty server you have to invoke dev-mode in GWT with the -noserverparameter or for solution one you can use -server JettyLauncher
Use your own JettyLauncher.class or use gwt-jetty.
Use Jetty maven plugin to launch the jetty server (see here and here for infos)
Use Jetty WTP plugin for eclipse to start a jetty server.
I personally used solution 3 (Jetty WTP plugin) to start a custom Jetty 7 server for my GWT project and it works fine.

slight url mismatch while publishing java 6 maven webapp to tomcat from netbeans

Honestly I've started this small maven webapp using eclipse 3.6 (STS) and i found it so complicated that i had to switch to netbeans.I really wanted to use eclipse but these are reality on the ground.So at the end of everything I'll like to have an eclipse version of the same project. thanks
I set up the maven webapp using the embedded archetype, and use cargo plugin to take care of the deployment.basically there is only hello world index.jsp in the project.after picking pom configuration here and there my pom finally is like this .
while it started publishing after i restart the IDE, it's publishing to http://localhost:8080/ but for me I'm expecting it at http://localhost:8080/mvnTestWebap
so here are my questions
Question 1 : How can i correct that?
Question 2 : I believe my pom is tied to netbeans too much, how can i achieve the publishing to tomcat result but having a portable pom?Can anyone suggest a rewrite that can run on eclipse?
Question 3 : what correspond to netbeans "run" in eclipse?
probably by some deployment descriptor editing.
don't really understand the point. by default netbeans uses it's own embedded IDE way of deployment. That's not creating a pom tied to netbeans in any way. You can use that in eclipse or IDE or command line to build the project. The deployment part of the web app is specific to the server being used and the IDE being used.
You can also tell netbeans to execute your cargo plugin on executing the Run/Debug/Profile action (bypassing the netbeans default behaviour)
run basically performs a redeploy of the app on the server of choice. There has to be an equivalent on eclipse.

Can't get compile on save / hot deploy feature to work with maven based webapp in eclipse or netbeans

So our new webapp project is based on maven. I'm really liking the dependency management and IDE agnostic approach but I'm having problems with compilation and debugging.
Here's how I would currently get a clean copy of the project working
Check out the main project from SVN
Open the project in IDE (I've tried in eclipse 3.4 and netbeans 6.7)
The IDE will automatically open two subprojects one being the webapp, the other being a supporting utils jar.
From the command line I run mvn war:inplace on the webapp module which builds a working copy of the webapp with all dependencies in WEB-INF/lib/
This then runs fine but whenever I change a java class I have to clean and build / reload the app context.
I've googled high and low but no one seems to be complaining about this so I guess there must be something really obvious I'm missing. How is everyone else handling incremental compilation and hot deploy with maven?
To clarify all I'm looking for is the replicate the behavior I used to have before maven where I could make simple changes to java classes and they would be instantaneously compiled and hot deployed to a running webapp. I don't need anything fancy like jRebel etc I just want the new tool to give me the same functionality I enjoyed with my old tools.
If you can use mvn jetty:run it will read the classes and resources directly from the project. Using Maven2 Eclipse plugin and running the server embedded in Eclipse has auto-publishing, which gets you there in the end, although it's slower. And JRebel starting with 2.0 (as you may know) can map the Maven module directly to the deployed application, so you get instant build and redeploy. Those are the only solutions I know of.
Netbeans should support it out of the box. Though, there remains a bug related to this: http://netbeans.org/bugzilla/show_bug.cgi?id=177230
In-place deployment works for me with Netbeans 7.0.1 and Tomcat 6.0.x if I use Tomcat 7.0.x in-place deployment doesn't work. Tomcat always copies application to $CATALINA_HOME/temp :(

What steps are necessary to get Eclipse and a Java servlet container integrated on Ubuntu 9.10?

What's the easiest way for me to get Eclipse running with a Java servlet container on Ubuntu 9.10?
I've tried a number of things, hitting dead ends each time. The best setup would use Ubuntu packages as much as possible, not require running Eclipse as root, and be able to debug running servlets.
Dead ends so far include run-jetty-run, the Sysdeo Tomcat plugin, and Eclipse WTP with tomcat6.
A big part of the problem is that the Ubuntu tomcat6 installation is non-standard, splitting directories such that they're not all in TOMCAT_HOME. Eclipse is also non-standard, and the usual plugin installation methods don't work. I got close by installing the WTP through a PPA, but I stumbled when trying to get it to recognize tomcat.
Ubuntu recently includes a pretty full Eclipse package that you can install via Synaptic or such. But I prefer to download my own.
I download from the Eclipse download site. If I choose Eclipse IDE for Java EE Developers then I have server environments for all Web app containers already built in. If I set up one for Tomcat (in Eclipse), Eclipse will download and install Tomcat for me. It's quite convenient, although I sometimes have trouble finding Tomcat or its files. Eclipse squirrels them away somewhere.
The server setup menus become accessible to you once you create a Web project (not plain Java project).
You should "apt-get install sun-java6-jdk", download and use the Java EE version of Eclipse, and then create a dynamic web project. In the web project create a jsp page, and right click -> "Run -> Run on server" where you may then install a server connector.
Some connectors are included in Java EE, some must be downloaded. Choose the one corresponding to the server you have downloaded and unpacked, and point Eclipse to the directory.
If all succeedes, the JSP page should then show up in a browser served from the started server.