Problem deplopying war on jetty 6 - java

Jetty cannot unzip my Wicket application war and extract to the temp directory. It is able to unzip the example wars without issue.
I have two identical installations on 64 bit linux (Centos) using Jetty 6.1.16 and 64 bit java 1.6. One works and one is unable to unjar/zip the war and deploy it. I compile using 1.5 compatibility. I use maven to generate the war file. If I deploy the .war I get a general error - cannot unzip. If I unwar the web app to a file system and deploy that to Jetty it works fine.
To make sure it isn't a permissions problem I ran it as root but saw no difference no difference.
I actually get NoClassDefFound errors when deplopying as war to be extracted.
I can ask Jetty not to extract the war, but when I do I get another error ...
org.apache.wicket.WicketRuntimeException: Unable to load initializers file
Caused by: java.util.zip.ZipException: error in opening zip file
The deployment directory is listed in the output, but when I look in it, it is empty. Odd thing is the example war that comes with Jetty extracts and runs just fine without error, so it seems to be something about the way the war file is being created on my end (war created using eclipse/maven on 32 bit Vista). But again, it works fine on another virtually identical server wich makes that unlikely.
Was hopeing someone had a ready answer before I tear it all down and reinstall everything :-).

Sounds like an issue with file system permissions. Did you make sure that the user under which you run Jetty has write permissions to the directory where the war is supposedly to be extracted to?
The algorithm by which Jetty determines where to unzip a web application can potentially choose a bunch of directories. You should probably also sanity-check the variables that play a role in this algorithm and make sure that the user running Jetty has sufficient read/write permissions on these directories.

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.

