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

cannot find symbol [ERROR] symbol: method withStatementCache(info.archinnov.achilles.internals.cache.StatementsCache #337

Open
gmanolache opened this issue Jun 11, 2018 · 9 comments

Comments

@gmanolache
Copy link

Hello,

I'm using JUnit and achilles-junit:

@Rule
    public AchillesTestResource<ManagerFactory> resource = AchillesTestResourceBuilder
            .forJunit()
            .tablesToTruncate("app_devices")
            .createAndUseKeyspace("deep")
            .build((cluster, statementsCache) -> ManagerFactoryBuilder
                    .builder(cluster)
                    .doForceSchemaCreation(true)
                    .withStatementCache(statementsCache) //MANDATORY
                    .withDefaultKeyspaceName("deep")
                    .build()
            );

And I'm getting the error:

Compilation failure
[ERROR] /work/src/test/java/com/sample/cassandra/test/AppDevicesTest.java:[29,21] cannot find symbol
[ERROR]   symbol:   method withStatementCache(info.archinnov.achilles.internals.cache.StatementsCache)
[ERROR]   location: class info.archinnov.achilles.generated.ManagerFactoryBuilder

Without .withStatementCache(statementsCache) seems to work fine.

@doanduyhai
Copy link
Owner

Which version of Achilles are you using ?

@gmanolache
Copy link
Author

I'm using the latest, 6.0.0

@doanduyhai
Copy link
Owner

I just upgraded KillrChat the test project for Achilles to version 6.0.0 and it just compiles fine: https://github.com/doanduyhai/killrchat/blob/AchillesDemo/src/test/java/com/datastax/demo/killrchat/service/ChatRoomServiceTest.java#L49

I think you have a IDE cache/refresh issue with your code. Try to do a mvn clean compile on the command line with .withStatementCache(statementsCache) to check

@gmanolache
Copy link
Author

Still having the same issue after clean.

Here is a snippet of my pom.xml

        <dependency>
            <groupId>info.archinnov</groupId>
            <artifactId>achilles-core</artifactId>
            <version>${achilles.version}</version>
        </dependency>

        <dependency>
            <groupId>info.archinnov</groupId>
            <artifactId>achilles-model</artifactId>
            <version>${achilles.version}</version>
        </dependency>

        <dependency>
            <groupId>info.archinnov</groupId>
            <artifactId>achilles-schema-generator</artifactId>
            <version>${achilles.version}</version>
        </dependency>

        <dependency>
            <groupId>info.archinnov</groupId>
            <artifactId>achilles-junit</artifactId>
            <version>${achilles.version}</version>
            <scope>test</scope>
        </dependency>

@doanduyhai
Copy link
Owner

  1. You don't need achilles-model in the pom.xml, achilles-core will pull it automatically for you

  2. Can you please provide the Exception stack trace when running mvn clean compile ?

@gmanolache
Copy link
Author

Thanks for the tip.
As for mvn clean compile I have no stack trace as it completes successfully.
On the other hand, mvn clean install fails with this error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:testCompile (default-testCompile) on project cassandra: Compilation failure
[ERROR] /work/sample/cassandra/src/test/java/com/cassandra/test/MockAppDeviceTokenRepository.java:[19,21] cannot find symbol
[ERROR]   symbol:   method withStatementCache(info.archinnov.achilles.internals.cache.StatementsCache)
[ERROR]   location: class info.archinnov.achilles.generated.ManagerFactoryBuilder
[ERROR] 
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:testCompile (default-testCompile) on project cassandra: Compilation failure
/work/sample/cassandra/src/test/java/com/cassandra/test/MockAppDeviceTokenRepository.java:[19,21] cannot find symbol
  symbol:   method withStatementCache(info.archinnov.achilles.internals.cache.StatementsCache)
  location: class info.archinnov.achilles.generated.ManagerFactoryBuilder

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:564)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
/work/sample/cassandra/src/test/java/com/cassandra/test/MockAppDeviceTokenRepository.java:[19,21] cannot find symbol
  symbol:   method withStatementCache(info.archinnov.achilles.internals.cache.StatementsCache)
  location: class info.archinnov.achilles.generated.ManagerFactoryBuilder

    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1161)
    at org.apache.maven.plugin.compiler.TestCompilerMojo.execute (TestCompilerMojo.java:176)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:564)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)

@doanduyhai
Copy link
Owner

The command mvn clean install will install your project jar into the local Maven repository.

I don't know how you configured your pom.xml but I think the bug is probably a configuration issue

If mvn clean compile works, it means that there is no bug with Achilles per see

@ssrinathraju
Copy link

Any fix for this?
I'm also facing the same issue
Couldn't find the detail reason why it is failing

@doanduyhai
Copy link
Owner

Does mvn clean compile works for you @ssrinathraju ?

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

No branches or pull requests

3 participants