Hi Chunwei, I do not believe that is gonna work because, to my understanding, Calcite has internal dependency on *com/google/protobuf/GeneratedMessageV3 *which is only available in Protobuf version 3+ onwards. Error trace:-
*Exception in thread "main" java.lang.NoClassDefFoundError: com/google/protobuf/GeneratedMessageV3* * at java.lang.ClassLoader.defineClass1(Native Method)* * at java.lang.ClassLoader.defineClass(ClassLoader.java:763)* * at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)* * at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)* * at java.net.URLClassLoader.access$100(URLClassLoader.java:73)* * at java.net.URLClassLoader$1.run(URLClassLoader.java:368)* * at java.net.URLClassLoader$1.run(URLClassLoader.java:362)* * at java.security.AccessController.doPrivileged(Native Method)* * at java.net.URLClassLoader.findClass(URLClassLoader.java:361)* * at java.lang.ClassLoader.loadClass(ClassLoader.java:424)* * at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)* * at java.lang.ClassLoader.loadClass(ClassLoader.java:357)* * at org.apache.calcite.avatica.ConnectionPropertiesImpl.<clinit>(ConnectionPropertiesImpl.java:38)* * at org.apache.calcite.avatica.MetaImpl.<init>(MetaImpl.java:72)* * at org.apache.calcite.jdbc.CalciteMetaImpl.<init>(CalciteMetaImpl.java:85)* * at org.apache.calcite.jdbc.Driver.createMeta(Driver.java:169)* * at org.apache.calcite.avatica.AvaticaConnection.<init>(AvaticaConnection.java:121)* * at org.apache.calcite.jdbc.CalciteConnectionImpl.<init>(CalciteConnectionImpl.java:118)* * at org.apache.calcite.jdbc.CalciteJdbc41Factory$CalciteJdbc41Connection.<init>(CalciteJdbc41Factory.java:115)* * at org.apache.calcite.jdbc.CalciteJdbc41Factory.newConnection(CalciteJdbc41Factory.java:59)* * at org.apache.calcite.jdbc.CalciteJdbc41Factory.newConnection(CalciteJdbc41Factory.java:1)* * at org.apache.calcite.jdbc.CalciteFactory.newConnection(CalciteFactory.java:53)* * at org.apache.calcite.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:138)* * at java.sql.DriverManager.getConnection(DriverManager.java:664)* * at java.sql.DriverManager.getConnection(DriverManager.java:208)* * at org.apache.calcite.tools.Frameworks.withPrepare(Frameworks.java:153)* * at org.apache.calcite.tools.RelBuilder.create(RelBuilder.java:209)* Is there any other alternate way I can use making this connection? Regards, Rakesh On Wed, Apr 17, 2019 at 12:59 PM Chunwei Lei <[email protected]> wrote: > Hi, Rakesh > > I find that it says Protobuf doesn't provide source/binary > compatibility across different versions after searching the error > message using google[1]. > > Maybe you can try to compile source code of Calcite which uses the > same version of Protobuf in Phoenix. But I am not sure that it can > work. > > > [1] https://groups.google.com/forum/#!topic/protobuf/N8rznIMcwWg > > > Bests, > Chunwei > > Rakesh Nair <[email protected]> 于2019年4月17日周三 下午3:03写道: > > > > Hi, > > Could someone kindly help me with the problem I'm facing in my previous > > email? I've been sitting on this for some time now and would really like > to > > solve it. > > For what it's worth, these are the dependencies I'm using, > > *<dependencies>* > > * <!-- > https://mvnrepository.com/artifact/org.apache.calcite/calcite-core > > <https://mvnrepository.com/artifact/org.apache.calcite/calcite-core> > -->* > > * <dependency>* > > * <groupId>org.apache.calcite</groupId>* > > * <artifactId>calcite-core</artifactId>* > > * <version>1.19.0</version>* > > * </dependency>* > > * <!-- > https://mvnrepository.com/artifact/org.apache.phoenix/phoenix-core > > <https://mvnrepository.com/artifact/org.apache.phoenix/phoenix-core> > -->* > > * <dependency>* > > * <groupId>org.apache.phoenix</groupId>* > > * <artifactId>phoenix-core</artifactId>* > > * <version>5.0.0.3.0.1.0-187</version>* > > * </dependency>* > > * </dependencies>* > > * <repositories>* > > * <repository>* > > * <id>Hortonworks Repository</id>* > > * <url>http://repo.hortonworks.com/content/repositories/releases/ > > <http://repo.hortonworks.com/content/repositories/releases/></url>* > > * </repository>* > > * </repositories>* > > > > Waiting for you response. > > Regards, > > Rakesh. > > > > On Tue, Apr 16, 2019 at 7:03 PM Rakesh Nair <[email protected]> > > wrote: > > > > > Hi, > > > So I've trying to connect Calcite with Apache Phoenix. Code given > below: > > > > > > *public Frameworks.ConfigBuilder configPhoenix() {* > > > * SchemaPlus rootSchema = Frameworks.createRootSchema(true);* > > > > > > * DataSource dataSource = > > > JdbcSchema.dataSource("jdbc:phoenix:<ip>:<port>:/hbase-unsecure", > > > "org.apache.phoenix.jdbc.PhoenixDriver", null, null);* > > > * JdbcSchema schema = JdbcSchema.create(rootSchema, "hbase-unsecure", > > > dataSource, null, "hbase-unsecure");* > > > * for (String table : schema.getTableNames()) {* > > > * logger.info <http://logger.info>(table);* > > > * rootSchema.add(table, schema.getTable(table));* > > > * }* > > > * return Frameworks.newConfigBuilder().defaultSchema(rootSchema);* > > > * }* > > > *public static void main(String[] args) throws Exception {* > > > *FrameworkConfig config = configPhoenix().build();RelBuilder builder = > > > RelBuilder.create(config);* > > > *}* > > > > > > Unfortunately I'm getting following error: > > > > > > *Exception in thread "main" java.lang.RuntimeException: > > > java.sql.SQLException: Cannot create PoolableConnectionFactory > > > (java.lang.VerifyError: class com.google.protobuf.LiteralByteString > > > overrides final method > toString.(Ljava/lang/String;)Ljava/lang/String;)* > > > * at > > > > org.apache.calcite.adapter.jdbc.JdbcUtils$DialectPool.get(JdbcUtils.java:97)* > > > * at > > > > org.apache.calcite.adapter.jdbc.JdbcSchema.createDialect(JdbcSchema.java:184)* > > > * at > > > org.apache.calcite.adapter.jdbc.JdbcSchema.create(JdbcSchema.java:120)* > > > * at > > > org.apache.calcite.adapter.jdbc.JdbcSchema.create(JdbcSchema.java:107)* > > > > > > I presume this is happening because Protobuf 3+ jar is present in > > > classpath for use by Calcite while Phoenix actually requires Protobuf > 2.5.0. > > > > > > So could someone tell me whether I'm doing something wrong here or if > not, > > > then , how to handle this? > > > > > > Regards, > > > Rakesh > > > >
