2010-09-07 76 views
1

請幫我解決這個錯誤創建豆 - JPetStore的例子

我經常收到此錯誤 錯誤創建名稱爲豆「的SqlMapClient」在ServletContext的資源定義

感謝

 
31 [main] INFO org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started 
140 [main] INFO org.springframework.web.context.support.XmlWebApplicationContext - Refreshing o[email protected]1774b9b: display name [Root WebApplicationContext]; startup date [Tue Sep 07 15:12:12 CDT 2010]; root of context hierarchy 
343 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/dataAccessContext-local.xml] 
421 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml] 
921 [main] INFO org.springframework.web.context.support.XmlWebApplicationContext - Bean factory for application context [o[email protected]1774b9b]: org.s[email protected]18352d8 
1187 [main] INFO org.springframework.beans.factory.config.PropertyPlaceholderConfigurer - Loading properties file from ServletContext resource [/WEB-INF/mail.properties] 
1187 [main] INFO org.springframework.beans.factory.config.PropertyPlaceholderConfigurer - Loading properties file from ServletContext resource [/WEB-INF/jdbc.properties] 
1265 [main] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.s[email protected]18352d8: defining beans [dataSource,transactionManager,sqlMapClient,accountDao,categoryDao,productDao,itemDao,orderDao,sequenceDao,propertyConfigurer,accountValidator,orderValidator,petStore,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor]; root of factory hierarchy 
1671 [main] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Destroying singletons in org.s[email protected]18352d8: defining beans [dataSource,transactionManager,sqlMapClient,accountDao,categoryDao,productDao,itemDao,orderDao,sequenceDao,propertyConfigurer,accountValidator,orderValidator,petStore,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor]; root of factory hierarchy 
1671 [main] ERROR org.springframework.web.context.ContextLoader - Context initialization failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in ServletContext resource [/WEB-INF/dataAccessContext-local.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: ServletContext resource [/WEB-INF/sql-map-config.xml]; nested exception is com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMap/resultMap'. Cause: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423) 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380) 
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) 
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) 
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) 
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135) 
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630) 
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) 
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785) 
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) 
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)Sep 7, 2010 3:12:13 PM org.apache.catalina.core.StandardContext listenerStart 
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in ServletContext resource [/WEB-INF/dataAccessContext-local.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: ServletContext resource [/WEB-INF/sql-map-config.xml]; nested exception is com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMap/resultMap'. Cause: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) 
    at java.security.AccessController.doPrivileged(Native Method) 

回答

0

嘗試在applicationContext.xml中創建的SqlMapClient豆

0

的根本原因是在最後:

原因:java.securit y.AccessControlException:訪問被拒絕(java.lang.RuntimePermission accessDeclaredMembers)

你似乎在JVM安全限制運行你的servlet容器,這些限制是從做他們的工作,禁止春/ iBatis的。

雖然你還沒有告訴我們關於你的環境的任何信息,所以我不能提出解決方案。

+0

謝謝skaffman,我使用Tomcat 6.0.29和Eclipse,並試圖JPetStore的例子 – 2010-09-07 22:31:11

+0

遺憾的不完整的信息。操作系統是Windows XP – 2010-09-07 23:04:33

相關問題