JBoss 7 - Spring integration
I am migrating an application from JBoss 5 to 7. But it's like JBoss 7 does not support programatic JNDI binging. I get the error message below when i start the web server:
14:50:05,752 INFO [stdout] (MSC service thread 1-1) 05.09.2011 14:50:05.750 ERROR [MSC service thread 1-1] org.springframework.web.context.ContextLoader Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testApplicationSessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.UnsupportedOperationException: Naming context is read-only
14:50:05,753 INFO [stdout] (MSC service thread 1-1) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1330)
14:50:05,753 INFO [stdout] (MSC service thread 1-1) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:475)
14:50:05,754 INFO [stdout] (MSC service thread 1-1) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:411)
14:50:05,754 INFO [stdout] (MSC service thread 1-1) at java.security.AccessController.doPrivileged(Native Method)
14:50:05,754 INFO [stdout] (MSC service thread 1-1) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:382)
14:50:05,755 INFO [stdout] (MSC service thread 1-1) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:271)
14:50:05,755 INFO [stdout] (MSC service thread 1-1) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
14:50:05,756 INFO [stdout] (MSC service thread 1-1) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:268)
14:50:05,756 INFO [stdout] (MSC service thread 1-1) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:170)
14:50:05,756 INFO [stdout] (MSC service thread 1-1) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:464)
14:50:05,756 INFO [stdout] (MSC service thread 1-1) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:719)
14:50:05,757 INFO [stdout] (MSC service thread 1-1) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:378)
14:50:05,757 INFO [stdout] (MSC service thread 1-1) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:254)
14:50:05,757 INFO [stdout] (MSC service thread 1-1) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:198)
14:50:05,758 INFO [stdout] (MSC service thread 1-1) at org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:83)
14:50:05,759 INFO [stdout] (MSC service thread 1-1) at javax.servlet.GenericServlet.init(GenericServlet.java:242)
14:50:05,759 INFO [stdout] (MSC service thread 1-1) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202)
14:50:05,759 INFO [stdout] (MSC service thread 1-1) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102)
14:50:05,760 INFO [stdout] (MSC service thread 1-1) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3631)
14:50:05,760 INFO [stdout] (MSC service thread 1-1) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3844)
14:50:05,760 INFO [stdout] (MSC service thread 1-1) at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70)
14:50:05,760 INFO [stdout] (MSC service thread 1-1) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
14:50:05,761 INFO [stdout] (MSC service thread 1-1) at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)
14:50:05,761 INFO [stdout] (MSC service thread 1-1) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
14:50:05,761 INFO [stdout] (MSC service thread 1-1) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
14:50:05,762 INFO [stdout] (MSC service thread 1-1) at java.lang.Thread.run(Thread.java:722)
14:50:05,762 INFO [stdout] (MSC service thread 1-1) Caused by: java.lang.UnsupportedOperationException: Naming context is read-only
14:50:05,762 INFO [stdout] (MSC service thread 1-1) at org.jboss.as.naming.NamingContext.createSubcontext(NamingContext.java:298)
14:50:05,762 INFO [stdout] (MSC service thread 1-1) at org.hibernate.util.NamingHelper.bind(NamingHelper.java:92)
14:50:05,763 INFO [stdout] (MSC service thread 1-1) at org.hibernate.impl.SessionFactoryObjectFactory.addInstance(SessionFactoryObjectFactory.java:113)
14:50:05,763 INFO [stdout] (MSC service thread 1-1) at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:338)
14:50:05,763 INFO [stdout] (MSC service thread 1-1) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
14:50:05,763 INFO [stdout] (MSC service thread 1-1) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:806)
14:50:05,764 INFO [stdout] (MSC service thread 1-1) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:724)
14:50:05,764 INFO [stdout] (MSC service thread 1-1) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
14:50:05,764 INFO [stdout] (MSC service thread 1-1) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1361)
14:50:05,765 INFO [stdout] (MSC service thread 1-1) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1327)
14:50:05,765 INFO [stdout] (MSC service thread 1-1) ... 25 more
My applicationContext.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<!--DATA SOURCE SETTINGS BEGIN HERE-->
<bean id="dataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:/jdbc/test-application-xa" />
</bean>
<!-- Hibernate SessionFactory.-->
<!--http:/开发者_StackOverflow社区/www.vaannila.com/spring/spring-hibernate-integration-1.html-->
<bean id="testApplicationSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource"/>
</property>
<property name="configLocation" value="classpath:test-application- hibernate.cfg.xml"/>
</bean>
......
</beans>
How get these spring configurations to work in JBoss 7?
regards,
David
JBoss not support programmatic binding anymore.
http://community.jboss.org/message/606801#606801
精彩评论