spring integration jdbc init error - spring

error info:
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/integration/jdbc]
Offending resource: class path resource [META-INF/spring/applicationContext-integration.xml]
I have added xmlns and xsi:schemaLocation to the header of configuration file, it didn't show any error, but why excepiton occured when project startup?
anybody helps me...

It's interest, what was the problem to use search? At least on the StackOverflow
Your issue is about that spring-integration-jdbc.jar isn't presented in the CLASSPATH
Cheers

Related

stomp-chat web socket with embedded tomcat reactor error - type reactor.tuple.Tuple not found

I am having problems getting web socket subscriptions to work properly using Spring with an embedded Tomcat server.
When running this stomp-chat application I get the following error:
org.springframework.messaging.MessageHandlingException: Expression evaluation failed: #chatRoomSessions[headers.simpDestination].add(T(reactor.tuple.Tuple).of(headers.simpSessionId, headers.simpSubscriptionId));
nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1005E:(pos 58): Type cannot be found 'reactor.tuple.Tuple'
I tried to add the following dependency:
compile ("io.projectreactor:reactor-stream:$reactorVersion")
but it gave the same error. Any help would be appreciated.
OK. I see the problem.
The dependency for the io.projectreactor:reactor-stream:2.0.8 isn't enough.
The Tuple class has been moved to the new reactor.fn.tuple package.
So, you still have to fix all the reactor.tuple.Tuple mentioning in the stomp-server.xml to the new reactor.fn.tuple.Tuple.
The sample will be fixed soon: https://github.com/spring-projects/spring-integration-samples/issues/185
Sorry for inconvenience.

spring-test, groovy library and qualifier tag incompatibility

Im trying to add some groovy scripts to existing project and I stuck with making integration tests work.
I have few beans marked with <qualifier /> tag, that are used for autowiring both in test and in production code.
Right after I add 'org.codehaus.groovy:groovy-all:2.4.0'
(tried other versions aswell) to dependencies, without even any groovy usage, my integration tests stop working, with exception:
SEVERE: Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener#5e5f7983] to prepare test instance [com.dph.groovy.vs.springtest.IntegrationTest#299c9fe7]
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:94)
at org.springframework.test.context.DefaultTestContext.getApplicationContext(DefaultTestContext.java:72)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
at
......
Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unexpected failure during bean definition parsing
Offending resource: class path resource [spring/app-config.xml]
Bean 'service'; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Tag 'qualifier' must have a 'type' attribute
Offending resource: class path resource [spring/app-config.xml]
Bean 'service'
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:323)
Runnning project (with jetty 6 if this matters) doesnt cause any issues though, so I assume there's some trick with spring-test union with groovy.
I might just add 'type' to my qualifiers, however it doesnt solve problem, because I have external dependencies with same qualifier tags configuration, besides this attribute is optional as far as I know.
I'd love to find out at least what are roots of this problem.
I created example project to reproduce the described question and will appreciate any ideas:
https://github.com/ametiste/groovy-vs-spring-test
You have discovered a bug in Spring's testing support.
Fixed in Spring Framework 4.1.6 and 4.2 RC1
I have fixed this bug for Spring Framework 4.1.6 (scheduled for release at the end of March 2015) and 4.2 (scheduled for release in Q3 2015). For further details, please see JIRA issue SPR-12768.
If you wish to try out the fix before the aforementioned releases, consider building against one of the upcoming nightly snapshots.
Temporary Work-around
In the meantime, (for XML configuration files that you are permitted to edit) you can circumvent this bug by explicitly setting the type attribute in the <qualifier> tag to the intended default value which is "org.springframework.beans.factory.annotation.Qualifier". See the following XML config for an example.
<bean id="foo" class="java.lang.String" c:_="bar">
<qualifier value="foo" type="org.springframework.beans.factory.annotation.Qualifier" />
</bean>
Regards,
Sam
(author of the Spring TestContext Framework)

spring + hibernate web application

I have started Web Application using Spring + Hibernate MVC. I Created All File. There are some issues when i'm debug my application. Here I have attached test-servlet.xml. First one is that how to add' ' then there are 3 errors when i'm debug my application. I have also mentioned that error line. So any one help me plz on this???
error :
![javax.servlet.ServletException: Servlet.init() for servlet test threw exception
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource \[/WEB-INF/config/test-servlet.xml\]; nested exception is java.lang.NoClassDefFoundError: org/springframework/transaction/interceptor/TransactionInterceptor
java.lang.NoClassDefFoundError: org/springframework/transaction/interceptor/TransactionInterceptor]
The exception says:
java.lang.NoClassDefFoundError:
org/springframework/transaction/interceptor/TransactionInterceptor
Check your WEB-INF/lib and make sure you have the spring jar file that contains this class.
Download the org.springframework.transaction.jar and add add it to your classpath.
This class is found in "spring-tx" jar that should be present in your classpath (lib). Please check this. If not present please download appropriate version from here.

Getting error with Spring batch

I am getting below error when I am executing my Java application :
Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: org.springframework.transaction.annotation.TransactionManagementConfigurationSelector was imported as a Configuration class but is not annotated with #Configuration nor does it declare any #Bean methods. Update the class to meet either of these requirements or do not attempt to import it.
Offending resource: class path resource [org/springframework/transaction/annotation/TransactionManagementConfigurationSelector.class]
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.doLoadBeanDefinitionForConfigurationClassIfNecessary(ConfigurationClassBeanDefinitionReader.java:153)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:120)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:111)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:188)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:132)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:584)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:405)
at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:65)
at org.sbq.batch.mains.SchedulerRunner.<init>(SchedulerRunner.java:46)
at org.sbq.batch.mains.SchedulerRunner.main(SchedulerRunner.java:52)
I don't have any clue about this kind of exception. Please help.
I think you are mixing different versions of springbatch. Try downloading the latest version of all the jars and execute it.
Similar problem was posted by someone in the SpringSource Forum, in this link
Yes, using different versions of the spring and spring batch jars might produce 'offending resource' exception

Unable to locate Spring NamespaceHandler for element 'flow'

I am developing a spring webflow (2.0.7) project using SpringSource Tool Suite. I am trying to setup a basic flow.
My someflow.xml looks like this:
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
<!- view-state declarations -->
</flow>
On STS tool(Spring IDE on eclipse), I see a warning message near the flow schemaLocation:
Unable to locate Spring NamespaceHandler for element 'flow' of schema namespace 'http://
www.springframework.org/schema/webflow'
Then when tomcat starts up, I get the error
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/webflow]
Offending resource: ServletContext resource [/WEB-INF/flows/someflow.xml]
I googled a while and some posts suggested that the problem is spring-webflow jars not being in class path. In my case, springsource tool created the template and all jars are in place. I manually checked them as well. So that can't be the issue
One of the suggestions in this post http://forum.springsource.org/archive/index.php/t-49098.html was to splice the jar! That can't be a solution, but I tried to see if it fixes it. But no.
Stuck now.. Did anyone else face this issue?
I've had similar issues before and it usually boiled down to the jar missing from the built war. Can you open up the war you are using and check that the webflow jar is in the /WEB-INF/lib directory?
If you are using Maven to do your builds, check your dependency settings for webflow as well.
if you are using eclipse,please provide the appresource path name,right click on your test case select Run as --> Run Configurations --> click on the Classpath tab and copy the below line and give the full path name of your property file location.
appResourcePath = ../../environment-dev.properties).

Resources