How to run multiple servers on Heroku? - java

I have a server installed in Heroku for my app, and now I want to install another Java-based server for my app for log purpose. How can I install a second server in Heroku?

Because this is going to be a different kind of server, the best option would be to create another heroku application for it.
But maybe you don't need to roll your own server to handle logs? Heroku already saves logs for a short period of time. You can view these logs with heroku logs command. There are addons to collect these logs and persist them for a longer period.

Related

How to see tomcat console when tomcat started from services

This might be silly question but I really don't know it.
I have performed some changes in my web application in java/jsp.
Tested it in localhost in eclipse where I can see logs in console.
After that I have deployed the changes to beta server and its not
reflecting as in localhost hence want to see running logs through
tomcat console but Tomcat is already running and was started with
services utility of windows.
Is there any way to open console of running tomcat.
I do know that we can see tomcat logs as well, but running console
will be preferred for me as there are multiple projects are running on
same server.
You can check log file(s) in the tomcat-home/logs folder.
You can attach Eclipse to a running process if you have started the server with the right settings: see Attach debugger to application using Eclipse On windows, you can either delete and reinstall the services as in https://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html or, you can add these parameters in the Windows registry for the Tomcat you are running: see http://www.tomcatexpert.com/knowledge-base/allocating-more-ram-tomcat-windows . I would be very careful with the registry hack unless you've hacked the registry before and are comfortable doing it.

How to make a local test server for an android app?

I basically need to create a test server, something that I can use locally to perform tasks for my application.
So my android app is basically a search engine, however the search queries will be made on the server and the results then fetched from the server on the mobile device as JSON objects.
Is there any way to replicate this functionality locally? I would just like to set up a server, include the Spring framework, the Google Custom Search API and develop it all in Java, then ship it to a live server directly when it's finished. (Most presumably a free tier Amazon AWS server, either EC2 or Lambda, not sure what the difference is).
Not quite sure where or how to get started so any help is appreciated, thank you!
p.s. I may try dabbling in some machine learning at a later date, but I don't know if this will affect anything, this will most likely be after I've got a live server up and running.
EDIT: Sorry, so how would I fetch data from a local server from my mobile device? Do I need special software? Do I need to configure a local server? How can my mobile device fetch data from a second project when its being run on the first?
My app will fetch data from a server, so how can I create a dummy server, for it to fetch data from? Will I need to create a fully functioning online server, or can this just be done through creating a local server of some sort and then simply plugging my android device in and running the code? I have absolutely no idea how to test it without putting it online.
You can run a local installation of Tomcat server on your own machine.
Access the server by visiting "http://localhost:8080/" (or) http://127.0.0.1:8080". You can basically listening to your own local machine / host's 8080 port. Sometimes, it could be port 80 instead of 8080.
Please explore on how to host a Spring or Java application on a local server.
A good starting point would be to learn J2EE or Enterprise Java. You can configure Databases from your local installation.
If you opt for PHP as your language on server side, there is a pre-defined package called WAMP (for Windows), LAMP (for Linux), MAMP (for MAC) and XAMPP.
The above package are nothing but a package which contains a Server, Database and a Server side language usually PHP, if needed Python or Perl.
Please explain in which step you are getting issues so that anyone can help you exactly.

How to run Spark Java application on AWS?

I have developed an app using Spark Java Framework (www.sparkjava.com). I am able to build the artifact on my windows as a JAR file. I can confirm I am able to run it via command line "java -jar App.jar Main.java". It hosts a web app at localhost:4567.
What's the most convenient/quickest way to load this onto an AWS server? I created an EC2 instance (AMI Instance), copied over the jar file to it, ran the command. The log seems to run successfully, but I can't hit the DNS server. It doesn't seem to be up.
I found the solution.
Log into AWS
Click on Instances and click on your Instance
In description, see Security Groups, click on your Security Group
In the Inbound tab, click on Add Rule
Add HTTP, HTTPS, and Custom
For Custom, set the Port to the port that you'd like to be
available to all incoming traffic. Hit apply.

Amazon EC2 stops working unexpectedly

I am facing a problem that is burning my brain. I have an amazon ec2 instance that runs Linux AMI, I installed tomcat7 and I am deploying my webservice in it. This webservice connects itself with an amazon RDS instance where I have my mysql (that I use to validate user and password). When I start my tomcat7 service everything works great, after one hour I can't log in into my system.
If i restart the tomcat7 service, everything works again. But why?
I really don't know where is the problem. I can connect to my database directly from my project in eclipse, and via command line.
I don't know why if I restart the service, my webservice works again. I know that the service hasn't stoped, because I can access the login page of my webapp.
I really appreciate any kind of help,
Rodrigo Araujo.
ps: Last week, everything was working just fine.
I've seen such behavior before, it is probably tomcat and not ec2. Check the following:
1- Your threading configuration (maxThreads and acceptCount). I've seen this behavior using the blocking connector when currentThreadsBusy > maxThreads. Check that you have enough threads or use the non-blocking (nio) connector.
2- Check that your connection pool can reconnect lost connections automatically (autoReconnect=true in the jdbc url), your threads might be waiting db io on lost connections.
Anyway, your ec2 instance is probably still working...

Stop the server using batch file?

Can we stop servers using batch file?
I am using Weblogic (v10) application server.
I want to stop the server or kill the process using batch file.
my application contains three Weblogic instances(Admin Server, Application Server ,Registration Server).
Please tell me how can we stop servers using batch file?
I believe it's possible to script all interactions with WebLogic instances, so my guess is "yes", it can be done.
Yes.
I think iv just found it on Google.
See Starting / Stopping WebLogic Server and notice that you will need to first setup your environment to use the Command-line Commands.

Categories

Resources