Dgraph4j conflict with hbase

Posted by lxwithgod:

please help me,
I use dgraph4j, it confict with hbase ,maybe be because of com.google.guava;
I can use dgraph,but i use hbase,spark…,with error "java.lang.IllegalAccessError: tried to access method com.google.common.base.Stopwatch.()V "

now what should I do ?
thanks

deepakjois commented :

Can you provide some more details, please? It isnt possible to tell what’s going on based on your description.

Can you post a minimal reproduction of the problem. Maybe the source code of a Java class which causes the issue?

lxwithgod commented :

thanks ,I’ve solved this problem。but i use shade。

lxwithgod commented :

<?xml version="1.0" encoding="UTF-8"?>


4.0.0

<groupId>io.dgraph</groupId>
<artifactId>dgraph4j-shade</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>

    <dependency>
        <groupId>io.dgraph</groupId>
        <artifactId>dgraph4j</artifactId>
        <version>0.8.1</version>
    </dependency>


</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.4.1</version>
            <configuration>
                <createDependencyReducedPom>true</createDependencyReducedPom>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <relocations>
                            <relocation>
                                <pattern>com.google.guava</pattern>
                                <shadedPattern>com.dataPlatform.guava</shadedPattern>
                            </relocation>
                            <relocation>
                                <pattern>com.google.errorprone</pattern>
                                <shadedPattern>com.dataPlatform.errorprone</shadedPattern>
                            </relocation>
                            <relocation>
                                <pattern>com.google.api.grpc</pattern>
                                <shadedPattern>com.dataPlatform.api.grpc</shadedPattern>
                            </relocation>
                            <relocation>
                                <pattern>com.google.code.findbugs</pattern>
                                <shadedPattern>com.dataPlatform.code.findbugs</shadedPattern>
                            </relocation>
                            <relocation>
                                <pattern>com.google.code.gson</pattern>
                                <shadedPattern>com.dataPlatform.code.gson</shadedPattern>
                            </relocation>
                            <relocation>
                                <pattern>com.google.instrumentation</pattern>
                                <shadedPattern>com.dataPlatform.instrumentation</shadedPattern>
                            </relocation>
                            <relocation>
                                <pattern>com.google.protobuf</pattern>
                                <shadedPattern>com.dataPlatform.protobuf</shadedPattern>
                            </relocation>
                            <relocation>
                                <pattern>com.google.common</pattern>
                                <shadedPattern>com.dataPlatform.common</shadedPattern>
                            </relocation>
                            <relocation>
                                <pattern>com.google.gson</pattern>
                                <shadedPattern>com.dataPlatform.gson</shadedPattern>
                            </relocation>
                            <relocation>
                                <pattern>com.google.thirdparty</pattern>
                                <shadedPattern>com.dataPlatform.thirdparty</shadedPattern>
                            </relocation>
                            <relocation>
                                <pattern>google.protobuf</pattern>
                                <shadedPattern>dataPlatform.protobuf</shadedPattern>
                            </relocation>

                        </relocations>
                        <transformers>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer" />
                        </transformers>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

deepakjois commented :

Ok, that is good. dgraph4j consumes the following dependencies for compilation:

   // The production code uses the SLF4J logging API at compile time
    compile "org.slf4j:slf4j-api:1.7.21"
    compile "org.slf4j:slf4j-simple:1.7.21"
    compile "io.grpc:grpc-netty:${grpcVersion}"
    compile "io.grpc:grpc-protobuf:${grpcVersion}"
    compile "io.grpc:grpc-stub:${grpcVersion}"

So as you can see, it’s fairly minimal. I am not sure what could be possible reason for conflicts.

Closing this for now. But let us know if you think there is something we need to do on our end.