Problems to run Vaadin (maven) sample project on Tomcat - eclipse

I believe this is specific question regarding Vaadin so if anyone who has an experience with Vaadin can help it will be great.
I am new with Vaadin framework. I worked more then 25 years as Oracle Developer and also wrote some Java programs.
My company is actually migrating Oracle Forms application to Java. As a user User interface layer we are using Vaadin and HTML5
I have installed Eclipse IDE for Java Developers Version: 2021-03 (4.19.0) on my Oracle Vbox virtual machine ( Ubuntu 18.04.3 LTS)
Also I have added tomcat 8 server to my Eclipse workspace.
Actually I am trying to create my first project based on this document https://vaadin.com/docs/v7/framework/getting-started/getting-started-first-project but I am already facing some issues :)
I have selected Vaadin 7 project for a new project .
select Maven Archetype ==> Single module Application
window => specified Archetype parameters and clicked finished
After I have selected the project and Run As Maven Install and also compiled Vaadin themes.
Here are the issues I am having:
When I compare my project hierarchy with https://vaadin.com/docs/v8/framework/getting-started/getting-started-first-project/#figure.getting-started.first-project.exploring I don't see JavaScript resources. It's important because my first task will be adding JavasScript to my application.
When I am running the project as explained in the document:
"Starting your application is as easy as selecting myproject from the Project Explorer and then Run › Debug As › . Eclipse then opens the application in built-in web browser"
When I select run and Debug the Debug on Server option is not available ( only Java application , Maven Build etc)
So I have tried another option: right click on Tomcat Server => Add or remove and I got the message: there are no resources that can be added or removed from the server
Also tried : Properties -> Projects Facets and check Dynamic Web Module but this doesn't help either
When I am trying to run the project I am getting the message "The selection did not contain any resources that can run on a server"
fre
org.eclipse.wst.common.project.facet.core.xml
I have also created the new Vaadin 10+ project with a "Base Starter for Vaadin" added Tomcat 8.0 Server ( maybe I should use Tomcat 9) and
Getting the message "the selection cannot be run on any server" when trying to run the project.
Any help will be highly appreciated

Note that Vaadin 7 is no longer a publicly supported version. If you are starting a new project, you may want to start with the latest LTS version 14.
If you have a Spring Boot-based app (default), you can run it either with mvn spring-boot:run Maven goal or by right-clicking the Application.java file and running it.
This documentation page outlines the steps for importing and running a Vaadin app in Eclipse: https://vaadin.com/docs/v14/guide/start/eclipse

Related

Dynamic Web project Error "Loading descriptor"

In the process of trying to build an android web service using Spring under Eclipse IDE, I need to create a Dynamic Web Project using Maven. The problem I am facing is an error " Loading descriptor for project has encountered a problem. I don't know how to solve this. Any input on that?
If you get the following exception:
Loading descriptor for project has encountered a problem. [...]
Nullpointerexception
right after creating a project, then there are 2 possible causes (or at least that how it was for me, when I had this issue).
1) A web.xml file is missing in your WebContent/WEB-INF folder or was not created during project creation. (in the last window you have to check option "Generate web.xml deployment descriptor" in eclipse, otherwise eclipse won't generate that file)
If your project is already created, you can still add a web.xml file into your WEB-INF directory. Depending on your servlet version (e.g. 2.5) you have to use a different template which can be found on the net.
2) Your Eclipse does not have all the necessary plugins for Dynamic Web projects.
You need to go to Help >> Install new Software
Select the site which corresponds to your eclipse version. (e.g. Kepler - http://download.eclipse.org/releases/kepler )
Install:
JST Server UI
JST Web UI
JST Server Adapters
JST Server Adapters Extension
WST Server Adapters.
You may also need:
Eclipse Java EE Developer tools
Eclipse Java Web Developer tools
Java Server Faces tools or JSF tools
Eclipse faceted Project Framework
Eclipse faceted Project Framework JDT Enablement
install Java EE web developer tools from Help >> "Install new Software".
check in project properties "Project Facets" should have proper check boxes enabled eg Dynamic Web Project etc.
I know this is late but may be useful for others.
In web.xml there may be some attribute repated in web-app tag.
In my case xmlns="http://java.sun.com/xml/ns/javaee" attribute in repeated in tag web-app.
Install Eclipse Java Development tools from Help >> "Install new Software".

Running GWT on tomcat in eclipse

I am trying to get a GWT Project running on a Tomcat 7 server in eclipse. I installed Tomcat and i can run other web application out of eclipse on Tomcat without a problem.
Now i generated a gwt maven project for eclipse with the following command and importet it as maven project to eclipse:
"mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin"
I can run this now as Web application (with the google plugin) and i can build a "war" with maven and deploy this with the Tomcat management console on the server. Both is working. But if i choose the option in eclipse "Run on server" and choose tomcat than just the html is loaded but not the application itself. See the screenshot: It doesn't find the "GWTModule.nocache.js".
This file is available in the target folder. What do i have to change to tell tomcat to look in the correct directory?
Tomcat is not able to run GWT code in development mode. You can use Tomcat for server side code, but in this case you need to run GWT development mode with -noserver option (to prevent built-in Jetty instance from running). See this article for more details.
I would recommend using the wtp plugin for eclipse. If you do this you can add your project/resource to tomcat when adding a new server. Here are the steps to use if you already have your project imported into eclipse.
Window -> Show View -> Servers
In Servers
New -> Server -> Choose apache tomcat
Point to the location of your tomcat installation/download
Next
At this point you should be able to add your gwt-maven project which will add the target/project.war to the tomcat modules.
Save it
Click on the newly added server, then click the modules tab at the bottom kind of hard to see.
This should have your project shown in the list of web modules.
Start your tomcat instance then on your gwt application right click and choose Run As -> Web application. Make sure your configuration settings are correct and when the development server starts it should give you the development url to browse to.
You can configure some aspects of tomcat in the overview tab, I would recommend making sure that "Modules auto reload by default" is checked so that tomcat will watch the filesystem for class changes.

maven project with eclipse plugin: server is not linked to project in eclipse anymore

This is an eclipse question. I was using the IBM Rational Software architect 7.0 and had eclipse projects. When i used to right click on the server and tried "Add Remove Projects" it showed me the Ear project.
I mavenized the projects outside of RSA and installed RSA 7.5 (without any server runtimes) I had a WAS 7.0 runtime already configured on my machine outside of RSA so I added it in RSA 7.5.
I imported the maven project using the m2eclipse plugin and made configuration in "Run AS..>Run Configuration" and called compiled and install goals of maven. Now I see I have two problems:
1) my Server that i added through add a new Server and pointed to the profile AppSrv01 of the server (not the deployment manager) is added but it says there are no projects to be added to the server when I right click on it and select add remove projects. Even though I have an ear project and that has a war project added in the application.xml but the in the project explorer > under the deployment descriptor the module folder is empty. (DO u think this is a project setup issue esp with maven or server setup issue) if this is related to maven project setup then how do i correct it.
2) also When i run the server I dont see any logs besides the launcher log ( this is not related to maven ofcourse but related to adding the server runtime) So i dont see the System.out logs that we usually see when we start the server where at the end it says "eServer open for e business....etc" So how to add that now. May be the way i ADDED the runtime for was 7 was wrong and faulty. (I also added the deployment Manager profile in order to start the dmgr to see the console.)
Any tips or suggestions would be nice.
Thanks.
Syed...

