Debugging 2 webapps in the same Tomcat - debugging

I'm looking for a way to deploy 2 different webapp projects (not opened in the same IntelliJ window). I have created 2 distinct debug configurations that both target the same tomcat which is run separately (i.e. it is not started via IntelliJ). However once one of the 2 applications is deployed in debug mode it seems that it hogs the debugging port and the other one might deploy successfully but it is impossible to debug it. I also tried with shared memory and I tried to connect 2 remote debug configurations which also resulted in a failure. I even tried to deploy both applications from one Debug configuration inside IntelliJ and remotely connect the debugger of one of the applications from another instance of IntelliJ and it still fails.
What is the correct way to debug 2 distinct webapps that are deployed under the same tomcat server?

Related

Pass command-line argument for a particular Tomcat web-application startup

For my Spring-Boot project, I have used jasypt library for encrypting my datasource.password in application.properties file. In my localhost setup, I have configured VM arguments in eclipse and it works completely fine.
-Djasypt.encryptor.password
-Djasypt.encryptor.algorithm
Now, I want to deploy my application to Tomcat server where I am not able to figure out where to configure these VM arguments so that Tomcat picks them when I click on "start" button from Tomcat Manager GUI.
Read solutions about setenv.sh but I think that works at complete Tomcat server level. I need to pass these arguments only for my current application without affecting other applications which are already hosted.
Any help is appreciated.

Tomcat immediately undeploys .war after a successful deploy to webapps directory

I have an Octopus deployment plan using the Tomcat Manager step to deploy a .war to a linux box's instance of Tomcat. The deployment seems to succeed, but Tomcat will immediately undeploy it, causing a cycle of deployment attempts until Octopus gives up and fails the deployment.
In my catalina.out log on the target linux box, I see this:
07-Mar-2018 21:16:46.084 INFO [http-nio-8080-exec-120] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /var/lib/tomcat8/webapps/myWebApp.war has finished in 118,532 ms
07-Mar-2018 21:16:56.355 INFO [http-nio-8080-exec-123] org.apache.catalina.startup.HostConfig.undeploy Undeploying context [/myWebApp]
There's 10 seconds in between deploying and undeploying. There's nothing in between these log lines to suggest why Tomcat decided to undeploy the webapps/myWebApp directory. What's strange is, after the final deployment attempt, the /myWebApp directory remains even though Octopus gives up and fails the deployment plan.
I'm wondering if anyone else has seen similar behavior while deploying .war files to Tomcat Manager, or if this behavior suggests a wonky config somewhere I don't know to look for.
Today I had the same problem. I tried to deploy a third application on Tomcat and got the same log output as above (yes, even with a ten to twelve second delay).
After hours I finally found the solution: My new application was developed with Java 11 but Tomcat still runs on Java 8.
I'm sure there must be any exception during deployment but it was not logged to catalina.out. Even in other log files I didn't find any clues.

Jboss deploying a ear and war file in the same server instance

Is it possible in Jboss deploying a ear and war file in the same server instance? If so any good source to get started? Any suggestion.
I have two applications deployed under my default deploy folder of jboss. I am running one application from which i have to call the other application to get some data. Is this possible? If so how to get started??
It is actually recommended that you only put 1 application in a server instance as a time. That said, I have had multiple ears and wars running in the same instance while I am developing. But for production it is better to separate them out. Since there is no extra cost involved this makes it easier to observe and debug apps.
Do you have a specific reason for wanting them to run side by side?
What version of JBoss are you running.

Debugging GWT Client in Eclipse while running on Tomcat (multiple WARs)

I've recently started a new job wherein I have to fix bugs with and make additions to a suite of GWT applications which have had a lot of contributors/developers of the years :(
App Server: Tomcat 6.0.16
JRE: Java 6
GWT: 2.5.0
Eclipse: Juno
The strange thing about this configuration is that for each application in the suite (there's about 4) the client-side code is separated into it's own war file and the server-side code is separated into several war files.
The problem is that the various components (war files) have reliance's on one another and interact during runtime.
Request
Basically, I have gotten server-side debugging working but I would like to get client-side debugging working via Eclipse; so far I haven't been able to.
Code Layout
When the code is fully deployed to Tomcat, it looks like this:
webapps
serverPiece1
WEB-INF
classes
...
web.xml
...
serverPiece2
WEB-INF
classes
...
web.xml
...
clientApp1
WEB-INF
web.xml
index.html
...
clientApp2
WEB-INF
web.xml
index.html
...
clientApp3
WEB-INF
web.xml
index.html
...
Past Experiences
At my last job my team was the only team developing using GWT and Maven.
We were able to design and implement the applications and thus we kept things simple.
For each application, we kept all of the client & server code in 1 WAR file.
All shared components that we created (window management system, etc...) were JAR'd up and included in each applications WAR file.
Doing things this way made for a very simple debug setup; we were able to debug both the client & server code using Eclipse while running the applications in Tomcat or Weblogic.
There is a setting which allows you to start the GWT dev mode with an external server.
See here for more details. Basically you do following things:
Start your App server in debug or run mode (depending if you want to also debug your backend code in eclipse).
Start GWT dev mode with the -noserver option (which won't start the embedded jetty container).
Go to the URL that is served by your app server (i.e. http://localhost:8080/index.jsp?gwt.codesvr=localhost:9997)
If you use maven you can run the dev mode with following command : mvn gwt:run -Dgwt.noserver=true

App hangs on --> 'Initializing Spring root WebApplicationContext' on websphere

When I try to deploy the app ear through RSA on websphere, the deployment hangs on the following line:
Initializing Spring root WebApplicationContext.
Initialization successful.
And then server times out.
How can I troubleshoot this problem?
Which log should I see? The logs folder is rather confusing with too many files.
When I deploy the app through the admin console by building .ear first, it deploys fine.
I assume you are referring to publish the application within RSA/RAD. The logs are the same whether you deploy through this or via the admin console.
SystemOut, SystemErr and trace.logs would be my first points of check.
I am assuming your application spits out this info line:
Initializing Spring root WebApplicationContext. Initialization successful
When does it do this? This would likely occur after the application has been deployed and the application is in its starting phase.
I would check this location
/profiles//installedApps/
Replace all the <...> with the respective values in your environment.
Once deployment is successful you should see a directory with the name of your application eg.
This tells you that the application is installed in your Test environment server.
Publishing effectively does two activities - Install and Start the application.
Once you see the EAR here you know that your problem lies in your application start up activities.
Try and see if you can narrow down from there.
HTH
Manglu

Resources