JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java Application Framework » Spring  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
作者 spring-batch註冊問題求解..
karas9968





發文: 3
積分: 0
於 2014-09-09 15:27 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
小弟這兩天在試著自學batch的做法,
但是在一起步就出現了目前沒有辦法解決的問題,
想請各位幫忙想想辦法..

測試的環境是spring3 + springMVC +hibernate3
起頭是參考了這篇文章
http://fanli7.net/a/bianchengyuyan/C__/20130117/292247.html

然而當我將註冊資訊加入我的spring-batch.xml,並且加入到web.xml後,
將localserver重新啟動就出現了問題


2014/9/9 下午 03:17:59 org.apache.catalina.core.StandardContext listenerStart
嚴重的: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/batch]
Offending resource: ServletContext resource [/WEB-INF/configs/spring-batch.xml]

  at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
  at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
  at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
  at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:318)
  at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1435)
  at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1428)
  at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:195)
  at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:139)
  at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:108)
  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
  at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
  at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
  at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
  at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
  at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
  at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
  at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537)
  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:451)
  at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
  at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
  at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
  at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4992)
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5490)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
  at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
  at java.util.concurrent.FutureTask.run(FutureTask.java:138)
  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
  at java.lang.Thread.run(Thread.java:662)
---------------------------------------------------------------------------------------------------------
2014/9/9 下午 03:17:59 org.apache.catalina.core.StandardContext listenerStop
嚴重的: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
  at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:171)
  at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1090)
  at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1064)
  at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010)
  at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:586)
  at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:143)
  at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5033)
  at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5685)
  at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
  at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
  at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
  at java.util.concurrent.FutureTask.run(FutureTask.java:138)
  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
  at java.lang.Thread.run(Thread.java:662)


這是我當時的設定
1
2
3
4
5
6
7
8
9
10
11
12
<?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:batch="http://www.springframework.org/schema/batch"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/batch
            http://www.springframework.org/schema/batch/spring-batch-3.0.xsd">
  
  <batch:job id="importProductsJob">
  </batch:job>
</beans>


然而我把batch:job的tag先移除的話,
localserver就可以正常起動,
餵了幾天的google,吐出來的資訊都好像沒有說明要加入哪些jar檔,
而後來也發現,我使用的jar包也沒有batch的部分,
所以關於這個部分需要哪些jar檔、或是有什麼需要優先注意到的步驟,
能請各位指導一下嗎?

謝謝~


reply to postreply to post
作者 Re:spring-batch註冊問題求解.. [Re:karas9968]
karas9968





發文: 3
積分: 0
於 2014-09-09 17:00 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
自己問自己回答......
就是缺jar檔而已.......
真白癡.....

加入了以下兩個jar檔以後,就成功了...
spring-batch-core-3.0.0.RELEASE.jar
spring-batch-infrastructure-3.0.0.RELEASE.jar


reply to postreply to post
» JWorld@TW »  Java Application Framework » Spring

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8