Not able to run a service on tomcat via IntelliJ Idea - java

I am working on a framework "beadledom".
I am also relatively very new to IntelliJ Idea, I have used eclipse before, the beadledom framework contains the project sub-module,
api
service
client
In Eclipse if we want to run the services, I would right click on "service" sub-module Run on Server -> tomcat ; and it would run.
My webapp is stored in "service" folder.
I have no clue how do I do it on IntelliJ
I did set the Run Configuartion.
I am being asked to create a "artifact" in Edit Configuration>Tomcat
enter image description here

The artifact is an archive, built from your project sources which constitutes your application. For Java EE web projects it is usually a war achrive which you deploy to an application server (e.g. Tomcat). In case of a Maven-based poject IntelliJ IDEA automatically creates web artifact, based on Maven pom.xml configuration which then you can select to deploy in Tomcat Run/Debug Configuration Deployment tab.
You could check Developing a Java EE Application tutorial for the general workflows in JavaEE-based projects in IntelliJ IDEA.

Related

Create a Gradle 7.x Java web application project in Eclipse 2021-03

I use Eclipse and Gradle for a few "desktop" / command line Java application projects, including multi-project projects.
But I haven't used Gradle for a Java web application project in Eclipse so far. My usual approach is:
Create empty workspace and configure it (JDK, Runtime environment Tomcat server)
"Create a Dynamic Web project", run through wizard
And everything works fine. The project has a proper structure (WEB-INF exists, web.xml is created etc.), it compiles and it is deployed automatically to Tomcat by Eclipse. CATALINA_BASE is set to some temp folder in the workspace.
But how do I create a Gradle project which is a "Dynamic Web project" and not just a command line Java application or java-library?
I have tried two approaches:
Create a Gradle project using the wizard in Eclipse. It seems to create a java-library project always with a lib subproject. Having created the "wrapper" project and the actual Gradle project lib, set java and war as plugins for this. Open the project properties of the Gradle project lib, Project Facets, add Dynamic Web Project Facet (4.0). Create run configuration to make it run in Tomcat server.
Create a Gradle project using gradle init in an empty directory. Create application project instead of library. Import that existing Gradle project into an empty workspace (instead of using Eclipse to create the project). And apply the same procedures as above (facet etc.).
None of the approaches gave me a working, ready-to-use web application project that has the expected folder structures (WebContent, WEB-INF, ...), that deploys correctly (no deployment or e.g. web.xml missing) ...
I spent several hours to use Gradle in a Java web application project in Eclipse. (Because I want to profit from its easy declarative dependency management.) But I didn't manage to make it work.
Also the samples in the Gradle docs do not contain a Java web application project:
https://docs.gradle.org/current/samples/index.html
Only Java Application or Java Library.
Has someone else already managed to set this up?
Gradle 7.0.x
Eclipse 2021-03
Tomcat 9 or 10 (I've tried both)
AdoptOpenJDK 11
Windows machine
Please share your approach. :)

Using eclipse & tomcat to test a war

I have several web services packaged as a .war file that is build by ant. I would like to test these wars as an Eclipse Dynamic Web Service. All the examples and help I've seen are based on Eclipse building the war file but I've not seen anyone deploy an externally build war file to an Eclipse hosted Tomcat service.
I am aware that you can create a war file from a Eclipse Dynamic Web Service, but since we have multiple developers using multiple IDEs and even multiple platforms the wars need to be created via an IDE agnostic Ant script.
Wars were developed so that a service could be portable. I just want to plug one into the Eclipse Tomcat Web Server to test.
Thank you but I don't want to create the war from Eclipse (export), nor import a war into my eclipse as a project. (I know how to do these and they don't do what I want). I want to deploy a war into a Eclipse/Tomcat service to test.
Thanks for reading this.

How to run on GlassFish in IntelliJ?

I am using IntelliJ, and I have a J2EE project. I have setted up a local GlassFish server in the IDE, but how can I configure the project to run on that local GlassFish server?
My project uses Java EE's features (such as servlets), but IntelliJ says that those libraries do not exist:
I can't run my project either:
How do I associate my local GlassFish server with the project, and enable the GlassFIsh's library?
I have setted up a local GlassFish server in the IDE, but how can I configure the project to run on that local GlassFish server?
I assume that you did this using Run > Edit Configurations... in which a local or remote Glassfish server can be configured. So in the window of Glassfish edit configurations there is a tab named deployment in which you can add source(s) to be deployed at the server startup.
My project uses Java EE's features (such as servlets), but IntelliJ
says that those libraries do not exist:
Go to File > Project structure or press Ctrl+Alt+Shift+S click to open Modules > Dependencies tab press the Add (+) button select Library... and there you can find Glassfish and add it as a dependency.
Did you follow the recommended way to create your J2EE project in Intellij?
Follow the guide here: Getting Started with Java EE 7 and GlassFish 4.0

Unable to create the WAR of my web application on Jboss

I am trying to deploy my web application with Jboss AS 6.x.
The problem I am facing is when I try to export the WAR file by right clicking on the project from left menu and export, there is no such option as to export the project as WAR.
I have installed JBoss Application Tools successfully. Integrated JBoss server successfully.
Where am I missing? Am I missing some necessary tools?
This option is available only if your project is Dynamic Web Project. The Java project, which is decorated with J letter on folder icon doesn't have the capability to export as WAR archive. But to deploy a web project you might try the approach "Run as...". And choose the server configured before to run a web project.
You can't convert a Java project to a Dynamic Web Project automatically with JBoss Application Tools. But if you have MyEclipse IDE then it's easy done just by adding a web capabilities. So, choose "New..." project wizard and "Dynamic Web Project" then follow the wizard pages.

Building a Java EE 6 project, with a swing client using Maven

I am trying to recreate an existing project with Maven (any IDE is ok, but mainly Netbeans), and I'm a bit confused about the best way to do this, so any help is greatly appreciated.
Currently I have an Enterprise application with the following components:
Web application (some jsps, servlets).
Ejb project
Client project (Swing application / applet)
Common project (Contains common files used by the applet and the Web app).
The problem is the packaging and dependencies, currently the Client (Applet) jar is packaged within the Web application, so that when the web app is deployed, the users can access the applet via their browser.
Is there any similar existing archetype for this, or does it require heavy customization ?
Oh, and I am using Glassfish 3.1
Thanks in advance.
So first of all, for me it looks like you need multi module maven project. In that case there will be no single archetype that will fulfill your needs.
When it comes to "the Client (Applet) jar is packaged within the Web application" you can use maven-dependency-plugin (http://maven.apache.org/plugins/maven-dependency-plugin/) and its goal:
dependency:copy - takes a list of artifacts defined in the plugin configuration section and copies them to a specified location, renaming them or stripping the version if desired. This goal can resolve the artifacts from remote repositories if they don't exist in local.

Categories

Resources