Run spring project on server [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am using windows 7.
I have written a simple Spring3 Hello World using Eclipse and successfully run it using tomcat on my computer.
Now I have a Server which runs Linux.
I would like to run the project that I just wrote on my server. It has no GUI or anything of the kind so I can't simply start up eclipse and write the same project on the server.
How do I go about doing that? I am completely new to the whole java and Spring thing, and have absolutely no clue as to how to run my project on the server and be able to view it.
I have searched everywhere online trying to figure out how to put my project on the Server, but it seems like Spring isn't the most noob friendly, especially with its documentation. There doesn't seem to be any explanation on how to take your code from one computer and put it into another and make it work.
There doesn't seem to be any explanation on how to take your code from one computer and put it into another and make it work.
That's right, as it is not often considered "not a programmers job". Its not very related to the framework you're using (Java EE or Spring or whatsoever), instead it's more of an infrastructure thing (related to the operating system and application server that are being used). Nevertheless, it can be very useful to know how the process works.
Generally speaking there are two steps:
Packaging - If you use Maven, you simply run the mvn package command. Or using Eclipse, you can export your project as an WAR-file (Right-click your project, click Export, search for "WAR"). I would advice to use Maven, but that's a bit outside the scope of your question probably. Either way, this step will result in a WAR file.
Deployment - This is a bit harder. The WAR file from step 1 needs to be copied to the Linux server where the application must be ran, and then copied into a special directory where the application server looks for apps. If you're using Tomcat on the Linux machine as well, look for the Tomcat installation directory and find the 'webapps' subdirectory. Other application servers have other procedures / locations, though.
This is under the assumption that Tomcat was already set up for you on the Linux server, and that is running.
This has nothing to do with Spring and everything to do with packaging your application and deploying it in a Servlet container/HTTP server.
Setup Apache and Tomcat (or some other servlet container) on your linux server.
Package your Spring application as a war file (either with maven, ant, Eclipse, or some other build tool).
Drop the war file in the /webapps directory of your Tomcat installation.
Start Tomcat.
Well first you need to get tomcat 'http://tomcat.apache.org/download-70.cgi', and set it up on the linux server you are trying to deploy to.
Then you would export your project as a .war archive in eclipse (File -> Export -> war)
Copy the war file to your server, and copy it into TOMCAT_HOME/webapps
Start up tomcat and you should be able to access the application under localhost:8080/{APPNAME}, so if your war name is myapp.war the url will be localhost:8080/myapp
good luck!
Spring is just a 3rd party open source API. You can do without Spring and still be able to "run" your application on a server.
By "run", this means that your project must be placed in a directory in the server's filesystem, most of the time in the form of a WAR file.
I said most of the time, because if done correctly, you can actually put your project directory inside the server, and it will run without transferring it as a WAR file.
A WAR file is just an archive that has a standard directory structure so that it is readable and executable by the server.
Read the following link on how to package your project as a WAR:
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.wst.webtools.doc.user%2Ftopics%2Fcwwarovr.html
And then just copy the WAR file to the TOMCAT_HOME/webapps folder.
Packaging
cd c:/my_project_directory/Web/
jar cvf web-archive-test.war .
Deployment
cd c:/my_project_directory/Web/
scp *.war
your_username#remote_linux_host:/some/remote_directory_where_tomcat_is_installed/webapps/

Installing a game on Tomcat. Newb here

this might be a tall order or it might be ridiculously simple. I wanted to run this game on my website: https://github.com/ajanata/PretendYoureXyzzy
Unfortunately I have no clue how to make something like this work. There didn't seem to be an installation file, so I can only imagine it's painfully obvious to anyone familiar with this sort of thing. I recently ordered a trial of a shared Tomcat server, since I'm assuming that's needed to run all the Java goodies.
If there are any simple instructions I should follow to install this, it would be much appreciated if you could share them!
You need to download the source from the Github link you provided and then download Eclipse - Java EE. You then open Eclipse and choose File->Import->General->Existing Projects Into Workspace and choose the folder you just downloaded. You can then choose Export->Web->WAR file and export the WAR file.
You then download and setup Tomcat as described here (ignore the parts after Tomcat is running and you can access it at http://localhost:8080) and install the WAR as described here.
If you are feeling exceptionally lazy I have built the war here. You just need to drop it into the webapps folder in your Tomcat installation and then restart your server. You can then access it at:
http://localhost:8080/cah.
Hard to say without looking deeper into the project, if they create a .war file somehow, just copy the .war file into [tomcat home]/webapps directory and your application will be deployed. You can then acces it at yourmachine:8080/warname
where warname == the name of the war file without the .war extension.
There appears to be a SQL script with the project as well, not sure if there is some database you might need to setup which could get tricky.

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)

War deployment on Tomcat takes ages

I have a Grails application, built to a war file (~30mb). When I attempt to deploy the war file on Tomcat 6 via the application manager, it takes upwards of 10 minutes to deploy, or hangs indefinitely. When it hangs I can restart Tomcat and the app is usually deployed, however sometimes I have to repeat the process. I've also noticed that during deployment, the Java process maxes out the CPU and the RAM is at ~10-15%.
I'm fairly new to Java, so I don't know if this is normal, but I can't imagine how it could be. Is there something I can do to make this run smoother/faster? Is there a better way to deploy than Tomcat's app manager?
I upload the WAR to my home directory, cd to /usr/local/tomcat, then run the following commands:
bin/shutdown.sh
rm webapps/ROOT.war
rm -rf webapps/ROOT
cp ~/ROOT.war webapps
bin/startup.sh
Definitely check the Tomcat logs for any errors/warnings.
You probably have some expensive/sensitive code logic in one of the ServletContextListeners. They are usually initialized during startup. If so, then I would debug/profile it for any performance matters/leaks.
As noted I would copy the war to the webapps folder and let tomcat do the deployment, its also quicker saving you time.
Both Tomcat and Jetty will support a hot deploy. They simply monitor the deploy directory for changes, so you can just copy the .war file into that directory, and the server will undeploy/redeploy.
If using a remote server check the lag is not the time take to upload the war to a remote server over the network.
Don't use application manager. My way is to upload it somewhere out of the webapps directory and then copy it to webapps directory. Takes a lot less of deplyoment time.
It's not always that you have sufficient access rights to manually put files in the webapps folder -- you are supposed to use the Tomcat Application Manager for .war file deployment, and need to make it work.
For me, it has been common that the process of uploading of a .war file to the server cannot complete; it gets stuck somewhere in the middle and the file is only partially uploaded to the server, no matter how many times I retry. In such situations, I have found it worthwhile to try another browser. For instance, I've found myself stuck using Google Chrome but once I switched to a freshly started Firefox browser, things worked out.
This may be relate to this BUG of JDK
I readed this article, Tomcat7 starts too late on Ubuntu 14.04 x64 and resolved my problem.
Try to resolve it by replacing
securerandom.source=file:/dev/urandom
with
securerandom.source=file:/dev/./urandom
in $JAVA_PATH/jre/lib/security/java.security

Categories

Resources