| Author |
NoSuchMethodError while accessing Entity bean via a Struts Action
|
Subhash Bhushan C
Ranch Hand
Joined: Jan 27, 2005
Posts: 106
|
|
Hi, I have an action class ProfileDetailAction, which implements the getter/setter methods related to Profiles. I have 2 classes RegistrationAction and AlterProfileAction extending from it. I have an EJB 3.0 entity class called ProfileDetail which is mapped to an underlying table in MySQL. ProfileDetailAction.java: RegistrationAction.java: ProfileDetail.java: The firstName variable in ProfileDetail action is getting filled properly (I am able to see them in debug mode.) When setFirstName() gets called in RegistrationAction, I get the following error:
I am not sure whether this is a classloader problem, or I am doing something wrong. I am using JBoss, with MySQL DB. I am using Eclipse, and the IDE does not throw up any errors too. Any clues are welcome.
|
Regards,<br />Subhash Bhushan.
|
 |
Marimuthu Madasamy
Ranch Hand
Joined: Jun 07, 2007
Posts: 72
|
|
I got one clue from the error message you got,
see there is 'L' in the parameter class, that means it is expecting a method having a String array as parameter like this, com.justbooks.entities.ProfileDetail.setFirstName(String[] arg) - Marimuthu M
|
- Marimuthu Madasamy
|
 |
Anubhav Anand
Ranch Hand
Joined: May 18, 2007
Posts: 341
|
|
I once received similar kind of error message
In my case it was a problem because of conflict of JDK versions.The error was caused by a JDK (Java Development Kit) version incompatibility. So, as far as my knowledge goes such errors occur when you compile a class with one version of the JDK, then run them with an older JVM (Java Virtual Machine). Might be same is true in your case.
|
 |
Subhash Bhushan C
Ranch Hand
Joined: Jan 27, 2005
Posts: 106
|
|
Originally posted by Marimuthu Madasamy: I got one clue from the error message you got, see there is 'L' in the parameter class, that means it is expecting a method having a String array as parameter like this, com.justbooks.entities.ProfileDetail.setFirstName(String[] arg) - Marimuthu M
Hmm... Actually, the signature seems to be correct. Please refer this link: http://www.rgagnon.com/javadetails/java-0286.html From that, its clear that my method's signature is right. ----------------------------------------- public java.awt.Label(java.lang.String); /* (Ljava/lang/String V */ ----------------------------------------- Anand, I have only one Java version on my laptop, jdk1.5.0_01, which is being used by both Eclipse (my IDE) and JBoss (my App Server). I saw quite a number of posts on the net indicating it might be a version mismatch. But I dont think that applies to this situation. But will keep looking.
|
 |
Anubhav Anand
Ranch Hand
Joined: May 18, 2007
Posts: 341
|
|
Just for a check. Verify if the version of JRE libraries is also consistent(between eclipse and JBoss). I mean if both use the same JDK but if somehow by chance both use differenr patches of JRE libraries . They may also pose problems.
|
 |
Marimuthu Madasamy
Ranch Hand
Joined: Jun 07, 2007
Posts: 72
|
|
oh.. sorry.. i misunderstood. Thanks for the link Subhash. coming to your problem, one more thing you can do is, use javap to inspect the compiled ProfileDetail class in the deployed web application whether it has the setFirstName method. If it is not there, then try cleaning and rebuilding the project. - Marimuthu M
|
 |
Anubhav Anand
Ranch Hand
Joined: May 18, 2007
Posts: 341
|
|
Originally posted by Marimuthu Madasamy: use javap to inspect the compiled ProfileDetail class in the deployed web application whether it has the setFirstName method. If it is not there, then try cleaning and rebuilding the project. - Marimuthu M
Very true. This can also be the case. well pointed Marimuthu
|
 |
Subhash Bhushan C
Ranch Hand
Joined: Jan 27, 2005
Posts: 106
|
|
Solved it... You guys wont believe what the problem was... JBoss was not replacing old class files with new files in a newly deployed EAR. So, the first version of the file was being referenced. Once I cleaned up the deployment directory, everything worked just fine... Thanks for the help, guys...
|
 |
 |
|
|
subject: NoSuchMethodError while accessing Entity bean via a Struts Action
|
|
|