简体   繁体   English

在Glassfish服务器上运行应用程序时,Eclipse无法打开浏览器

[英]Eclipse not opening browser when running application on glassfish server

I am running eclipse Luna with glassfish 4.1 . 我正在运行带glassfish 4.1的月食月神

Everything seems to be running fine except when I use the option "Run As/Run on Server" the IDE does not open a browser to the context root of the application, like I would expect. 除了使用"Run As/Run on Server"选项之外,一切似乎都运行良好,IDE并没有像我期望的那样打开浏览器到应用程序的上下文根。 Glassfish is started and the application deployed successfully but no browser is opened. Glassfish已启动,应用程序已成功部署,但未打开浏览器。

If I do the same to a TomCat server a browser is opened to the context root of the application. 如果我对TomCat服务器执行相同操作,则浏览器将打开到应用程序的上下文根。 I can open a browser manually and type the URL and it works as expected but I would really like the time savings of this happening automatically. 我可以手动打开浏览器并输入URL,它可以按预期工作,但是我真的很希望自动节省时间。

Inside your Eclipse, click in "Window" -> Web Browser -> Choose your browser . 在您的Eclipse中,单击"Window" -> Web Browser -> Choose your browser

Then right-click your project and run it. 然后右键单击您的项目并运行它。

Tested it with Eclipse Kepler, everything working correctly. 使用Eclipse Kepler对其进行了测试,一切正常。

Put file glassfish-web.xml in WEB-INF folder. 将文件glassfish-web.xml放在WEB-INF文件夹中。

glassfish-web.xml content: glassfish-web.xml内容:

  <?xml version="1.0" encoding="UTF-8"?>

   <!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1    Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
  <glassfish-web-app>
  <context-root>/yourapp</context-root>
 </glassfish-web-app>

Well I even reinstalled eclipse and the glassfish pluggin, to no avail. 好吧,我什至重新安装了eclipse和glassfish插件,无济于事。 But it did discover I can open the browser to the root context from the Servers pain, by right clicking on the deployed application and selecting "Open in Browser". 但是它确实发现我可以从服务器的痛苦中打开浏览器到根上下文,方法是右键单击已部署的应用程序,然后选择“在浏览器中打开”。 That works for me. 这对我行得通。

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

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