debug java web application packaged as war file in eclipse - java

I am new to web applications in java and need a bit of help with this. I have a multi module project set up in eclipse, which also contains WEB-INF/lib directory of the WAR.
In the non-web version i can debug though it fine however when i deploy it to weblogic i am encountering errors which i dont get on my local workspace, so i'm trying to deploy it using tomcat. I installed tomcat and deployed the war file onto it. I see a blank page (which is normal - essentially the application has a listener, i send it a jms message and that kicks off the process afterwards) but i dont know how to put a break point so i can step though the code - line by line - if this is possible?. Would appreciate some references / reading material.

Related

Jenkins deploy plugin deletes app context xml file

I am using Jenkins (v1.4.87) and have the deploy plugin (v1.10) to create a job that deploys a built war file into tomcat 6.
The deployment is running successfully, the war is being deployed ok.
Here is the plugin configuration part of the job:
(I have not included the real server details for obvious reasons)
The problem is that somewhere along the way, the application context file is renamed to appname.xml.bak and left in that state. Therefore the application fails to start because tomcat cannot find the context file it expects for the application any longer.
To remedy this I have to log into the server where the context file is located and rename the backup back to its original file name appname.xml.
It feels like the deploy plugin may be getting to a point where it should handle this. I would expect it to either make a copy of the context file called appname.xml.bak or rename the backup back to the correct file name.
I cannot find any documentation that lists out the phases that the plugin goes through so I cannot confirm if this behavior is expected or not. I am left with the only option to download the plugin code from Github and figure it out myself.
Have I missed something obvious maybe?
UPDATED:
I have since updated to Jenkins v2.32.3 and I have the same issue with the deploy plugin. Any help would be great thanks.

Tomcat reloading exploded war with spring-loaded

There's alot of questions on different forums [1] [2] [3] about this topic but none seem to provide a definitive answer. I've tried different combinations suggested in the various posts but I have yet to succeed.
My goal is to make compiled source code in a standalone tomcat (8) reloadable - just like the embedded tomcat reloads newly complied sources in e.g. spring-boot or Grails. There are a few constraints that I need to comply with:
No Grails or Spring-boot is available
No Maven or Gradle is available
The tomcat should read the exploded war file from an external location
To keep things simple I use a very simple JEE app with Spring MVC as POC for this before I move on to the real deal. The setup is as follows (for now):
Exploded war builds into directory target/exploded
Tomcat is setup with default settings except from Context.xmlwhere the two lines regarding WatchedResource are removed. Context is not set to reloadable="true".
The Tomcat server is run from within IntelliJ Idea (2016.3) like this:
where the "exploded" folder points to the target described above. And the "Server" tab like this:
The server starts up and the app is running fine. I then try to change some code, save it, and build a new exploded war file. I can see the class files change - but nothing is reloaded in tomcat.
Can anybody please elaborate? Is this approach even possible - in contrary to what many posts suggest? How is it possible in the embedded tomcat in e.g. Grails?

Error renaming to MANIFEST.MF

I am curious about following error :
Publishing to JBoss 7.1 runtime server - MyEAP has encountered problem
Error renaming C:\(some path) to (MyEAR proj path)\(my war file)\META-INF\MANIFEST.MF
you can change these settings in server etc...
I have created a simple EAR project along with a dynamic web project with stuts2. I am deploying EAR file and everything is working fine but whenever I make changes to any file and save I get this error message. What is the exact meaning of this message?
Thanks
Maybe the problem to be that it is necessary to configure a scanner for external deployments.
See: 'Publishing to JBoss 7.1 Runtime Server...' has encountered a problem
In previous versions of JBossAS, there was an exposed JMX server with
an option to mark a folder as one that the deployment scanner should
look at. This option still exists in AS7, but, we haven't integrated
with the management ability yet. THis means we can't do it on the fly,
currently, in the current toolset is a bit hurt by this missing
feature.
It is still possible in the raw configuration of the server, howerver.
This means you can mark your server directly to scan some external folder by modifying
your configuration and adding a deployment scanner. The instructions for it are over here:
https://community.jboss.org/wiki/DeployingAnApplicationFromAnExternalDeploymentLocation
To make use of this, double-click your jboss-7 server inside eclipse
to open the server editor. You can then switch over to the second
page, "Deployments", where you can change the deployment method to
"custom" and set any folder that's on the same filesystem as your
eclipse installation. Once this is done, you can add that folder to
your server's deployment scanner lists as per the wiki above.

JSP changes not reflecting when server is run. (JBoss, Maven, Eclipse)

I don't think the issue is isolated solely to my JSPs. However, the current files I'm trying to edit are JSPs.
Whenever I make changes to my JSP, I save the file (in Eclipse), clean/republish my JBoss server, start the server, and access the application (localhost), yet the changes I made are not reflected on the page at all.
I go to the JBoss temp directory to see exactly what version of the file (that I'm editing) the server is currently using. I always see that it's using the original version that I pulled down from the original repo. I have no idea why it's not changing.
I tried re-cloning and re-importing everything just out of desperation, and I'm getting the same results.
In addition, strangely, when I run the command mvn -U clean package -DskipTests=true to do a command-line build using Maven, my file reverts back to the original/unchanged version. (New to Maven, so it's strange to me at least).
So, essentially any changes I am making to files for my project aren't being reflected on my local test server. I'm totally stumped as to why it's behaving like this.
You can put JBoss in development mode. This is a mode in which JSPs are always re-compiled. Thus when you deploy a JSP change, you can immediately see it.
For JBoss 7, edit the file: /jboss/{server_name}/configuration/standalone.xml. Locate the "jsp-configuration" element and set the "development" attribute to true.
<configuration>
<jsp-configuration development="true" x-powered-by="false"/>
</configuration>
Note:
This file is in a different location in different versions of JBoss.
{server_name} in the path above will be specific to your JBoss install. If you have not created a server, then this value is likely "default" for you. You can easily find this value by looking at where your web app is deployed.
It is a good idea to deploy your web application in "exploded" format. That is, rather than deploying it as a WAR file (which takes time to build), explode (i.e. unzip) the contents of the web app right in the JBoss deployment area. That way when you need to make a JSP change, you simply copy the one JSP file.

JBoss 5.1 shows "Failed to process changes" when hot-deploying a WAR

I'm very new to this, so there's a good chance I'm doing something wrong, but I'm just trying to get set up with writing some JSPs using JBoss 5.1. I write the JSP page (really basic, just some HTML and a little bit of output to make sure the JSP is actually being processed) then I try to build the WAR and hot deploy it with the following commands:
jar -cvf jsptests.war *.jsp WEB-INF
copy jsptests.war "%JBOSS_HOME%\server\default\deploy"
If I do this without having JBoss running, then it will copy into the deploy folder and it will appear after I start JBoss, however, if I do the same thing while JBoss is running I see the following error in the console:
WARN [org.jboss.system.server.profileservice.hotdeploy.HDScanner] (HDScanner) Failed to process changes
java.lang.RuntimeException: Error while adding re-deployments
I've seen a few others experiencing this on some other forums but haven't found an answer anywhere. Thanks.
This happends when the file is not fully copied, but JBoss's hot deploy scanner sees a .war file there and tries to read it.One way to do solve this is to move/rename the file rather than copy it as that operation is atomic on most operating systems (i.e. JBoss will not be able to "see" it until the operation is finished and thus it will not read an uncomplete file)

Categories

Resources