Tomcat Intellij Idea:远程部署 [英] Tomcat Intellij Idea: Remote deploy

查看:738
本文介绍了Tomcat Intellij Idea:远程部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

RackSpace云服务器Ubuntu-12.04,Intellij Idea-11.1.2,Windows-8,Tomcat-7.0.26,JDK-6。

在Intellij Idea上,当我尝试在我的远程Tomcat 7服务器上运行jsf项目时,它说:

On Intellij Idea when i try to run jsf project on my remote Tomcat 7 server it says:


运行 servername时出错:无法连接到 ip-address :1099

Error running servername: Unable to connect to the ip-address:1099

似乎问题是关于JNDI端口是1099,但我想不能激活它。某事Tomcat配置是......像这样:

It seems problem is about JNDI port which is 1099 but I couldn't activate it I guess. Tomcat config is sth. like that:

我尝试了什么?

在服务器端设置CATALINA_OPTS或JAVA_OPTS :

Setting CATALINA_OPTS or JAVA_OPTS on the server side with:

 CATALINA_OPTS=-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port=1099 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false

JAVA_OPTS=-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port=1099 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false

但是这个没有用,有什么想法吗?

But this one did not work, any ideas?

推荐答案

我对我的问题的回答:

远程部署的正确方法是在远程服务器上编辑JAVA_OPTS环境变量。只需输入以下命令:

The correct way to deploy remotely is editing JAVA_OPTS environment variable on the remote server. Just enter the command below:

export JAVA_OPTS="-Dcom.sun.management.jmxremote=
-Dcom.sun.management.jmxremote.port=1099
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false"

如果这不起作用,如果您对通过Intellij Idea部署网站没有任何痴迷,我就有了解决方案对于这个问题。为了能够在Tomcat下运行您的网站,您可以/应该以 .war 文件的形式获取工件。

If that's not going to work and if you don't have any obsession to deploy your website via Intellij Idea, I've got the solution for this problem. To be able to run your website under Tomcat, you can/should get artifact in form of .war file.

可以从项目设置(ctrl + alt + shift + s)在Intellij中完成,然后点击加号按钮并添加新工件(web:application archieve)

It can be done in Intellij from project settings(ctrl+alt+shift+s) then hit the plus button and add new artifact(web:application archieve)

重建工件后, .war 文件可以在 project-folder \out \artifacts <中看到/ code>。接下来,您应该将此文件放入 tomcat / webapps 文件夹中。

After rebuilding the artifact, .war file can be seen in project-folder\out\artifacts. Next, you should place this file into your tomcat/webapps folder.

例如,如果您使用的是Tomcat- 7,我的意思是文件夹存在于 / var / lib / tomcat7 / webapps 中。在复制 .war文件之前,您应该将其重命名为 ROOT.war 。这提供了通过 http:// youripaddress:8080 直接访问您的网站。重新启动Tomcat7服务后,您可以访问该站点。

For example if you are using Tomcat-7, the folder that I mean exists in /var/lib/tomcat7/webapps. Before copying your .war file you should rename it as ROOT.war. This provides to access your site directly by http://youripaddress:8080. After restarting Tomcat7 service you can access the site.

但尚未完成,您可以远程调试项目,就像使用Intellij Idea在本地计算机上调试项目一样。在Idea中打开运行/调试配置,点击加号按钮,必须有远程。这是为JBoss,Glassfish以及Idea等应用程序服务器调试项目的方法。输入您的主机和端口号,选择您的项目作为模块。

But not finished yet, you can debug your project remotely like you are debugging your project at your local machine with Intellij Idea. Open Run/Debug Configuration in Idea, hit the plus button and there must be Remote. This is the way to debug your projects for application servers like JBoss, Glassfish as well in Idea. Enter your host and port numbers, select your project as a module.

在开始调试之前,正如Intellij所说,您应该将以下参数提供给服务器JVM:

Before starting to debug, as Intellij says you should give the following parameter to your server JVM:

JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"

为了能够在Ubuntu和Tomcat-7中执行此操作,修改了<$ $中的catalina.sh文件c $ c> usr / share / tomcat7 文件夹。如果[-z$ LOGGING_MANAGER],我在上面插入了参数;然后行。它必须位于文件的中间部分。然后你应该能够使用Intellij Idea调试你的项目。

To be able to do that in Ubuntu and for Tomcat-7, modified the catalina.sh file in usr/share/tomcat7 folder. I inserted the parameter above of the if [ -z "$LOGGING_MANAGER" ]; then line. It must be on the middle part of the file. Then you should be able to debug your project with Intellij Idea.

这篇关于Tomcat Intellij Idea:远程部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