我的应用程序在开始时因错误而崩溃:
引起:org.xml.sax.SAXParseException; lineNumber:13; columnNumber:60; cvc-complex-type.2.4.c:匹配的通配符是strict,但是没有找到元素'mongo:mongo'的声明。
我的context.xml如下所示:
xsi:schemaLocation="
http##://www.springframework.org/schema/beans
http##://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http##://www.springframework.org/schema/data/mongo
http##://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd">
<mongo:mongo id="mongo" host="localhost" port="27017"/>
<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
<constructor-arg ref="mongo"/>
<constructor-arg name="databaseName" value="ProcessOrderManagement"/>
</bean>
我的Pom.xml看起来像这样:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>1.8.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.mongodb.morphia</groupId>
<artifactId>morphia</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>1.5.0.RELEASE</version>
</dependency>
请忽略两个#符号,因为我无法粘贴链接,因为我的代表不是10,我输入了那个标志, 无论如何,我的应用程序在发出上述错误后崩溃了。我做错了什么?
更新了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:mongo="http://www.springframework.org/schema/data/mongo"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd
">
<mongo:mongo id="mongo" host="localhost" port="27017"/>
<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
<constructor-arg ref="mongo"/>
<constructor-arg name="databaseName" value="ProcessOrderManagement"/>
</bean>
答案 0 :(得分:0)
看起来你的context.xml粘贴错误或者你的错误是你的context.xml没有正确打开。您缺少打开的xml文档标记。请注意此示例的顶部。
更新:如果没有,请注意弹簧上下文命名空间的需要。
bool any = ttf.webpages_Membership
.Any(x => x.UserId.Equals(userid)
&& x.PasswordVerificationToken == rt
&& x.PasswordVerificationTokenExpirationDate < DateTime.Now);
if (any == true) {
}