Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding cassandra sample for spring boot #228

Merged

Conversation

aditya300899
Copy link
Member

Facing an error. Logs:

15391 --- [ main] org.teiid.spring.example.Application : Starting Application on aditya-Inspiron-5570 with PID 15391 (/home/aditya/Desktop/Teiid/teiid-spring-boot/samples/cassandra/target/classes started by aditya in /home/aditya/Desktop/Teiid/teiid-spring-boot)
2020-05-21 14:04:06.330 DEBUG 15391 --- [ main] org.teiid.spring.example.Application : Running with Spring Boot v2.2.6.RELEASE, Spring v5.2.5.RELEASE
2020-05-21 14:04:06.332 INFO 15391 --- [ main] org.teiid.spring.example.Application : No active profile set, falling back to default profiles: default
2020-05-21 14:04:10.000 INFO 15391 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2020-05-21 14:04:10.059 INFO 15391 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 42ms. Found 0 JPA repository interfaces.
2020-05-21 14:04:11.073 INFO 15391 --- [ main] o.t.s.a.TeiidBeanDefinitionPostProcessor : Found data sources: []
2020-05-21 14:04:11.949 INFO 15391 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.teiid.spring.autoconfigure.TransactionManagerConfiguration' of type [org.teiid.spring.autoconfigure.TransactionManagerConfiguration$$EnhancerBySpringCGLIB$$89cf0ae0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-05-21 14:04:12.041 INFO 15391 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'platformTransactionManagerAdapter' of type [org.teiid.spring.autoconfigure.PlatformTransactionManagerAdapter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-05-21 14:04:12.365 INFO 15391 --- [ main] o.t.s.a.TeiidAutoConfiguration : Starting Teiid Server.
2020-05-21 14:04:17.264 INFO 15391 --- [ main] org.teiid.RUNTIME.VDBLifeCycleListener : TEIID40118 VDB spring.1.0.0 added to the repository
2020-05-21 14:04:17.273 INFO 15391 --- [ main] org.teiid.RUNTIME.VDBLifeCycleListener : TEIID40003 VDB spring.1.0.0 is set to ACTIVE
2020-05-21 14:04:17.543 INFO 15391 --- [ main] o.s.j.d.e.EmbeddedDatabaseFactory : Starting embedded database: url='jdbc:teiid:spring;PassthroughAuthentication=true;useCallingThread=true;autoFailover=true;waitForLoad=5000;autoCommitTxn=OFF;disableLocalTxn=true', username='null'
2020-05-21 14:04:19.233 INFO 15391 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2020-05-21 14:04:19.687 INFO 15391 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.12.Final
2020-05-21 14:04:21.212 INFO 15391 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2020-05-21 14:04:21.477 INFO 15391 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.teiid.dialect.TeiidDialect
2020-05-21 14:04:22.397 INFO 15391 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2020-05-21 14:04:22.422 INFO 15391 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2020-05-21 14:04:23.104 INFO 15391 --- [ main] o.t.spring.autoconfigure.TeiidServer : Added accounts to the Teiid Database
2020-05-21 14:04:23.105 INFO 15391 --- [ main] org.teiid.RUNTIME.VDBLifeCycleListener : TEIID40120 VDB spring.1.0.0 will be removed from the repository
2020-05-21 14:04:23.105 INFO 15391 --- [ main] org.teiid.RUNTIME.VDBLifeCycleListener : TEIID40119 VDB spring.1.0.0 removed from the repository
2020-05-21 14:04:23.152 INFO 15391 --- [ main] org.teiid.RUNTIME.VDBLifeCycleListener : TEIID40118 VDB spring.1.0.0 added to the repository
2020-05-21 14:04:23.174 INFO 15391 --- [ main] org.teiid.RUNTIME : TEIID50029 VDB spring.1.0.0 model "accounts" metadata is currently being loaded. Start Time: 21/5/20 2:04 PM
2020-05-21 14:04:23.351 INFO 15391 --- [ main] com.datastax.driver.core : DataStax Java driver 3.7.2 for Apache Cassandra
2020-05-21 14:04:23.473 INFO 15391 --- [ main] c.d.driver.core.GuavaCompatibility : Detected Guava >= 19 in the classpath, using modern compatibility layer
2020-05-21 14:04:25.315 INFO 15391 --- [ main] com.datastax.driver.core.ClockFactory : Using native clock to generate timestamps.
2020-05-21 14:04:25.972 INFO 15391 --- [ main] com.datastax.driver.core.NettyUtil : Found Netty's native epoll transport in the classpath, using it
2020-05-21 14:04:26.250 WARN 15391 --- [ main] org.teiid.RUNTIME : TEIID50036 VDB spring.1.0.0 model "accounts" metadata failed to load. Reason:TEIID31178 Could not obtain connection for schema accounts, but one is required for metadata load.

