简体   繁体   English

库Java项目到动态Web项目

[英]Library Java Project to Dynamic Web Project

I am attempting to make this java application web accessible: http://ge.tt/4jnFeFy/v/0 我正在尝试使此Java应用程序网络可访问: http : //ge.tt/4jnFeFy/v/0

I have imported it successfully into eclipse and followed this guide to convert it to a web project: 我已成功将其导入eclipse,并按照本指南将其转换为Web项目:

http://www.mkyong.com/java/how-to-convert-java-project-to-web-project-in-eclipse/ http://www.mkyong.com/java/how-to-convert-java-project-to-web-project-in-eclipse/

I have then exported the project as a war file which you can see here if interested: http://ge.tt/48bpeFy/v/0 然后,我将该项目导出为战争文件,如果感兴趣,可以在这里查看: http : //ge.tt/48bpeFy/v/0

I put the war file into my webapps directory and it self-extracted to a new folder where I should be able to access it. 我将war文件放入我的webapps目录中,并将其自解压到一个新文件夹中,该文件夹应该可以访问它。 However when I go to localhost/library I get a 404 error. 但是,当我转到本地主机/库时,出现404错误。

HTTP Status 404 - /library/

type Status report

message /library/

description The requested resource (/library/) is not available.
Apache Tomcat/7.0.26

I downloaded the sample war from here: http://tomcat.apache.org/tomcat-6.0-doc/appdev/sample/ and put that in my webapps folder and had no problem accessing it from localhost/sample. 我从此处下载了示例战争: http : //tomcat.apache.org/tomcat-6.0-doc/appdev/sample/并将其放在我的webapps文件夹中,从localhost / sample访问它没有问题。

Why is the java application I converted to a web project not working? 为什么我转换为Web项目的Java应用程序无法正常工作?

There are lot of reason's why your war won't work as expected. 有很多原因导致您的战争无法按预期进行。

  • The link you followed is just to convert a java app project to web app project in Eclipse. 您所链接的只是在Eclipse中将Java应用程序项目转换为Web应用程序项目。 And it doesn't guarantee that it'll work in an Application Server. 并且不能保证它将在Application Server中工作。 ie, what you've done is just made the Eclipse to recognize that project as Dynamic Web Application. 即,您所做的只是使Eclipse将该项目识别为Dynamic Web Application。

  • Do you have any servlets or jsp or html pages inside that war? 在那场战争中,您是否有任何servlet,jsp或html页面? Without it, Web App may not work. 没有它,Web App可能无法工作。

  • Did you check the WEB-INF/web.xml which might not the properly configured. 您是否检查了WEB-INF / web.xml,可能配置不正确。

  • Or your project might not have any welcome page. 否则您的项目可能没有任何欢迎页面。 So, you got 404. 因此,您得到了404。

If possible, upload your deployed war to tell the exact reason. 如果可能,上载已部署的战争以说明确切原因。

我已经下载了Library项目。它应该是桌面应用程序,而不是Web应用程序。如果要将其转换为Web应用程序,则应自己编写servlet或jsp。在编写完servlet或jsp或其他组件后,将其转换为Web项目?如果没有,则出现404错误是正常现象。

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

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