Java Glassfish 4 部署错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19681868/
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
Glassfish 4 deployment error
提问by galovics
I added some libraries to my JavaEE project and then deploy the application works. I modified something and I got this error message in Eclipse:
我在我的 JavaEE 项目中添加了一些库,然后部署应用程序工作。我修改了一些东西,我在 Eclipse 中收到了这个错误消息:
Cannot Deploy ProjectName
deploy is failing=Error occurred during deployment: Keys cannot be duplicate.
Old value of this key property, nullwill be retained.
Please see server.log for more details.
java.lang.LinkageError: loader (instance of
org/glassfish/web/loader/WebappClassLoader):
attempted duplicate class definition for name:
"org/glassfish/web/loader/JdbcLeakPrevention"
loader (instance of org/glassfish/web/loader/WebappClassLoader): attempted duplicate
class definition for name: "org/glassfish/web/loader/JdbcLeakPrevention"
I made some research and I found out that it is not an Eclipse bug. I'm working with Kepler but I tested with Juno too. Got the same error message. I downloaded Glassfish 3.1.2.2 and the message gone.
我做了一些研究,发现它不是 Eclipse 错误。我正在使用 Kepler,但我也使用 Juno 进行了测试。得到同样的错误信息。我下载了 Glassfish 3.1.2.2 并且消息消失了。
Why am I getting this message?
为什么我会收到这条消息?
回答by Oskars Pakers
Try to clean autodeploy directory, restart the server. Also clean the project deployment directory.
尝试清理 autodeploy 目录,重新启动服务器。还要清理项目部署目录。
回答by Martin Charlesworth
I also had this issue, and I was also using the SVNKit library plus its dependencies so it looks like there is some kind of conflict there. I can get around it by cleaning out the osgi-cache folder & restarting glassfish, but I have to do this every time I want to deploy, so not a great solution.
我也遇到了这个问题,而且我还使用了 SVNKit 库及其依赖项,因此看起来那里存在某种冲突。我可以通过清除 osgi-cache 文件夹并重新启动 glassfish 来解决它,但是每次我想部署时都必须这样做,所以不是一个很好的解决方案。
回答by Catalin Ciolocoiu
I Had the same error. I stopped the GLassfish server and then I cleaned the project (Project -> Clean... ). Started the server and worked
我有同样的错误。我停止了 GLassfish 服务器,然后我清理了项目(项目 -> 清理...)。启动服务器并工作
回答by leftbit
Was somehow related to a single @Singleton
bean. Converted it to @Stateless
and everything worked fine. Not quite sure why this happened...
不知何故与单个@Singleton
豆有关。将其转换为@Stateless
,一切正常。不太清楚为什么会这样......
回答by jyrkim
In my Glassfish logfile it says:
在我的Glassfish 日志文件中,它说:
Application with name ws is already registered. Either specify that redeployment must be forced, or redeploy the application. Or if this is a new deployment, pick a different name
名称为 ws 的应用程序已经注册。要么指定必须强制重新部署,要么重新部署应用程序。或者,如果这是新部署,请选择其他名称
Following my logs instructions I deployed the app with --force
option:
按照我的日志说明,我使用以下--force
选项部署了应用程序:
asadmin deploy --force=true ws.war
and it worked. More info on deploy --force=true
它奏效了。有关deploy --force=true 的更多信息
回答by Renato Herebia
Try to remove all the files under osgi-cache and generated directories. It worked for me.
尝试删除 osgi-cache 和生成目录下的所有文件。它对我有用。
回答by Akhileshwar Reddy
following steps worked for me.
以下步骤对我有用。
- stop the glassfish server(if running)
- kill all the java process (using terminal or activity monitor)
- now try redeploy.
- 停止 glassfish 服务器(如果正在运行)
- 杀死所有 java 进程(使用终端或活动监视器)
- 现在尝试重新部署。