JBoss5.1.0GA配置了 jndi数据库配置文件oracle-ds.xml放到jboss目录 /C:/Java/JBoss/jboss-5.1.0.GA/server/default/deploy下面,在本地eclipse启动时报错,内容如下:
17:02:46,094 ERROR [AbstractKernelController] Error installing to Real: name=vfszip:/C:/Java/JBoss/jboss-5.1.0.GA/server/default/deploy/BookSystem.ear/ state=PreReal
mode=Manual requiredState=Real
org.jboss.deployers.spi.DeploymentException: Error deploying: jboss.jca:service=ManagedConnectionFactory,name=DS.datasource.book.com
at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:118)
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)
at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)
at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
at org.jboss.Main.boot(Main.java:221)
at org.jboss.Main$1.run(Main.java:556)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: jboss.jca:name=DS.datasource.book.com,service=ManagedConnectionFactory is already installed.
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:716)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
at org.jboss.system.ServiceController.doInstall(ServiceController.java:670)
at org.jboss.system.ServiceController.install(ServiceController.java:273)
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:90)
... 36 more
我报错的原因是因为 DS.datasource.book.com重复配置了,我把放到jboss中的数据库配置文件 oracle-ds.xml删掉了,然后就没有报错了,应该是数据源在其他地方已经注册过了,因为我看日志是正常注册了。
解决方法总结如下:
1.首先可以尝试删除放进jboss数据源配置文件,再次启动试试,防止重复配置数据源。
2.有时候是由于缓存引起的,清空 C:\Java\JBoss\jboss-5.1.0.GA\server\default 下面的 tmp和 work两个文件夹可以解决
3.有时也会导致 InstanceAlreadyExistsException报错,解决方法参考如下:InstanceAlreadyExistsException的解决方案_night field的博客-CSDN博客_instancealreadyexistsexception
希望对你有帮助!