eclipse 无法发布到服务器。雄猫 7.0
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11635195/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Could not publish to the server. Tomcat 7.0
提问by user1549311
I am getting below error when trying to deploy war file on Tomcat 7.0.28 server. My Eclipse is Eclipse Java EE IDE for Web Developers.Version: Indigo Service Release 2 Build id: 20120216-1857. I would appreicate if anyone can provide a solution/fix? Is it related to version of eclipse or tomcat compatability? Thanks.
尝试在 Tomcat 7.0.28 服务器上部署 war 文件时出现以下错误。我的 Eclipse 是面向 Web 开发人员的 Eclipse Java EE IDE。版本:Indigo Service Release 2 构建 ID:20120216-1857。如果有人可以提供解决方案/修复,我会很感激吗?是否与eclipse版本或tomcat兼容性有关?谢谢。
java.lang.NullPointerException
at java.io.FileInputStream.<init>(Unknown Source)
at org.eclipse.wst.server.core.util.PublishHelper.copyFile(PublishHelper.java:501)
at org.eclipse.wst.server.core.util.PublishHelper.publishDelta(PublishHelper.java:435)
at org.eclipse.wst.server.core.util.PublishHelper.publishDelta(PublishHelper.java:459)
at org.eclipse.wst.server.core.util.PublishHelper.publishDelta(PublishHelper.java:459)
at org.eclipse.jst.server.tomcat.core.internal.PublishOperation2.publishDir(PublishOperation2.java:141)
at org.eclipse.jst.server.tomcat.core.internal.PublishOperation2.execute(PublishOperation2.java:82)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.performTasks(ServerBehaviourDelegate.java:1290)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:933)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774)
at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3087)
at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:345)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
eclipse.buildId=M20120208-0800
java.version=1.6.0_32
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.jee.product
回答by chakri
If you using Eclipse or Myeclipse IDE's, Clean all projects like Project --> Clean --> Clean all projects --> Ok. Now its working fine
如果您使用 Eclipse 或 Myeclipse IDE,请清除所有项目,例如 Project --> Clean --> Clean all projects --> Ok。现在它工作正常
回答by S.E.T.
Following this thread lead me to a solution http://www.eclipse.org/forums/index.php/m/526327/
按照这个线程引导我找到一个解决方案http://www.eclipse.org/forums/index.php/m/526327/
It seems that the deployment config file for your application has become incorrect.
您的应用程序的部署配置文件似乎不正确。
What happened for me is that if I modified my server options and unchecked "Serve modules without publishing" the server would start. With it check I got the error you mentioned.
对我来说发生的事情是,如果我修改了我的服务器选项并取消选中“服务模块而不发布”,则服务器将启动。通过它检查我得到了你提到的错误。
For me the problem is that eclipse could not find my web.xml. My solution was that I had to go to my project settings and remove and add the reference to my webapp folder under Deployment Assembly. This brought up a dialog for the location of my deployment description. After Eclipse had that a restart got everything in order.
对我来说,问题是 eclipse 找不到我的 web.xml。我的解决方案是我必须转到我的项目设置并删除并添加对部署程序集下的 webapp 文件夹的引用。这会弹出一个对话框,显示我的部署描述的位置。在 Eclipse 重启之后,一切都井然有序。
回答by Mohsen
Seems to be a bug. Here is the workaround;
似乎是一个错误。这是解决方法;
When adding a new server, do not add any web application to the server. Just add a server with no web module. After server was added, right click on server and "Add and Remove". This should now work.
添加新服务器时,请勿向服务器添加任何 Web 应用程序。只需添加一个没有 web 模块的服务器。添加服务器后,右键单击服务器并“添加和删除”。这现在应该可以工作了。
回答by alexua
had the same problem with Eclipse Neon 2 (4.6.2) and Tomcat 8.5. Workaround is working. Add a server, but do not add application to it. Then run application "Run on server" and it will start working. Also need to say that I deleted all Maven repository and restarted Eclipse. After restart Maven downloaded all dependencies. I did not like to delete repository, but it seems it is also important part for troubleshooting.
Eclipse Neon 2 (4.6.2) 和 Tomcat 8.5 也有同样的问题。解决方法有效。添加服务器,但不要向其添加应用程序。然后运行应用程序“在服务器上运行”,它将开始工作。还需要说的是,我删除了所有Maven存储库并重新启动了Eclipse。重启后 Maven 下载所有依赖项。我不喜欢删除存储库,但它似乎也是故障排除的重要部分。
回答by kalki priya
I faced the same issue. Just delete the server alone. Add the new server and projects into the server. Clean the tomcat work directory. Then start the server it will work fine
我遇到了同样的问题。只需删除服务器即可。将新服务器和项目添加到服务器中。清理 tomcat 工作目录。然后启动服务器它会正常工作