I'm trying to deploy on Glassfish with another configuration that the one that start Glassfish initially.
But, I got an error that the port 4848 is already used. Obviously, it's the port of the Glassfish admin.
How can I deploy with another configuration to that already started server without getting that error? (like in Netbeans)
Thanks in advance
Julien
Select project --> Click on Run in menu --> Edit configurations
You could use two configurations to do this. The first would deploy your entire app and the second would deploy a part of it. In the second configuration, along with the deployment details you will want to specify the "On 'Update' action" appropriately.
In your configuration you can specify what you want deployed for that configuration. In "Glassfish Server Run/Debug Configuration" click on the Deployment tab and you can choose the specific artifacts in there.
Then once you have the part of the application you want to deploy specified in that tab, you can tell IDEA whether or not it should simply redeploy, or restart the server, or simply update classes and resources, or simply update resources when you run the configuration. This setting can be found in the "Server" tab in the "On 'Update' action" combo box.
Related
In IntelliJ Ultimate 2017.2, in the Run/Debug Configurations dialog, with the Tomcat Server > Local item selected on the left, what exactly is the meaning of the checkbox Deploy applications configured in Tomcat instance? The entire purpose of this dialog is to run my app within Tomcat, so I am confused.
I tried accessing the documentation via the ? icon in the lower-left, but received a 404 error for its URL.
This setting controls whether the apps you already have present in TOMCAT_HOME\webapps directory will be deployed when Tomcat is started from IntelliJ IDEA.
By default that would deploy the following:
docs
examples
host-manager
manager
ROOT
If you don't need any of these default apps or any of your other apps put there manually to be deployed, disable the Deploy applications configured in Tomcat instance option. This will make the server startup faster and it will use less memory.
Documentation page you are looking for is available here, here is the official explanation for this option:
The Tomcat configuration files, among other things, may list the
applications that should be deployed at the server start. If this
check box is selected, all the applications so listed will be deployed
on the server in addition to the artifacts specified on the Deployment
tab. If the check box is not selected, only the artifacts and the
external resources specified on the Deployment tab will be deployed.
I'm trying to deploy-on-save a sample Wicket project from Netbeans 8.0.2 with pom.xml generated as shown here: http://wicket.apache.org/start/quickstart.html. I have added Tomcat to servers and added an admin user and password (checked tomcat-users.xml, of course). When I "Run" the project, Tomcat starts, but the project is not deployed. The "Run" output shows
NetBeans: Deploying on tomcat8
profile mode: false
debug mode: false
force redeploy: true
Starting Tomcat process...
Waiting for Tomcat...
... and once I "Terminate" Tomcat from Servers tab, the build goes ahead and ends up with a WAR file generated in the project's target directory.
I haven't done any changes to the default Tomcat configuration other than adding a user.
By contrast, deploy-on-save works fine with Glassfish-4.1.
I've tried to change the server port and adding <netbeans.hint.deploy.server>t8</netbeans.hint.deploy.server> to pom.xml as some posts suggested (for earlier netbeans versions, though) - but no success so far.
So, is it possible to configure deploy-on-save for tomcat-8.5 in netbeans 8, and if yes, then how?
Ahhaa, upgrading to Netbeans 8.2 (from 8.02) did the trick!
Now, when you "Run" the app, another window pops up and asks for manager password again but just once. That is, the same you gave when adding a server. It seems that one has to add <role rolename="manager-script"/> to tomcat-users.xml manually to avoid this double-asking.
After the first run, the app is re-built and re-deployed on Save.
I have faced problems in trying to install new portlets to Liferay running on Glassfish domain. I figured out the flow very lately and want to share it with others also. So, please read the answer and hope this helps someone :)
(Pre requisites for the problem is that I knew that adding projects running on Glassfish is done with a autodeploy folder, but making them visible on Liferay was another story.)
So, you make first a .war file let's say a portlet of name your_file.war. You wanna have it running on a glassfish domain under Liferay portal.
Steps to success:
1) Navigate to Control Panel -> Plugins Installation on Liferay
2) hit Install new portlets
3) hit Configuration
4) Fill in to Deploy Directory a new place for deployment let's say [your domain]/autodeploy2
5) Check that in the next line target is [your domain]/autodeploy (it is the Glassfish default deployment directory)
6) hit save
Now deployment will be done by copy pasting files to that new directory [your domain]/autodeploy2. The rest of it is handled automatically. Setting takes action imediatedly.
Done with deployment: Make a victory jig and enjoy :)
..you stop dancing and face a bug. You want a new revision to be deployed.. In this case, continue reading.
So, you have built your war again and want to re-deploy. Do the following:
1) undeploy old stuff from (your domain)/autodeploy folder by deleting the war file. Don't delete any other file.
2) result is that your_file.war_UnDeployed file will appear.
3) deploy new file by copying the newly built war in (your domain)/autodeploy2 folder.
4) result is that your_file.war_deployed will appear in (your domain)/autodeploy folder.
Make a dance again :)
There is several methods to deploy plugins (portlets, hooks, filters...) into your Liferay Portal.
If you're using Administration you can do it as Mico descripted. but if you're using Maven, Gradle, Ant, Ivi... you can configure their deployment descriptors and redirect their outputs (that are the wars) to the hotdeploy server folder (If you're using Tomcat, JBoss, Glassfish...).
This approach is quite better because you can create backup webapp folder and restore it whenever you want easily.
Below are not for Glassfish but common startup steps:
To install a portlet in lliferay portal
• first install liferay portal from below link
http://www.liferay.com/en_GB/community/wiki//wiki/Main/Liferay+IDE+Getting+Started+Tutorial
this requires installation of
liferay ide
liferay portal bundled with tomcat
add this tomcat as run server time and start it, it will start liferay portal
• create a portlet application
• open liferay at localhost:8080 and goto Admin -> control panel
• goto Plugins Configuration
• goto Intall tab and give location of war file (some logging error might come
at tomcat console, ignore it)
• again goto home page at localhost:8080 and click + button
• go at the bottom in the list and u will find ur portlet
• click add button present at the right side of it and ur portlet would be added to the page.
Modifying code of portel requires to uninstall and install again the portlet from war file.
All existing added portlets would also be modified.
Now I have several wars and each runs when typing in browser
localhost:8080/app1
or
localhost:8080/app2
etc.
When I type http://localhost:8080, appears only the default page.
I want to make app1 as default app, i.e. it must appear when typing
localhost:8080
and others apps as secondary i.e. they must appear when typing localhost:8080/app2.
How can I do it?
Thanks in advance!
In admin panel: Configuration → VirtualServers. Select “server” (or current default). Populate the 'default web module' select. Save.
If you are deploying manually through the Admin Console, the context root will (by default) be set to the name of the .war.
You can override this in the "Deploy Web Application" screen. You'll want to change the value of the "Context Root" input to / after selecting your .war but before clicking "OK".
You need to provide a context-root node in WEB-INF/sun-web.xml.
From http://www.sun.com/bigadmin/sundocs/articles/urlrdn.jsp:
<sun-web-app>
<context-root>/mywarname</context-root>
</sun-web-app>
My guess would be that saying just / will make it the root application.
(Note that the mechanism is different when deploying inside an EAR)
When developing Maven web applications I usually resort the the jetty-maven-plugin to quickly launch my application for local testing and debugging. Using the launch with m2eclipse has the drawback of not properly including all sources for debugging, even though they are downloaded by Maven ( see Source lookup does not seem to work ).
What is the preferred way to debug Maven web applications in Eclipse? I'd especially appreciate configurations which work with the gwt-maven-plugin.
My preferred way to develop web applications with m2eclipse is to... not use it. Instead, I use the approach described in Debugging with the Maven Jetty Plugin in Eclipse that I'm quoting below:
Step 1
Go to the Run/External Tools/External
Tools ..." menu item on the "Run" menu
bar. Select "Program" and click the
"New" button. On the "Main" tab, fill
in the "Location:" as the full path to
your "mvn" executable. For the
"Working Directory:" select the
workspace that matches your webapp.
For "Arguments:" add jetty:run.
Move to the "Environment" tab and
click the "New" button to add a new
variable named MAVEN_OPTS with the
value:
-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y
If you supply suspend=n instead of
suspend=y you can start immediately
without running the debugger and
launch the debugger at anytime you
really wish to debug.
Step 2
Then, pull up the "Run/Debug/Debug
..." menu item and select "Remote Java
Application" and click the "New"
button. Fill in the dialog by
selecting your webapp project for the
"Project:" field, and ensure you are
using the same port number as you
specified in the address= property
above.
Now all you need to do is to
Run/External Tools and select the name
of the maven tool setup you created in
step 1 to start the plugin and then
Run/Debug and select the name of the
debug setup you setup in step2.
From instructions provided by
Rolf Strijdhorst on the Maven mailing
list
Stopping Jetty
In order to stop the jetty server the
"Allow termination of remote VM"
should be checked in debug dialog in
Step 2. When you have the jetty server
running and the debugger connected you
can switch to the debug perspective.
In the debug view, right click on the
Java HotSpot(TM) Client
VM[localhost:4000] and chose
terminate. This will stop the debugger
and the jetty server.
Try to avoid writing code which needs a container of some kind to debug. Always write code that can run independently and wrap it in a very thin layer for deployment (thin layer -> few lines of code -> few bugs).
If you really must, try MockRunner to emulate the app server.
Other than that, you can manually add the sources in the project properties.