File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes returning a hashmap Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "returning a hashmap" Watch "returning a hashmap" New topic

returning a hashmap

marten kay
Ranch Hand

Joined: Feb 03, 2007
Posts: 178

A real beginners question.

I am populating a HashMap (DnaiInstrument) in a database utility as below

I then when I call the getInstrument() method in the code below I get a
java.lang.NoClassDefFoundError: DNAI/data/DnaiDB DNAI.struts.TestAction.execute(

Something is wrong at the DnaiInstrument = DnaiDB.getInstrument();

where I am returning a HashMap into a HashMap variable. The program compiles, and intuitively I understand that this may be wrong, but I can't figure out how.

Hope someone can help, thanks
[ September 05, 2008: Message edited by: marten kay ]

when in doubt put it in parenthesis and stick a dollar sign in front of it, only good can come from this.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

Nothing wrong with the code if it compiles; this is just a deployment problem. Either you're not putting all the class files into your jar(s), or some of your jar files aren't being put in the right place in your web server. I'm going to move this over to the Struts forum, because perhaps Struts has some special requirements for how classes have to be installed. But again, there's nothing at all wrong with the code -- it has nothing to do with "returning a hashmap."

[Jess in Action][AskingGoodQuestions]
marten kay
Ranch Hand

Joined: Feb 03, 2007
Posts: 178

Thanks Ernest

I now think it was something in my netbeans, I rewrote the class with a different name but same code and it now works. This case closed.

thanks again and cheers

I agree. Here's the link:
subject: returning a hashmap
It's not a secret anymore!