Hi guys, I am using Java with AWS, trying to confi...
# getting-started
a
Hi guys, I am using Java with AWS, trying to configure a target group for my load balancer:
Copy code
public static TargetGroup targetGroupCreator(Vpc myvpc) {
    return new TargetGroup("myTg", TargetGroupArgs.builder()
            .port(8080)
            .protocol("HTTP")
            .vpcId(myvpc.id())
            .build());
}
and I end up with this error: java.lang.UnsupportedOperationException: Convert [com.pulumi.aws.alb.TargetGroup.targetHealthStates]: Error converting 'java.util.Collections$UnmodifiableRandomAccessList' to 'TypeShape{type=interface java.util.List, parameters=[TypeShape{type=class com.pulumi.aws.alb.outputs.TargetGroupTargetHealthState, parameters=[]}]}'. null Went over all resources in docs and example repo on github, cannot figure it out. Docs indicate that targetHealthStates does not apply to HTTP and therefore I left it out. Apparently it is causing problem even with its absence. This code I am testing is pretty much the same as in the example in docs. Has anyone encountered this before? Am I missing something? Thanks for any help or ideas!
e
This looks like a Java SDK bug rather than anything AWS specific. Firstly do raise an issue about this on the java repo, this should just work. As a workaround try setting targetHealthStates to an empty list (not null) in the builder and see if that helps.
a
Hi Fraser, Thank you for the reply! I will raise the issue.
w
Which version of java should I use? I am getting the same error
w
Try changing the dependency versions in your pom.xml, at least these worked for me <dependency> <groupId>com.pulumi</groupId> <artifactId>pulumi</artifactId> <version>0.9.5</version> </dependency> <dependency> <groupId>com.pulumi</groupId> <artifactId>aws</artifactId> <version>5.42.0</version> </dependency>