我正在尝试使用Job Scheduler运行Spring3.2应用程序,并收到以下错误消息:
2019年5月6日2:03:20 org.apache.catalina.core.StandardContext listenerStart SEVERE:向上下文发送上下文初始化事件的异常 类的侦听器实例 [org.springframework.web.context.ContextLoaderListener] org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: 来自类路径资源[app-config.xml]的XML文档中的第7行是 无效;嵌套的异常是org.xml.sax.SAXParseException; lineNumber:7; columnNumber:112; :XML-24500: (错误)无法建立位于以下位置的架构“ http://www.springframework.org/schema/context” 'http://www.springframework.org/schema/context/spring-context-4.1.xsd' 在 org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398) 在 org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335)
我的pom.xml如下:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.2.0.RELEASE </version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.2.0.RELEASE </version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
Web.xml如下:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:app-config.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
Config.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:task="http://www.springframework.org/schema/task"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:context="http://www.springframework.org/schema/context"
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.xsd
http://www.springframework.org/schema/util/ http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">
<context:component-scan base-package="<base-package-name>" />
<task:scheduled-tasks scheduler="myScheduler">
<task:scheduled ref="cronJobBean" method="checkServices"
cron="0 0/5 * * * ?" />
</task:scheduled-tasks>
<task:scheduler id="myScheduler" pool-size="10" />
</beans>
mvn依赖项:树输出
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ CronJob ---
[INFO] com.websystique.spring:CronJob:war:1.0.0
[INFO] +- org.springframework:spring-core:jar:3.2.2.RELEASE:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.springframework:spring-context:jar:3.2.2.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:3.2.2.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:3.2.2.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:3.2.2.RELEASE:compile
[INFO] +- org.springframework:spring-web:jar:3.2.0.RELEASE:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] +- com.elsevier:UcsQueues:jar:1.0-SNAPSHOT:compile
[INFO] | +- com.google.guava:guava:jar:18.0:compile
[INFO] | +- org.cache2k:cache2k-core:jar:0.21:compile
[INFO] | | +- org.cache2k:cache2k-api:jar:0.21:compile
[INFO] | | \- org.cache2k:cache2k-jmx-api:jar:0.21:compile
[INFO] | +- org.springframework:spring-test:jar:4.1.5.RELEASE:compile
[INFO] | +- com.elsevier:Common:jar:1.0-SNAPSHOT:compile
[INFO] | | +- javax.mail:mail:jar:1.4.3:compile
[INFO] | | +- com.elsevier:cloud:jar:1.0-SNAPSHOT:compile
[INFO] | | | +- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] | | | \- com.amazonaws:aws-java-sdk:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-support:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-simpledb:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-simpleworkflow:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-storagegateway:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-route53:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-s3:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-importexport:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-sts:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-sqs:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-rds:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-redshift:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-elasticbeanstalk:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-glacier:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-iam:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-datapipeline:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-elasticloadbalancing:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-emr:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-elasticache:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-elastictranscoder:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-ec2:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-dynamodb:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-sns:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-cloudtrail:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-cloudwatch:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-logs:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-cognitoidentity:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-cognitosync:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-directconnect:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-cloudformation:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-cloudfront:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-kinesis:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-opsworks:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-ses:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-autoscaling:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-cloudsearch:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-cloudwatchmetrics:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-swf-libraries:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-codedeploy:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-codepipeline:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-kms:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-config:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-lambda:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-ecs:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-cloudhsm:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-ssm:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-workspaces:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-machinelearning:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-directory:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-efs:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-codecommit:jar:1.10.11:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-devicefarm:jar:1.10.11:compile
[INFO] | | | \- com.amazonaws:aws-java-sdk-core:jar:1.10.11:compile
[INFO] | | | +- org.apache.httpcomponents:httpclient:jar:4.3.6:compile
[INFO] | | | | +- org.apache.httpcomponents:httpcore:jar:4.3.3:compile
[INFO] | | | | \- commons-codec:commons-codec:jar:1.6:compile
[INFO] | | | \- com.fasterxml.jackson.core:jackson-databind:jar:2.5.3:compile
[INFO] | | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.5.0:compile
[INFO] | | | \- com.fasterxml.jackson.core:jackson-core:jar:2.5.3:compile
[INFO] | | +- ew.dom4j:ew-dom4j:jar:1.3:compile
[INFO] | | +- org.ostermiller:utils:jar:1.08.02:compile
[INFO] | | +- com.oracle:xmlparserv2:jar:10.1.0.3:compile
[INFO] | | +- soap:soap:jar:1.0:compile
[INFO] | | +- com.oracle:orai18n-collation:jar:11.1.0.7.0:compile
[INFO] | | +- commons-net:commons-net:jar:3.3:compile
[INFO] | | +- javax.servlet:servlet-api:jar:2.5:compile
[INFO] | | +- com.ice.tar:tar:jar:2.5:compile
[INFO] | | +- com.twmacinta:fast-md5:jar:2.7.1:compile
[INFO] | | +- com.oracle:cmsdk:jar:9.0.3:compile
[INFO] | | +- com.oracle:ojdbc6:jar:11.2.0.3.0:compile
[INFO] | | \- com.oreilly:servlet:jar:1.3.1:compile
[INFO] | +- com.elsevier:vtw-ew2-adapter:jar:1.0-SNAPSHOT:compile
[INFO] | | +- com.elsevier:vtw-common:jar:1.0-SNAPSHOT:compile
[INFO] | | +- stax:stax:jar:1.2.0:compile
[INFO] | | \- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | +- com.elsevier:DbModel:jar:1.0-SNAPSHOT:compile
[INFO] | | \- org.hibernate:hibernate-entitymanager:jar:4.3.7.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
[INFO] | | +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
[INFO] | | +- org.hibernate:hibernate-core:jar:4.3.7.Final:compile
[INFO] | | | +- antlr:antlr:jar:2.7.7:compile
[INFO] | | | \- org.jboss:jandex:jar:1.1.0.Final:compile
[INFO] | | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] | | +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.5.Final:compile
[INFO] | | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] | | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final:compile
[INFO] | | \- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] | +- org.slf4j:slf4j-jdk14:jar:1.7.10:compile
[INFO] | +- joda-time:joda-time:jar:2.5:compile
[INFO] | +- commons-io:commons-io:jar:2.4:compile
[INFO] | \- org.json:json:jar:20141113:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.7:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.7:compile
[INFO] +- log4j:log4j:jar:1.2.17:compile
[INFO] +- org.quartz-scheduler:quartz:jar:2.2.1:compile
[INFO] | \- c3p0:c3p0:jar:0.9.1.1:compile
[INFO] +- junit:junit:jar:3.8.1:test
[INFO] +- com.sun.mail:javax.mail:jar:1.5.5:compile
[INFO] | \- javax.activation:activation:jar:1.1:compile
[INFO] \- javax.servlet.jsp.jstl:jstl-api:jar:1.2-rev-1:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------