GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — KeyFactory.kind() requires a cast... didn't expect that at all... · Issue #35 · googleapis/google-cloud-java

KeyFactory.kind() requires a cast... didn't expect that at all... #35

New issue
Copy link
New issue
Copy link
Closed
Closed
KeyFactory.kind() requires a cast... didn't expect that at all...#35
Copy link
Assignees
jgeewax
Labels
api: datastoreIssues related to the Datastore API.type: questionRequest for information or clarification. Not an issue.

Description

@jgeewax
jgeewax
opened on Mar 19, 2015
Issue body actions

Code I had was:

KeyFactory keyFactory = datastore.newKeyFactory().kind("Person");

Error I was getting was:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project hello-datastore: Compilation failure
[ERROR] /usr/local/google/home/jjg/gcdjavasample/hello-datastore/src/main/java/org/geewax/hellodatastore/HelloDatastore.java:[19,58] error: incompatible types
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project hello-datastore: Compilation failure
/usr/local/google/home/jjg/gcdjavasample/hello-datastore/src/main/java/org/geewax/hellodatastore/HelloDatastore.java:[19,58] error: incompatible types


        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        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.CompilationFailureException: Compilation failure
/usr/local/google/home/jjg/gcdjavasample/hello-datastore/src/main/java/org/geewax/hellodatastore/HelloDatastore.java:[19,58] error: incompatible types


        at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:516)
        at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Changing this to

KeyFactory keyFactory = (KeyFactory) datastore.newKeyFactory().kind("Person");

fixed the problem

However the docs at http://googlecloudplatform.github.io/gcloud-java/apidocs/com/google/gcloud/datastore/package-summary.html say I shouldn't need to do this :(

Activity

Next
  1. jgeewax
    added
    type: questionRequest for information or clarification. Not an issue.
    api: datastoreIssues related to the Datastore API.
    on Mar 19, 2015
  2. jgeewax
    added this to the This milestone has been deleted milestone on Mar 19, 2015
  3. jgeewax
    assigned
    aozarov
    on Mar 19, 2015
  4. aozarov commented on Mar 19, 2015

    @aozarov
    aozarov
    on Mar 19, 2015
    Contributor
    More actions

    How is that different from DatastoreServiceTest#testKeyFactory. it does the same and does not require a cast. did mvn compile on the github clone work fine for you?

  5. aozarov
    assigned
    jgeewax
    and unassigned
    aozarov
    on Mar 19, 2015
  6. jgeewax commented on Mar 20, 2015

    @jgeewax
    jgeewax
    on Mar 20, 2015
    Author
    More actions

    mvn compile (AND mvn test) on the GH cloned repository work just fine... but the project I created using the "Maven in 5 minutes" guide depending on version 0.0.3 fails.

    Here is my pom.xml file:

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>org.geewax.hellodatastore</groupId>
      <artifactId>hello-datastore</artifactId>
      <packaging>jar</packaging>
      <version>1.0</version>
      <name>hello-datastore</name>
      <url>http://maven.apache.org</url>
      <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>com.google.gcloud</groupId>
          <artifactId>gcloud-java</artifactId>
          <version>0.0.3</version>
        </dependency>
      </dependencies>
    
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.3.2</version>
          </plugin>
        </plugins>
      </build>
    </project>

    Any ideas? It was a completely fresh project...

  7. aozarov commented on Mar 20, 2015

    @aozarov
    aozarov
    on Mar 20, 2015
    Contributor
    More actions

    I assume this issue is a dup of issue #36?

  8. jgeewax commented on Mar 23, 2015

    @jgeewax
    jgeewax
    on Mar 23, 2015
    Author
    More actions

    Yes I believe it is.

  9. jgeewax
    closed this as completedon Mar 23, 2015
  10. garrettjonesgoogle
    added a commit that references this issue on Mar 29, 2016

    Merge pull request googleapis#35 from shinfan/dev

    60c22b6
  11. github-actions
    added 3 commits that reference this issue on Jun 23, 2022

    deps: update dependency com.google.cloud:google-cloud-shared-dependen…

    6401e31

    chore(main): release 0.2.1 (#36)

    9f30ad8

    deps: update dependency com.google.cloud:google-cloud-core to v1.92.0 (…

    80999eb
  12. 5 remaining items

  13. github-actions
    added a commit that references this issue on Sep 15, 2022

    chore(main): release 0.3.0 (#35)

    2a89ba2
  14. github-actions
    added 9 commits that reference this issue on Sep 30, 2022

    deps: update dependency jinja2 to v3.1.2 (#35)

    004033b

    deps: update dependency zipp to v3.8.1 (#35)

    f34b231

    deps: update dependency importlib-metadata to v4.12.0 (#35)

    6f9a9e9

    deps: update dependency zipp to v3.8.1 (#35)

    a79d362

    chore(main): release 0.1.1 (#35)

    76f8e29

    chore(main): release 0.1.0 (#9)

    a9f9e4c

    chore(main): release 0.1.0 (#7)

    65c4db8

    chore(main): release 0.1.0 (#7)

    12b7ab7

    chore(main): release 0.1.0 (#7)

    1b48de8
  15. chingor13
    added a commit that references this issue on Feb 24, 2026

    Merge pull request #35 from wilford/master

    a28512c
  16. chingor13
    added a commit that references this issue on Mar 12, 2026

    Merge pull request #35 from wilford/master

    d6fa6ed
  17. suztomo
    added a commit that references this issue on Mar 23, 2026

    feat: support PreparedStatement#getParameterMetaData() (googleapis#1218)

    This issue will close once commit ba86739 is merged into the 'main' branch.
    ba86739
  18. meltsufin
    added 2 commits that reference this issue on Apr 29, 2026

    chore: release 1.102.1-SNAPSHOT (#35)

    981c02b

    chore: release 1.102.1-SNAPSHOT (#35)

    19bcbe5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @jgeewax
    jgeewax

Labels

api: datastoreIssues related to the Datastore API.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.