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

Casting issue in PropertyUtil #94

Closed
conrosebraugh opened this issue Jul 20, 2023 · 10 comments
Closed

Casting issue in PropertyUtil #94

conrosebraugh opened this issue Jul 20, 2023 · 10 comments

Comments

@conrosebraugh
Copy link

I am encountering an issue when running unit tests in a custom library that has Cadence as a dependency. This block of code has an issue when casting a Class to a String. The call to the PropertyUtil function is coming from AppProps.getApplicationJarClass. Here is the stack trace:

java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.String at cascading.property.AppProps.getApplicationJarClass(AppProps.java:113) at cascading.flow.hadoop.planner.HadoopPlanner.initialize(HadoopPlanner.java:166) at com.anon.cascading_ext.flow.LoggingHadoopPlanner.initialize(LoggingHadoopPlanner.java:75) at com.anon.cascading_ext.flow.LoggingFlowConnector.connect(LoggingFlowConnector.java:68) at cascading.flow.FlowConnector.connect(FlowConnector.java:421) at cascading.flow.FlowConnector.connect(FlowConnector.java:270) at cascading.flow.FlowConnector.connect(FlowConnector.java:215) at cascading.flow.FlowConnector.connect(FlowConnector.java:197) at com.anon.formats.mapred.inputformat.TestDirectoryLineInputFormat.testGetCurrentTapSourcePath(TestDirectoryLineInputFormat.java:61)

This could be solved by checking if defaultValue is an instance of String and using the Class.toString function. My org is in the process of upgrading from a very old version of Cascading to Cascading 4.5.0. In the version that we are using, AppProp.getApplicationJarClass actually passes a null Class object as the default value.

Is there a recommended method of fixing this casting issue?

Running into this on JDK 8, Cascading 4.5.0

@cwensel
Copy link
Owner

cwensel commented Jul 20, 2023

Do you think #96 will resolve this?

@conrosebraugh
Copy link
Author

Deleted a dumb response that I had earlier, hopefully that didn't bug you too much. Yes, that seems like it would solve the issue. Thanks so much for the prompt response!

@cwensel
Copy link
Owner

cwensel commented Jul 20, 2023

excellent, when/if the tests pass, i'll merge into wip-4.5 so you can test locally.

if that works, I can push a 4.5.1 release into maven.

@cwensel
Copy link
Owner

cwensel commented Jul 21, 2023

@conrosebraugh
Copy link
Author

What maven repository can I find these wip releases in?

@cwensel
Copy link
Owner

cwensel commented Jul 21, 2023

All wip releases are hosted by Github.

https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry

it's a real pain, but I think i'd be violating sonatype rules if I published wips there, haven't looked at publishing to sonatype snapshot repo. #85

@conrosebraugh
Copy link
Author

I added the following to the pom file for my project:

<repositories>
    <repository>
      <id>github</id>
      <url>https://maven.pkg.github.com/cwensel/cascading</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

And I get a 401: Unauthorized error when Maven tries to download the dependency.

[ERROR] Failed to execute goal on project cascading_tools: Could not resolve dependencies for project com.anon:cascading_tools:jar:2.0-SNAPSHOT: Failed to collect dependencies at net.wensel:cascading-hadoop3-common:jar:4.5.1-wip-26: Failed to read artifact descriptor for net.wensel:cascading-hadoop3-common:jar:4.5.1-wip-26: Could not transfer artifact net.wensel:cascading-hadoop3-common:pom:4.5.1-wip-26 from/to github (https://maven.pkg.github.com/cwensel/cascading): authentication failed for https://maven.pkg.github.com/cwensel/cascading/net/wensel/cascading-hadoop3-common/4.5.1-wip-26/cascading-hadoop3-common-4.5.1-wip-26.pom, status: 401 Unauthorized -> [Help 1]

@cwensel
Copy link
Owner

cwensel commented Jul 21, 2023

@conrosebraugh
Copy link
Author

@cwensel The proposed change fixed the issue that I was having. Thanks for your patience and sharing that documentation. Let me know when the 4.5.1 release is public. Thanks so much!

@cwensel
Copy link
Owner

cwensel commented Jul 31, 2023

@cwensel cwensel closed this as completed Jul 31, 2023
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

2 participants