Solved

Web app in eclipse VS weblogic server - NoSuchMethodError issue

Posted on 2006-07-01
30
321 Views
Last Modified: 2008-03-17
Hi,

This program used to work fine in eclipse, but having this error in weblogic server. I read some articles about change setting in weblogic server. Is there any way that I can fix this without changing setting?


Error 500--Internal Server Error

java.lang.NoSuchMethodError: StudentInfo.setUserId(Ljava/lang/String;)V
      at RegistrationServlet.doGet(RegistrationServlet.java:94)
      at RegistrationServlet.doPost(RegistrationServlet.java:208)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)


BTW, StudentInfo is just simple java bean.

thanks in advance.
0
Comment
Question by:dkim18
  • 11
  • 7
  • 6
  • +2
30 Comments
 
LVL 15

Accepted Solution

by:
bpmurray earned 200 total points
ID: 17024764
It looks like yout RegistrationServlet doesn't have the bean available. Where is the StudentInfo bean located? Is it in the app's web-inf/lib directory?
0
 

Author Comment

by:dkim18
ID: 17024774
No, it is under WEB-INF/classes/ dir. There is no pkg. All java and class files are under this dir.
0
 
LVL 92

Assisted Solution

by:objects
objects earned 100 total points
ID: 17025044
Looks like the StudentInfo class does not have a setUserId() method.
Perhaps try recompiling and redeploy.
0
 

Author Comment

by:dkim18
ID: 17025168
it DOES have that method. I tried again, but didn't work. This is very weird...
0
 
LVL 92

Expert Comment

by:objects
ID: 17025843
the class it is loading does *not*, did you try recompiling and deploy.
0
 
LVL 15

Expert Comment

by:bpmurray
ID: 17026293
What about the case of the method name and its visibility. Maybe it's called "SetUserId"? Is it public?
0
 

Author Comment

by:dkim18
ID: 17026470
I used elipse's func that generates setter and getter automatically.
+++++++++++++++++
public class StudentInfo  {
   
    private String userId;
    private String passWord1;
...
...
...
 /**
     * @param userId The userId to set.
     */
    public void setUserId(String userId) {
        this.userId = userId;
    }
+++++++++++++++++++
and I am calling like this.

++++++++++++
public class RegistrationServlet extends HttpServlet {
    private Connection conn;
   ...
    private HttpSession session = null;
   
  ...
    private  StudentInfo studentInfo=null;
   
    public void init() throws ServletException{
          studentInfo=new StudentInfo();
       
                       
    }
0
 

Author Comment

by:dkim18
ID: 17026483
I compiled this from eclipse and moved to weblogic. But I deleted existing app dir and copied&pasted again. I even checked the changes in the java file from weblogic.
0
 
LVL 15

Expert Comment

by:bpmurray
ID: 17026538
You don't show how you're calling setUserId - are you passing a String as the parameter?
0
 

Author Comment

by:dkim18
ID: 17026566
protected void doGet(HttpServletRequest request,
            HttpServletResponse response)
            throws ServletException, java.io.IOException {
...
...
userId = (String)request.getParameter("userId");
studentInfo.setUserId(userId);    
...
0
 
LVL 15

Expert Comment

by:bpmurray
ID: 17026696
Is it possible you have an older version of the class on your CLASSPATH?
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 17029088
>>"But I deleted existing app dir and copied&pasted again"
Have you restarted your WLS?

David
0
 

Author Comment

by:dkim18
ID: 17029135
Have you restarted your WLS?
>>of course...
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 17029172
>>"But I deleted existing app dir and copied&pasted again"
Btw, where do you copy and paste in your folder? Did you copy and paste it in your Bea's WLS folder?

David
0
 

Author Comment

by:dkim18
ID: 17029178
Btw, where do you copy and paste in your folder? Did you copy and paste it in your Bea's WLS folder?
>>C:\bea81\weblogic81\server\bin
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 16

Expert Comment

by:suprapto45
ID: 17029213
Ok,

I am not very sure on WebLogic's structure but let me try to find out. So do all your JSP and etc reside in this folder?

David
0
 

Author Comment

by:dkim18
ID: 17029217
yes. when i tested it, it ran ok.(btw, i used wls admin console to deploy it.) but i am having error on that line.
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 17029229
do you deploy it as EAR file? If you open the EAR file (use WinRAR or etc), is the class file updated? You can check on the date created

David
0
 

Author Comment

by:dkim18
ID: 17029237
do you deploy it as EAR file? If you open the EAR file (use WinRAR or etc), is the class file updated? You can check on the date created
>> no, i didn't use any of them. i just copied entire app in that dir and used wls admin console to deploy it.
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 17029257
Give me a sec...let me have think over it

David
0
 
LVL 35

Assisted Solution

by:girionis
girionis earned 100 total points
ID: 17029388
dkim18,
> Btw, where do you copy and paste in your folder? Did you copy and paste
> it in your Bea's WLS folder?
> >>C:\bea81\weblogic81\server\bin

this is not usual, to deploy applications in the bin folder of weblogic. Are you sure that the application gets loaded from there? Usually you put them under the user_projects. It seems to me that you are deploying a web application from the bin folder but there might be already running another one somewhere else. Can you make a search on the filesystem and see if you can find any other files with similar name?
0
 
LVL 16

Assisted Solution

by:suprapto45
suprapto45 earned 100 total points
ID: 17029451
girionis is correct.

In my local machine, I located my application in totall different folder together with the WLS domain. However, it is not in the bea's folder itself.

David
0
 
LVL 92

Expert Comment

by:objects
ID: 17029492
if the class conttains that method then wl isn't loading that class, o/wise u wouldn't be getting that error
0
 
LVL 15

Expert Comment

by:bpmurray
ID: 17029703
Yes, I think it's a different StudentInfo class. Have you tried deploying this app before?
0
 

Author Comment

by:dkim18
ID: 17033421
first of all, there is no other StudentInfo class and this is the first web app that I am trying to deploy since I installed WLS.
0
 
LVL 15

Expert Comment

by:bpmurray
ID: 17033543
Well, the problem for all of us here is that the error message means that it has found the class StudentInfo, but that class does not have a setUserId(x) method. This has us all mightily confused, especially since you assert that there is only one StudentInfo class, and that class has got this method with this signature.
0
 
LVL 92

Expert Comment

by:objects
ID: 17033830
delete the class file you deployed and try to run it.
0
 
LVL 35

Expert Comment

by:girionis
ID: 17035288
It is possible that you have a forgotter EAR somewhere. When you deploy an application wls creates an ear file. I suggest you create a (completely) new domain and try to redeploy your application there.
0
 
LVL 15

Assisted Solution

by:bpmurray
bpmurray earned 200 total points
ID: 17036814
If you delete that class from your app, as objects suggested, and you still get that error, it means that the class is being picked up from somewhere else. Otherwise you'll get a class not found exception instead.
0
 

Author Comment

by:dkim18
ID: 17073693
I finally found the problem. I set StudentInfo in the classpath for some other purpose. When I deleted that it fixed the problem. thanks all
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
The viewer will learn how to implement Singleton Design Pattern in Java.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now