• Post Reply Bookmark Topic Watch Topic
  • New Topic

using AWS APIs - Exception in thread "main" java.lang.VerifyError: Bad type on operand stack  RSS feed

 
arushi tomar
Ranch Hand
Posts: 91
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have been working with AWS APIs and I have written this code to run and AWS EC2 instance.




What am i possibly doing wrong?
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From these 2 lines....


... I suspect it's because your class "com.amazonaws.services.ec2.model.StartInstancesRequest" is "shadowing" the EC2 SDK's class of the same name, due to classloader order.

Now unless you are an employee of Amazon, I don't see any good reason why your class should be in "com.amazonaws.services.ec2.model" package.
Can you change your package name and/or class name to not match any SDK class, rebuild and retry?

[PS: Please enclose all code snippets in code tags in future for better readability. This link shows how. I've done it for you this time.]
 
arushi tomar
Ranch Hand
Posts: 91
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Karthik Shiraly wrote:

I am working with the AWS SDK only, So I have to use the packages and class names provided by AWS.
And thank you for the suggestion. I'll keep that in mind in the future.
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working with the AWS SDK only, So I have to use the packages and class names provided by AWS.

If you are working on an application that simply uses the AWS SDK, then you don't have to use SDK's packages and class names for the classes written by you.

If you are working on the AWS SDK project itself, then your class definition does not match the documented definition but I guess you'd already know that.

In either case, you can test the shadowing hypothesis easily by simply changing your class name (to something like "MyStartInsancesRequest") and verify if that works.
 
arushi tomar
Ranch Hand
Posts: 91
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Karthik Shiraly wrote:

Thanks for the help. I changed the class and package names and it works fine now.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!