Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 333
  • Last Modified:

Web app in eclipse VS weblogic server - NoSuchMethodError issue

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
dkim18
Asked:
dkim18
  • 11
  • 7
  • 6
  • +2
5 Solutions
 
bpmurrayCommented:
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
 
dkim18Author Commented:
No, it is under WEB-INF/classes/ dir. There is no pkg. All java and class files are under this dir.
0
 
objectsCommented:
Looks like the StudentInfo class does not have a setUserId() method.
Perhaps try recompiling and redeploy.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
dkim18Author Commented:
it DOES have that method. I tried again, but didn't work. This is very weird...
0
 
objectsCommented:
the class it is loading does *not*, did you try recompiling and deploy.
0
 
bpmurrayCommented:
What about the case of the method name and its visibility. Maybe it's called "SetUserId"? Is it public?
0
 
dkim18Author Commented:
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
 
dkim18Author Commented:
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
 
bpmurrayCommented:
You don't show how you're calling setUserId - are you passing a String as the parameter?
0
 
dkim18Author Commented:
protected void doGet(HttpServletRequest request,
            HttpServletResponse response)
            throws ServletException, java.io.IOException {
...
...
userId = (String)request.getParameter("userId");
studentInfo.setUserId(userId);    
...
0
 
bpmurrayCommented:
Is it possible you have an older version of the class on your CLASSPATH?
0
 
suprapto45Commented:
>>"But I deleted existing app dir and copied&pasted again"
Have you restarted your WLS?

David
0
 
dkim18Author Commented:
Have you restarted your WLS?
>>of course...
0
 
suprapto45Commented:
>>"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
 
dkim18Author Commented:
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
 
suprapto45Commented:
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
 
dkim18Author Commented:
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
 
suprapto45Commented:
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
 
dkim18Author Commented:
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
 
suprapto45Commented:
Give me a sec...let me have think over it

David
0
 
girionisCommented:
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
 
suprapto45Commented:
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
 
objectsCommented:
if the class conttains that method then wl isn't loading that class, o/wise u wouldn't be getting that error
0
 
bpmurrayCommented:
Yes, I think it's a different StudentInfo class. Have you tried deploying this app before?
0
 
dkim18Author Commented:
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
 
bpmurrayCommented:
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
 
objectsCommented:
delete the class file you deployed and try to run it.
0
 
girionisCommented:
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
 
bpmurrayCommented:
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
 
dkim18Author Commented:
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 11
  • 7
  • 6
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now