Hibernateのエラー “An empty name cannot be passed to rebind”

次の組み合わせで出た表題のエラーを解決したときのメモです。

  • JBoss Application Server 5.0.1 GA (JDK6 distribution)
  • Seam 2.1.2
  • jBPM 3.2.2
  • Hibernate 3.3.0 GA

上記の組み合わせのアプリケーションを起動すると、下記のエラーが発生しました。

11:08:06,356 ERROR [SessionFactoryObjectFactory] Invalid JNDI name: 
javax.naming.InvalidNameException: An empty name cannot be passed to rebind
	at org.jnp.server.NamingServer.rebind(NamingServer.java:237)
	at org.jnp.interfaces.NamingContext.rebind(NamingContext.java:571)
	at javax.naming.InitialContext.rebind(InitialContext.java:412)
	at org.hibernate.util.NamingHelper.bind(NamingHelper.java:97)
	at org.hibernate.impl.SessionFactoryObjectFactory.addInstance(SessionFactoryObjectFactory.java:113)
	at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:338)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
	at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:91)
	at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:95)
	at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:99)
	at org.jbpm.persistence.db.DbPersistenceService.getGraphSession(DbPersistenceService.java:341)
	at org.jbpm.JbpmContext.getGraphSession(JbpmContext.java:571)
	at org.jbpm.JbpmContext.deployProcessDefinition(JbpmContext.java:173)
	at org.jboss.seam.bpm.Jbpm.deployProcess(Jbpm.java:316)
	at org.jboss.seam.bpm.Jbpm.installProcessDefinitions(Jbpm.java:294)
	at org.jboss.seam.bpm.Jbpm.startup(Jbpm.java:80)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
	at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
	at org.jboss.seam.Component.callComponentMethod(Component.java:2249)
	at org.jboss.seam.Component.callCreateMethod(Component.java:2172)
	at org.jboss.seam.Component.newInstance(Component.java:2132)
	at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
	at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
	at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:113)
	at org.jboss.seam.init.Initialization.init(Initialization.java:740)
	at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:36)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4393)
	at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:312)
	at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:144)
	at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
	at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
	at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
	at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
	at $Proxy36.start(Unknown Source)
	at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
	at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
	at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
	at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
	at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
	at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
	at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
	at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
	at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
	at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
	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.ServiceController.doChange(ServiceController.java:688)
	at org.jboss.system.ServiceController.start(ServiceController.java:460)
	at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
	at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
	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.install(DeployersImpl.java:1098)
	at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
	at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
	at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
	at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
	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:698)
	at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:304)
	at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:205)
	at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
	at org.jboss.Main.boot(Main.java:209)
	at org.jboss.Main$1.run(Main.java:547)
	at java.lang.Thread.run(Thread.java:619)

hibernate.cfg.xmlを修正すると、エラーが出なくなりました。

<hibernate-configuration>
 <session-factory name=""> ← NG
...
----
<hibernate-configuration>
 <session-factory> ← OK
...

いくつか謎が。

  1. JBoss AS 5.0.1 GAの無印版(JDK6でない方)だと発生しない。
  2. そもそも、いつname=""なる記述が紛れ込んだのか分からない。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です