spring-attic / jdbc

Apache License 2.0
11 stars 18 forks source link

Error extending JDBC Source app starter to include Oracle driver #53

Open curdeep opened 4 years ago

curdeep commented 4 years ago

I'm having some difficulty extending the JDBC source starter to include Oracle driver. It's very similar to the example shown in the link below except that I am trying to add Oracle dependency instead of mysql,

Instructions I'm following are here: https://docs.spring.io/spring-cloud-stream-app-starters/docs/current-SNAPSHOT/reference/htmlsingle/#_patching_pre_built_applications

I made only two changes to the existing JDBC source code:

-  Adding the following import to the application class
@Import(org.springframework.cloud.stream.app.jdbc.source.JdbcSourceConfiguration.class)

- And adding Oracle dependency to the POM this way:
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc</artifactId>
        <version>8</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/src/main/resources/lib/ojdbc8.jar</systemPath>
    </dependency>

No other changes than these.

The build is successful, however when I register and deploy as a stream in SCDF, I get the following error for the source deployment:

2020-04-16 13:10:12.181  INFO 1035 --- [           main] c.f.P.u.a.d.j.JdbcPatchedApplication     : Starting JdbcPatchedApplication v0.0.1-SNAPSHOT on 05145644064d with PID 1035 (/root/.m2/repository/com/fmr/PR000471/upper/ai/data/jdbc-patched/0.0.1-SNAPSHOT/jdbc-patched-0.0.1-SNAPSHOT.jar started by root in /tmp/1587042609272/testStream.source-jdbc-v1)
2020-04-16 13:10:12.185  INFO 1035 --- [           main] c.f.P.u.a.d.j.JdbcPatchedApplication     : No active profile set, falling back to default profiles: default
2020-04-16 13:10:12.580  WARN 1035 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.springframework.cloud.stream.app.jdbc.source.JdbcSourceConfiguration]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.cloud.stream.config.BinderFactoryConfiguration
2020-04-16 13:10:12.606 ERROR 1035 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.springframework.cloud.stream.app.jdbc.source.JdbcSourceConfiguration]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.cloud.stream.config.BinderFactoryConfiguration
    at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:609) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:310) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:249) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:599) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:310) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:249) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:206) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:174) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:319) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:236) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.6.RELEASE.jar!/:2.2.6.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.6.RELEASE.jar!/:2.2.6.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.6.RELEASE.jar!/:2.2.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.6.RELEASE.jar!/:2.2.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.6.RELEASE.jar!/:2.2.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.6.RELEASE.jar!/:2.2.6.RELEASE]
    at com.fmr.PR000471.upper.ai.data.jdbcpatched.JdbcPatchedApplication.main(JdbcPatchedApplication.java:12) [classes!/:0.0.1-SNAPSHOT]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_192]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_192]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_192]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_192]
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [jdbc-patched-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [jdbc-patched-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) [jdbc-patched-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) [jdbc-patched-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
Caused by: java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.cloud.stream.config.BinderFactoryConfiguration
    at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:164) ~[spring-core-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.retrieveBeanMethodMetadata(ConfigurationClassParser.java:402) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:325) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:249) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:599) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    ... 28 common frames omitted
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.stream.config.BinderFactoryConfiguration] from ClassLoader [org.springframework.boot.loader.LaunchedURLClassLoader@37f8bb67]
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481) ~[spring-core-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:455) ~[spring-core-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:153) ~[spring-core-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    ... 32 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/springframework/integration/handler/support/HandlerMethodArgumentResolversHolder
    at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_192]
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_192]
    at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_192]
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463) ~[spring-core-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
    ... 34 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.integration.handler.support.HandlerMethodArgumentResolversHolder
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_192]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_192]
    at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:92) ~[jdbc-patched-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_192]
    ... 38 common frames omitted

Thanks

aaryadewa commented 4 years ago

@curdeep I've the same problem. Did you found any solution for this?