Deploy java program on Linux - java

A web application has been developed in C# which hits my Java code through a restful web service which returns a JSON response.This process was working on a local machine with tomcat server. Now my Java application needs to be hosted on an external server in Linux environment.
Using putty, I logged into the particular hostname and as a root admin.
I have installed Java JDK 1.7, Apache tomcat server 7, my Java application as a war file is placed in the webapps folder. I can start the tomcat server too.
My question is:
How do I hit my application from windows. Is it http://x.y.z.k:8080//MYAPPNAME(war file name)/?
How do i check the java logs in the linux env?
Also I have a set of files that I read from my windows folders as in C://uploads//file.txt or C:\DeveloperTool\Pluggins\
I replaced them with the linux structure in my java code. as /home/opt/file.txt
Will this work?

How do I hit my application from windows. Is it
http://x.y.z.k:8080//MYAPPNAME(war file name)/?
If 8080 is the port Tomcat is configured to listen on (I think by default, it is), then that is correct. Bare in mind the web app name is case sensitive. You can configure this setting in $TOMCAT_HOME/conf/server.xml
How do i check the java logs in the linux env?
Since you're using a remote shell over SSH, you will want to use either tail or less to monitor logs in real time. The log files are stored in $TOMCAT_HOME/logs.
Try
$ less +F /path/to/tomcat/logs/catalina.out
catalina.out is the main file when running Tomcat on *nix systems.
Also I have a set of files that I read from my windows folders as in
C://uploads//file.txt or C:\DeveloperTool\Pluggins\
I replaced them with the linux structure in my java code. as
/home/opt/file.txt Will this work?
As Lutz Horn mentioned in the comments, try it. In theory, that should work fine as long as the permissions are setup properly.

Related

Can not run jar file on websphere

I had problem with Websphere.
I want to run test.jar in websphere.
I copy test.jar in dropins and run "sh ./server start --archive="java -jar ../dropins/test.jar"
Starting server --> ok
But console.log empty
It's not clear from your description exactly what you're trying to do, but based on your title, I assume you're trying to run a Java application. Liberty is an app server for running Java EE apps, but given that you're trying to run a file ending in .jar, that is more typical of a standalone (Java SE) app. Also, the command line you're using is mixing options, the --archive option is for specifying a target file for the server package or dump operation. See the IBM help topic https://www.ibm.com/docs/en/was-liberty/base?topic=line-server-command-options for more details. On the Liberty app server, you can deploy Java EE (not Java SE) apps by copying the .ear or .war of the app to the dropins directory. If you provide additional details about the contents of test.jar and what you're trying to achieve, you'll get a more complete answer.

deploy jar on Windows Server AWS EC2

I need to run a jar on a windows server instance.
I would like to build/update/redeploy the jar through a script.
On Linux I know how this works but I cannot seem to find any information how this works on Windows server.
I build the jar somewhere on jenkins.
On linux I can scp (ssh-copy) the jar to the server on a certain location. Then restart it.
In Windows don't even know how to copy the file on to the server without logging in manually via RDP.
I would like a scirpt that I can run in jenkins, that connects to windows server. Stops the running jar and exchanges it for the new one. Starts it up again. (with windows file handles I'd have to stop it before overwriting the jar).
How does CI work on windows server?
PS:The issue is that the jar starts up a process which only runs on windows server in a NON headless mode and thus, I cannot get around windows.

Local jnlp application blocked by java security

I have an HP Proliant remote application card installed in my server, and it uses a java app (jnlp) for KVM access. Due to the incorrect way it's configured, no browser will run the jnlp file it provides; they all just download the file, and then I've just manually run it from my file manager.
Enter Java 8, where medium security is no longer an option. When I try to run the jnlp file, it tells me it's blocked by java security, so how can I run this jnlp file now? I've tried adding localhost and 127.0.0.1 to the exceptions list, but that didn't help.

Where do I locate Java Servlet container

I have installed JRE and now I'm trying to install Solr by following the Solr Reference Guide.
The guide dictates:
Stop your Java servlet container.
Copy the solr.war file from the Solr distribution to the webapps directory of your servlet container...
Start your servlet container, passing to it the location of your Solr Home in one of these ways:
Set the Java system property solr.solr.home to your Solr
Home. (for example, using the example jetty setup: java
-Dsolr.solr.home=/some/dir -jar start.jar). Configure the servlet container so that a JNDI lookup of java:comp/env/solr/home by
the Solr webapp will point to your Solr Home. Start the
servlet container in the directory containing ./solr: the default Solr
Home is solr under the JVM's current working directory
($CWD/solr).
Questions:
Where do I find this Java Servlet container?
Where/how do I execute those commands to start/stop/configure the Java Servlet container?
How do I set Java system properties?
Mine was quite straight forward. After downloading the file, I extracted it to a folder on my Server. I used the Command Line to complete the installation.
With the Command line, navigate to the example folder inside the solr-X.XX.X folder you extracted the file to, once there run the java command:
cd C:/<folder>/app/solr-X.XX.X/example
java -jar start.jar
It would perform the installation for you, like magic.
You can access SOLR by visiting localhost:8983/solr
I'm using a Windows Server though, it may be different on yours, but I guess the logic is the same.
You should to install Apache Tomcat. All information about these servers you can find here.
You also could to install Jetty, JBoss, vSphere, tc vFabric Server ... but I think that you'll setup tomcat and solr easier (it is mine personal opinion, if you are familiar with any one, use them of course).
Tomcat setup is described here.

"Failed to create java" on running Windows service

I have a java application, which has to run as windows service.
I am able to install the service using the following command.
"%EXECUTABLE%" //IS//%SERVICE_NAME% --StartClass %STARTER% --StopClass %STOPPER% %START_PARAMS% %STOP_PARAMS%
The service is installed successfully but when i try to run it it shows Failed to create java. path also it is not showing in the jkartha log file.
I have JAVA_HOME environment variable pointing to jdk1.5.
and even i copied msvcr71.dll to windows\system32 folder and restarted the PC.
I am running this on windows 2008 server.
I didn't install apache tomcat server. prunsrv.exe and procmgr.exe i just copied.
Please suggest me how i need to overcome this problem.
whether to run application as windows service, prunsrv.exe, prunmgr.exe are enough is it? I am able to successfully install but not able to start why???
You probably need to set your service to run as the user that installed Java, otherwise it won't find its environment variables.
If you must run in the default Local System account, then you can run a batch file that sets up the environment and then launches java.exe.

Categories

Resources