@shawkins
Copy link
Contributor

That's very strange that you see logs related to the cassandra driver, but no exception about the connection attempt failing. You can try increasing the log level or running with a debugger to see what is happening with the CassandraConnection.

@aditya300899
Copy link
Member Author

It seems to be due to :
java.lang.ClassNotFoundException: com.codahale.metrics.JmxReporter

A solution is mentioned in https://docs.datastax.com/en/developer/java-driver/3.7/manual/metrics/
I think this is the problem, what do you think?

@shawkins
Copy link
Contributor

Yes, that needs addressed. We can either add the 4.x metrics dependency or do our own check for that class and use the withoutJMXReporting option.

Does this happen in core Teiid as well, or is it only happening in Teiid Spring Boot?

@aditya300899
Copy link
Member Author

I haven't checked it with the core. I can though, but I have no idea of deploying it on the wildfly and testing. I would need help. Or if @rareddy knows?

@shawkins
Copy link
Contributor

I haven't checked it with the core. I can though, but I have no idea of deploying it on the wildfly and testing. I would need help.

You can either:

I'm guessing that since the cassandra driver already has a dependency on the 3.2 metrics that this has something to do with running in spring boot such that some of other classes are already on the classpath so it thinks it should use metrics 4 instead. WildFly won't have that issue as the classpaths are controlled for each module.

@aditya300899
Copy link
Member Author

I'm guessing that since the cassandra driver already has a dependency on the 3.2 metrics that this has something to do with running in spring boot such that some of other classes are already on the classpath so it thinks it should use metrics 4 instead. WildFly won't have that issue as the classpaths are controlled for each module.

Yes, you are right! This sample works fine on adding metrics 3.2.2 dependency in spring-data-cassandra and in sample as well. Somehow, it was detecting the version to be 4.x before due to other dependencie in teiid-spring-boot. Shall I commit the changes?

@shawkins
Copy link
Contributor

Shall I commit the changes?

Yes please.

@aditya300899 aditya300899 force-pushed the TEIIDSB-201-cassandra-sample-example branch from 277865c to e2037b1 Compare May 29, 2020 08:11
@aditya300899
Copy link
Member Author

@shawkins please have a look!

@shawkins shawkins merged commit 0a84995 into teiid:master May 30, 2020
@shawkins
Copy link
Contributor

LGTM thanks!

@aditya300899
Copy link
Member Author

Should I add the readme now?
And, what about tha YAML file in operator?

@shawkins
Copy link
Contributor

shawkins commented Jun 1, 2020

Yes those would be great. The yaml cr are being added to https://github.com/teiid/teiid-operator/tree/master/deploy/crs

If you have had success running minishift or crc you can provide a full working example under https://github.com/teiid/teiid-openshift-examples that includes the crs for setting up a cassandra instance/Teiid and any other steps to get it working.

@aditya300899
Copy link
Member Author

Yes those would be great. The YAML cr are being added to https://github.com/teiid/teiid-operator/tree/master/deploy/crs

By being added you mean, one among you is doing?

If you have had success running minishift or crc you can provide a full working example under https://github.com/teiid/teiid-openshift-examples that includes the crs for setting up a cassandra instance/Teiid and any other steps to get it working.

No, I haven't tried running it yet! I'll see if I can do that on my system.

@rareddy
Copy link
Member

rareddy commented Jun 1, 2020

I can add the Operator CR based on your Spring Boot example

@aditya300899
Copy link
Member Author

@rareddy How about screen sharing with me when you do it? So that I can see how things go in the operator.

@shawkins
Copy link
Contributor

shawkins commented Jun 3, 2020

@aditya300899 I can show the operator on Friday if you want. We're also looking at options to get you an openshift instance. The simplest starting point would be the tutorials and playground from https://www.openshift.com/try - which will give you an environment for an hour.

@aditya300899 aditya300899 deleted the TEIIDSB-201-cassandra-sample-example branch June 4, 2020 06:40
@aditya300899
Copy link
Member Author

@aditya300899 I can show the operator on Friday if you want. We're also looking at options to get you an openshift instance.

Yes, please!

The simplest starting point would be the tutorials and playground from https://www.openshift.com/try - which will give you an environment for an hour.

I'll give this a try!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants