problem with spring xml

1,198 views
Skip to first unread message

taskman

unread,
Jul 27, 2010, 6:04:40 AM7/27/10
to Ehcache Spring Annotations
Hi

I am trying to use the spring annotations project, but I am getting an
exception. I tried this in a junit test case and in my web app, same
error

These are all the jar files I have in my web app lib directory (WEB-
INF/lib):
antlr-2.7.6.jar
aopalliance-1.0.jar
asm-attrs.jar
asm.jar
aspectjrt-1.6.2.jar
castor-1.2.jar
cglib-2.1.3.jar
cglib-2.2.jar
commons-codec-1.4.jar
commons-collections-2.1.1.jar
commons-fileupload-1.2.1.jar
commons-httpclient-3.1-rc1.jar
commons-io-1.4.jar
commons-lang-2.5.jar
commons-logging-1.1.1.jar
commons-logging-1.1.jar
DiscNucleus.jar
dom4j-1.6.1.jar
ehcache-2.2.0.jar
ehcache-spring-annotations-1.1.2.jar
el-api-2.2.jar
el-impl-2.2.jar
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-entitymanager.jar
hibernate-tools.jar
hibernate3.jar
InvestBase.jar
InvestCommons.jar
javassist.jar
jdbc2_0-stdext.jar
jsf-api.jar
jsf-impl.jar
jstl-api-1.2.jar
jstl-impl-1.2.jar
jta.jar
kavachart_proserve-5_3_1.jar
kavachart_proserve_license-5_3_1.jar
ojdbc14-10.2.0.2.0.jar
org.springframework.aop-3.0.3.RELEASE.jar
org.springframework.asm-3.0.3.RELEASE.jar
org.springframework.aspects-3.0.3.RELEASE.jar
org.springframework.beans-3.0.3.RELEASE.jar
org.springframework.context-3.0.3.RELEASE.jar
org.springframework.context.support-3.0.3.RELEASE.jar
org.springframework.core-3.0.3.RELEASE.jar
org.springframework.expression-3.0.3.RELEASE.jar
org.springframework.instrument-3.0.3.RELEASE.jar
org.springframework.instrument.tomcat-3.0.3.RELEASE.jar
org.springframework.jdbc-3.0.3.RELEASE.jar
org.springframework.jms-3.0.3.RELEASE.jar
org.springframework.orm-3.0.3.RELEASE.jar
org.springframework.oxm-3.0.3.RELEASE.jar
org.springframework.test-3.0.3.RELEASE.jar
org.springframework.transaction-3.0.3.RELEASE.jar
org.springframework.web-3.0.3.RELEASE.jar
org.springframework.web.portlet-3.0.3.RELEASE.jar
org.springframework.web.servlet-3.0.3.RELEASE.jar
org.springframework.web.struts-3.0.3.RELEASE.jar
primefaces-2.1.jar
slf4j-api-1.6.1.jar


The xml in my spring context xml
<ehcache:annotation-driven cache-manager="ehCacheManager" />
<bean id="ehCacheManager"
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"/>


This is the exception I am getting:
[#|2010-07-27T11:49:50.421+0200|SEVERE|glassfish3.0.1|
javax.enterprise.system.core.com.sun.enterprise.v3.server|
_ThreadID=25;_ThreadName=http-thread-pool-48
48-(1);|Exception while loading the app
java.lang.Exception: java.lang.IllegalStateException:
ContainerBase.addChild: start: org.apache.catalina.LifecycleException:
org.springframework.beans.facto
ry.parsing.BeanDefinitionParsingException: Configuration problem:
Failed to import bean definitions from URL location [classpath*:spring/
investSessionFactor
yContext.xml]
Offending resource: ServletContext resource [/WEB-INF/
investApplicationContext.xml]; nested exception is
org.springframework.beans.factory.xml.XmlBeanDefini
tionStoreException: Line 29 in XML document from URL [jar:file:/C:/
Liver/Development/Invest/Code2/trunk/InvestApp/build/web/WEB-INF/lib/
InvestBase.jar!/spri
ng/investSessionFactoryContext.xml] is invalid; nested exception is
org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching
wildcard is strict,
but no declaration can be found for element 'ehcache:annotation-
driven'.
at
com.sun.enterprise.web.WebApplication.start(WebApplication.java:117)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:
126)
at
org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241)
at
org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:
236)
at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:
339)
at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:
183)
at
org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:
272)
at com.sun.enterprise.v3.admin.CommandRunnerImpl
$1.execute(CommandRunnerImpl.java:305)
at
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:
320)
at
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:
1176)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access
$900(CommandRunnerImpl.java:83)
at com.sun.enterprise.v3.admin.CommandRunnerImpl
$ExecutionContext.execute(CommandRunnerImpl.java:1235)
at com.sun.enterprise.v3.admin.CommandRunnerImpl
$ExecutionContext.execute(CommandRunnerImpl.java:1224)
at
com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:
365)
at
com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:
204)
at
com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:
166)
at
com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:
100)
at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:
245)
at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:
791)
at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at
com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:
170)
at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:
135)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:
102)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:
88)
at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:
76)
at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:
53)
at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:
57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool
$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool
$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)
|#]

taskman

unread,
Jul 27, 2010, 6:07:53 AM7/27/10
to Ehcache Spring Annotations
In case you guys need the full spring xml that I am using. As you can
see I added ehcache at the top also of the 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:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:flow="http://www.springframework.org/schema/webflow-
config"
xmlns:jms="http://www.springframework.org/schema/jms"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:ehcache="http://ehcache-spring-annotations.googlecode.com/
svn/schema/ehcache-spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config-1.0.xsd
http://www.springframework.org/schema/jms
http://www.springframework.org/schema/jms/spring-jms-2.5.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
http://www.springframework.org/schema/lang
http://www.springframework.org/schema/lang/spring-lang-2.5.xsd
http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.5.xsd">

<import resource="classpath*:spring/commonContext.xml"/>
<import resource="classpath*:spring/datasourceContext.xml"/>

<ehcache:annotation-driven cache-manager="ehCacheManager" />
<context:component-scan base-
package="za.co.discoveryinvest.dataaccess">
<context:include-filter type="annotation"
expression="org.springframework.stereotype.Repository" />
</context:component-scan>
<context:component-scan base-
package="za.co.discoveryinvest.service">
<context:include-filter type="annotation"
expression="org.springframework.stereotype.Service" />
</context:component-scan>

<bean id="ehCacheManager"
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"/>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="hibernateProperties">
<props>
<prop
key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>hibernate/WebMarketSpotVw.hbm.xml</value>
<value>hibernate/WebRssFeeds.hbm.xml</value>
<value>hibernate/WebMarketPeriodVw.hbm.xml</value>
<value>hibernate/WebBrkServSumVw.hbm.xml</value>
<value>hibernate/WebBrkServDetlVw.hbm.xml</value>
<value>hibernate/WebTransactionHistoryVw.hbm.xml</
value>
<value>hibernate/WebIfsMancosVw.hbm.xml</value>
<value>hibernate/WebIfsFundCategoryVw.hbm.xml</value>
<value>hibernate/WebFundVw.hbm.xml</value>
<value>hibernate/WebFundRiskReturnVw.hbm.xml</value>
<value>hibernate/WebLanguage.hbm.xml</value>
<value>hibernate/WebMsg.hbm.xml</value>
<value>hibernate/WebMsgLang.hbm.xml</value>
<value>hibernate/WebMsgLevel.hbm.xml</value>
<value>hibernate/WebSystemArea.hbm.xml</value>
<value>hibernate/WebTransactAttach.hbm.xml</value>
<value>hibernate/WebFundFeesVw.hbm.xml</value>
<value>hibernate/WebFundFactsVw.hbm.xml</value>
<value>hibernate/WebFundPerformanceVw.hbm.xml</value>
<value>hibernate/WebFundPricingVw.hbm.xml</value>
<value>hibernate/DiDocFiles.hbm.xml</value>
<value>hibernate/DiDocFilesRole.hbm.xml</value>
<value>hibernate/DiDocGroup.hbm.xml</value>
<value>hibernate/WebTransactDocs.hbm.xml</value>
<value>hibernate/WebTransactDocsExcptn.hbm.xml</value>
<value>hibernate/WebTransactTypeDocs.hbm.xml</value>
<value>hibernate/WebTransactTypeDocsRole.hbm.xml</
value>
<value>hibernate/WebAcRole.hbm.xml</value>
<value>hibernate/WebFundSectorPerfVw.hbm.xml</value>
<value>hibernate/WebFundCumGrowthVw.hbm.xml</value>
<value>hibernate/WebAciSectorCumGrowthVw.hbm.xml</
value>
<value>hibernate/WebPortfolioFundVw.hbm.xml</value>
<value>hibernate/WebPortfolioCorrelationVw.hbm.xml</
value>
<value>hibernate/WebPortfolioAssetClassVw.hbm.xml</
value>
<value>hibernate/WebPortfolioAstClssFndsVw.hbm.xml</
value>
<value>hibernate/WebPortfolioVw.hbm.xml</value>
<value>hibernate/WebNewProductsVw.hbm.xml</value>
<value>hibernate/WebGuarRatesVw.hbm.xml</value>
<value>hibernate/WebFundManagersVw.hbm.xml</value>
<value>hibernate/WebAciSectorPerformanceVw.hbm.xml</
value>
<value>hibernate/WebFundIncDistribVw.hbm.xml</value>
<value>hibernate/WebFundAssetAllocHistVw.hbm.xml</
value>
<value>hibernate/WebFundTopHoldingsVw.hbm.xml</value>
<value>hibernate/WebFundMktSectAllocVw.hbm.xml</value>
<value>hibernate/WebFdUntTrustCashSplitVw.hbm.xml</
value>
<value>hibernate/WebFundAssetClassAllocVw.hbm.xml</
value>
<value>hibernate/WebFundCommodAllocVw.hbm.xml</value>
<value>hibernate/WebFdCommSectorAllocVw.hbm.xml</
value>
<value>hibernate/WebFundCurrencySplitVw.hbm.xml</
value>
</list>
</property>
</bean>

</beans>

taskman

unread,
Jul 27, 2010, 6:28:24 AM7/27/10
to Ehcache Spring Annotations
I moved the code into another smaller test project with only the
minimum jars as found in the jar that I downloaded and 3 extra jars to
get spring to work, still same problem

aopalliance-1.0.jar
commons-codec-1.4.jar
ehcache-core-2.1.0.jar
ehcache-spring-annotations-1.1.2.jar
slf4j-api-1.6.1.jar
spring-aop-3.0.3.RELEASE.jar
spring-asm-3.0.3.RELEASE.jar
spring-beans-3.0.3.RELEASE.jar
spring-core-3.0.3.RELEASE.jar
org.springframework.context-3.0.3.RELEASE.jar
org.springframework.context.support-3.0.3.RELEASE.jar
commons-logging-1.1.1.jar

Eric Dalquist

unread,
Jul 27, 2010, 10:44:58 AM7/27/10
to ehcache-sprin...@googlegroups.com

taskman

unread,
Jul 27, 2010, 12:32:40 PM7/27/10
to Ehcache Spring Annotations
Thank you very much. It compiles and deploys. Now just to test that
the cache works
Reply all
Reply to author
Forward
0 new messages