How to redeploy the web app using the Eclipse IDE

Im new to Eclipse. I use Tomcat as my run time server, but every time I modified the jsp pages, Eclipse was still displaying the older one. Just wondering how to redeploy the application so the changes can be reflected.
Eclipse: Eclipse IDE for Java EE Developers 1.2.1.20090918-0703
Tomcat: Tomcat 6.0
Thanks
Doubleclick the server instance in question in the Servers view to open its configuration. Now, in the right top you should see a section called Publishing. Open it to verify and configure autopublishing settings.
Eclipse should do that automatically for you.
Otherwise, on the Servers view (Menu Window->Show View->Servers), you can right click on your Tomcat instance and hit "Publish" or "Restart"
Make sure you have the "JST Server Adapters" ("Web, XML and Java EE Development category") feature installed.
Eclipse's publishing functionality requries the project to be a "web project", and in some cases requires additional configurations.
Go to Windows > Preferences > Server > Runtime environments and add your tomcat
Either try using publishing, or (better I think) use the FileSync plugin. There you can tell which folders from your project should be copied (live) to what directory on your machine (the tomcat/webapps/yourapp). With a little more effort the filesync configuration can be made machine independent (only using one parameter as TOMCAT_ROOT), in case you want to check-in the project to a repository where others will use it.
Get the Tomcat plugin. It was nice because you can install Tomcat on your system and then associate your web app with that instance of Tomcat. The plugin will let you stop/start Tomcat and define a server such that when you do a build it knows how to deploy the changes. There may be some newer plugin but the Tomcat plugin worked for me and was fairly simple to install and use. Here is a page from IBM on using Eclipse and Tomcat. Inside that page it points you to the following: http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/

Setting up Spring and Tomcat in eclipse?

I am having some trouble getting Spring and Tomcat up and running and recognized by eclipse. I have looked around on google with no luck. Specifically, I am having trouble having eclipse recognize tomcat (I am running linux, and when I browse to the relevant jar file in the runtime environments configuration, eclipse wont allow me to select it). Could somebody please point me to (or describe here) how to get Spring and Tomcat working properly in eclipse and possible provide a "Hello World" example so I can test my first Spring application? Thank you very much.
Have a look at the Spring Tools Suite - essentially Eclipse with Spring specific extensions.
You must have WTP (Web Tools Platform). It is bundled in the Java EE version of Eclipse
Go to Window -> Preferences -> Server -> Runtime environment and click "add"
Choose and setup your server following the wizard
When finished, Go to Window > Show view > Other and locate Servers
It will appear in the bottom panel. Now you can double-click it to set some options of your preference
Right click your project > Debug > Debug on server (The project must be a "web project")
It's generally this. There might be some troubles in the last step, but use google or the link given by Chris for that.
Not familiar with Spring, but here's a link that helped me get Tomcat up and running in Eclipse:
http://www.windofkeltia.com/j2ee/wtp-tutorial.html
you can try eclipse web tools platform for doing this.
You can go to your project then choose
Debug As --> Debug On Server
I think the server adapter for tomcat is installed by default.
You can download the Java EE Distribution Of Eclipse to have this functionality out of the box.