Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
找不到Spring命名空间处理程序错误_Spring_Xml Namespaces - Fatal编程技术网

找不到Spring命名空间处理程序错误

找不到Spring命名空间处理程序错误,spring,xml-namespaces,Spring,Xml Namespaces,我已经犯了这个错误将近一个星期了,我几乎准备屈服了。 我已经使用Maven2创建了大jar文件。当我使用以下命令运行jar文件时: java -jar someJar.jar 我得到这个错误: ERROR: [27/55/13 10:55] Launcher: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Sp

我已经犯了这个错误将近一个星期了,我几乎准备屈服了。 我已经使用Maven2创建了大jar文件。当我使用以下命令运行jar文件时:

 java -jar someJar.jar
我得到这个错误:

 ERROR: [27/55/13 10:55] Launcher: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context]
 Offending resource: class path resource [JavaProjectApplicationContext.xml]
JavaProjectApplicationContext.xml如下所示:

 <?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:jee="http://www.springframework.org/schema/jee"
   xsi:schemaLocation="http://www.springframework.org/schema/beans 
       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context-3.0.xsd
       http://www.springframework.org/schema/jee
       http://www.springframework.org/schema/jee/spring-jee-3.0.xsd"> 

<bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location"><value>deployment.properties</value></property>
</bean>

<bean id="LexEditorDataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"><value>${hibernate.jdbc_driver}</value></property>
<property name="username"><value>${hibernate.username}</value></property>
<property name="password"><value>${hibernate.password}</value></property>
<property name="url"><value>${hibernate.url}</value></property>
<property name="defaultAutoCommit"><value>${hibernate.default_auto_commit}</value>   </property>
<property name="maxActive"><value>20</value></property>
<property name="maxIdle"><value>3</value></property>
 <property name="testOnBorrow"><value>true</value></property>
<property name="testOnReturn"><value>true</value></property>
<property name="testWhileIdle"><value>true</value></property>
</bean>

 <context:component-scan base-package="com.k_int.bank.plugin">
    <context:include-filter type="annotation" expression="org.springframework.stereotype.Service"/>
 </context:component-scan>

  <bean id="ThesSessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
   <property name="dataSource"><ref local="LexEditorDataSource"/></property>
  <property name="configurationClass">  <value>org.hibernate.cfg.AnnotationConfiguration</value></property> 
   <property name="packagesToScan">
        <list>
            <value>com.bank.kernel.datamodel</value>              
        </list>
</property>
<property name="annotatedClasses">
  <list>
    <!-- identity service -->
    <value>com.svc.identity.datamodel.PartyHDO</value>
    <value>com.svc.identity.datamodel.RegisteredUserHDO</value>
    <value>com.svc.identity.datamodel.AuthenticationDetailsHDO</value>
    <value>com.svc.identity.datamodel.GrantHDO</value>
    <value>com.svc.identity.datamodel.PermissionHDO</value>
    <value>com.svc.identity.datamodel.RegisteredOrganisationHDO</value>
    <value>com.svc.identity.datamodel.RoleHDO</value>
   </list>
</property>
  <property name="hibernateProperties">
   <props>
    <prop key="hibernate.dialect">${hibernate.dialect}</prop>
    <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
    <prop key="hibernate.show_sql">false</prop>       
  </props>
  </property>
 </bean>
  <bean id="IndexService" class="com.k_int.bank.index.solr_impl.SOLRIndexService" init-method="init">
  <property name="indexDirectory"><value>${com.bank.index_dir}</value></property>
  <property name="indexPropertyFile"><value>solr.properties</value></property>
  </bean>

有人有什么想法吗。

很可能发生的是,当您创建大(uber)jar时,向Spring提供有关自定义名称空间处理程序(Spring.schema、Spring.handlers)位置的元数据的文件最终相互覆盖

为了进一步澄清这一点,如果您使用的是上下文名称空间,比如-
context:property placeholder configurer
,那么有关如何解析此名称空间的信息将使用
spring context.jar!中的spring.handlers文件:/META-INF/spring.handlers
文件,类似的文件存在于其他SpringJAR文件中,以支持其他自定义名称空间。现在,当您创建Uber jar时,由于处理程序文件的位置完全相同,因此一个spring.handler文件最终将覆盖其他文件,您将看到所看到的错误。这里介绍了一些可能的修复方法,其中建议了一些创建可执行jar的替代方法:


您已经更改了
bean
名称空间URI,但错误消息是关于
上下文
名称空间的。尝试从映射的URI中删除版本信息(如
http://www.springframework.org/schema/context/spring-context.xsd
),应该在spring-context.jar中解析为最新版本的.xsd。很抱歉,我更改了spring-context.jar。我已经试过你说的了,还是不走运。
 someJar.jar/org/springframework/context/config/ContextNameSpaceHandler.class