简体   繁体   English

在Linux上部署Java程序

[英]Deploy java program on Linux

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. 已使用C#开发了一个Web应用程序,该应用程序通过一个宁静的Web服务命中我的Java代码,该服务返回JSON响应。此过程正在具有Tomcat服务器的本地计算机上进行。 Now my Java application needs to be hosted on an external server in Linux environment. 现在,我的Java应用程序需要托管在Linux环境中的外部服务器上。

Using putty, I logged into the particular hostname and as a root admin. 使用腻子,我以root管理员身份登录了特定的主机名。 I have installed Java JDK 1.7, Apache tomcat server 7, my Java application as a war file is placed in the webapps folder. 我已经安装了Java JDK 1.7,Apache tomcat服务器7,并将我的Java应用程序作为war文件放置在webapps文件夹中。 I can start the tomcat server too. 我也可以启动tomcat服务器。

My question is: 我的问题是:

  1. How do I hit my application from windows. 我如何从Windows打我的应用程序。 Is it http://xyzk:8080//MYAPPNAME(war file name)/ ? http://xyzk:8080//MYAPPNAME(war file name)/吗?

  2. How do i check the java logs in the linux env? 如何检查linux env中的Java日志?

  3. Also I have a set of files that I read from my windows folders as in C://uploads//file.txt or C:\\DeveloperTool\\Pluggins\\ 另外,我还有一组从Windows文件夹读取的文件,如C://uploads//file.txt or C:\\DeveloperTool\\Pluggins\\

I replaced them with the linux structure in my java code. 我用Java代码中的linux结构替换了它们。 as /home/opt/file.txt Will this work? 作为/home/opt/file.txt可以吗?

How do I hit my application from windows. 我如何从Windows打我的应用程序。 Is it http://xyzk:8080//MYAPPNAME(war file name)/? http:// xyzk:8080 // MYAPPNAME(war文件名)/吗?

If 8080 is the port Tomcat is configured to listen on (I think by default, it is), then that is correct. 如果8080是Tomcat配置为侦听的端口(我认为默认情况下是),那是正确的。 Bare in mind the web app name is case sensitive. 切记Web应用程序名称区分大小写。 You can configure this setting in $TOMCAT_HOME/conf/server.xml 您可以在$ TOMCAT_HOME / conf / server.xml中配置此设置。

How do i check the java logs in the linux env? 如何检查linux env中的Java日志?

Since you're using a remote shell over SSH, you will want to use either tail or less to monitor logs in real time. 由于您使用的是基于SSH的远程Shell,因此您将希望使用tail或更少的值来实时监视日志。 The log files are stored in $TOMCAT_HOME/logs. 日志文件存储在$ TOMCAT_HOME / logs中。

Try 尝试

$ less +F /path/to/tomcat/logs/catalina.out

catalina.out is the main file when running Tomcat on *nix systems. 在* nix系统上运行Tomcat时,catalina.out是主文件。

Also I have a set of files that I read from my windows folders as in C://uploads//file.txt or C:\\DeveloperTool\\Pluggins\\ 另外,我还有一组从Windows文件夹读取的文件,如C://uploads//file.txt或C:\\ DeveloperTool \\ Pluggins \\

I replaced them with the linux structure in my java code. 我用Java代码中的linux结构替换了它们。 as /home/opt/file.txt Will this work? 作为/home/opt/file.txt可以吗?

As Lutz Horn mentioned in the comments, try it. 正如Lutz Horn在评论中提到的那样,请尝试一下。 In theory, that should work fine as long as the permissions are setup properly. 从理论上讲,只要权限设置正确,它就可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM