There is an application, say myApp.war (developed using Spring MVC) that I give the users to deploy in their tomcat webapp folder. When the user starts tomcat, the war is exploded, and then I ask the user to go myApp/WEB-INF/classes/persistence.properties and ask him to edit just one property name (actually an HSQLDB path). Post that I ask the user to stop tomcat, delete the war file and start tomcat server again. And the application is up and running.
Although the users are not complaining, I believe there has to be a better way of doing this. For example when the users deploy wordpress or hudson and the first time they try to access the app. they are redirected to an install page where they do their basic configuration and they are up and running. How can I achieve it here.
I have used JNDI to solve this very problem in the past. Here is a nice example to show you how to do this with Spring:
http://www.journaldev.com/2597/spring-datasource-jndi-with-tomcat-example
Checkout JMX which can allow on the fly configuration, or there is one obix framework
Why not something like this:
Use a relative path with sysprops, like ${user.home}/path-to-hsqldb. If the user runs tomcat as user "jim", it will look in c:\users\jim\path-to-hsqldb (Windows) or /usr/jim/path-to-hsqldb (Linux)
You might need to use Spring's <context:property-placeholder/> to enable this.
Related
im new to Java Spring and when i am starting netbeans with a new web project, i have the option to choose a framework. When I'm choosing Spring MVC, i have got an embedded tomcat out of the box. I liked it very much! So easy it can be! But this make it complicated to understand what is happing behind. I want to know, how to create a https connection, without configuring in the tomcat settings. (Or is this the only way?) I tried this one, but than you have to start tomcat manually with the batch-file. When using http-connection und you running your project it usally reachable and you do not need to start tomcat! I dont know how it works, but i think it starts the embedded tomcat and listing to a random port, the url is printing out when starting project. Another question is, where can i change the url name? Now i have this one:
http://localhost:8084/projectname/
And i want to give a customer name. Maybe someone answer to this question or post a link with useful information how to configure embedded tomcat. For me it is important to keep the default construction of java spring in netbeans!
And i want to use the dispatcher.xml, web.xml -> So don't want to switsch to use tomcat in my javacode! Hope that this is possible!
Thank you very much, Mira.
Hi I have been getting troubles with the deploys in an application java/tomcat in EBS, every time I made a deploy al the user files are deleted because all the folders related to it are been placed in the webapp folder, because of that I need to move those users folders out of webapp, or at least it is the solution that several websites said. Based on it they said I need to add something like this
<Context docBase="/home/ec2-user/files/" path="/userFiles" />
on the server.xml file, but it is not working in my case, I guess it is because AWS elastic bean stalk . Someone have an advice or a solution to this?
Thanks.
I'm trying to deploy my first servlet to my server. There are, of course, many tutorials online. But most of them are very detailed and complicated, and I only need to deploy a few simply servlets to this server.
I found what I think to be the shortest method of deployment: Deployment on Tomcat Startup. I moved my .WAR file (FirstProject.war) into $CATALINA_BASE/webapps folder, but when trying to access it (ServerIP/FirstProject) I get the "The requested resource is not available." error.
Is there anything I forgot in the process of deployment?
I know that deployOnStartup has to be set to true, but I didn't change anything with the server's hosts, so the current host is localhost. I didn't change its settings, so deployOnStartup should be true (It's said that true is the default).
What am I missing?
You are using easiest way but I don't know what you are missing. Here what I would suggest is run your server and access through localhost:8080 then click manage app then enter username and password then you can deploy your war.
If you have any query post command.
Even i used to face this problem while deploying my first web application on Jboss and Apache ..
Even though your code is working properly with all your servlet mappings and paths using in your content files ...some times they kick back in real time environment ..So we have to know the proper deployment folder structure and accordingly we have to change our paths in the code
what i am concluding is check the below lines of code
Examples, assuming root is http://foo.com/site/
Absolute path, no matter where we are on the site
/foo.html
will refer to http://foo.com/site/foo.html
Relative path, assuming the containing link is located in http://foo.com/site/part1/bar.html
../part2/quux.html
will refer to http://foo.com/site/part2/quux.html
or
part2/blue.html
will refer to http://foo.com/site/part1/part2/blue.html
Simple question, maybe someone knows:
In GWT devmode, my urls look like this: http://myserver/myapp/myservice
When I run 'ant war' and deploy that war on tomcat, they mysteriously change to: http://myserver/myapp/myapp/myservice
Everything still works, but obviously the URLs are uglier. I'd like to just keep the URLs used in devmode. Any info is appreciated, thanks.
-tjw
Deploy the web service as ROOT.war, not as myapp.war, because the first 'myapp' is the web application context path, and 'myapp/myservice' is the path inside the web application.
Change your mappings in your web.xml to all start with / instead of /myapp/ and deploy your application as myapp.war or deploy the war as Root.war
Ok, I've got a solution for this. So many people are having this problem all over the net, I decided to answer my own question. The key is to use #RemoteServiceRelativePath in your RemoteService interface file. For example, to solve my original problem, I would annotate my RemoteService interface like this:
#RemoteServiceRelativePath("../myservice")
This way, whatever path is in front of the service's URL is irrelevant. Now in the web.xml, instead of using /myapp/myservice as the url-pattern, I just use /myservice. Now it works in both GWT's devmode and in Tomcat with no further modification needed.
I have Jboss 5 installed/configured. I would like the ability to have Jboss auto start when my VM boots up. I see in my Jboss bin directory I have a startup script jboss_init_redhat.sh
I am assuming I have to get that script into my /etc/rc.d/init.d/jboss file
Then I am stuck, what is my next step?
Thank you for helping a beginner
According to How do I Start JBoss on boot with Linux? on JBoss Community Wiki, your task is to:
create a user for JBoss (recommended) so that JBoss can be
restricted to accessing only the files
and system resources that it has
permission to access via the "jboss"
user.
create a script called /etc/rc.d/init.d/jboss
create a link called /etc/rc3.d/S84jboss
optionally /etc/rc5.d/S84jboss and /etc/rc4.d/S84jboss
create a link called /etc/rc6.d/K15jboss
create the K15
link in /etc/rc1.d, /etc/rc2.d,
/etc/rc0.d
For the 2nd step, you can indeed use the jboss_init_redhat.sh file that ships with JBoss. For more information, check the link given above, it details each step.
The stock init script is very primitive; here's my take at a better one: https://jira.jboss.org/jira/browse/JBPAPP-3194