Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Am I missing something?

Options
  • 07-04-2002 11:49pm
    #1
    Registered Users Posts: 6,660 ✭✭✭


    Nothing ever seems to work with Java! I mean this thing :
    java.lang.UnsupportedOperationException
    at sun.jdbc.odbc.JdbcOdbcStatement.addBatch(JdbcOdbcStatement.java:898)

    is probably due to the DBMS and SQL version ****e, but this really gets on my goat :
    shortlist.java:145: Method getAttribute(java.lang.String) not found in interface
    javax.servlet.http.HttpSession.
    type = session.getAttribute(name).toString();

    In my Java book, on the Java website and in the examples that came with the Tomcat server, HTTPSession has methods :

    getAttribute()
    setAttribute()
    removeAttribute()
    getAttributeNames()
    etc.

    but they just don't seem to be in the HTTPSession class. I've been having this problem constantly with Java - methods just not available in the classes the tutorials/libraries list them. Am I missing something here?


Comments

  • Closed Accounts Posts: 1,651 ✭✭✭Enygma


    java.lang.UnsupportedOperationException
    at sun.jdbc.odbc.JdbcOdbcStatement.addBatch(JdbcOdbcStatement.java:898)

    Yeah prolly something to do with software versions, get the latest driver for your DBMS. Does your DBMS support batch operations?

    The session problem might be due to the fact that you're using an older version of the Servlet API. What version of Tomcat are you running?
    Try session.getParameter(String s);

    Although, you must have used session.setAttribute() at some stage right? If that worked then I don't know what the problem is.


  • Registered Users Posts: 1,994 ✭✭✭lynchie


    getAttribute(java.lang.String) was only introduced in the Servlet API version 2.2 and above. If you are using Tomcat 3 you are probably using the older version of the Servlet API. Your book must be quite new so it is using the new Spec. Download Tomcat 4.01


  • Registered Users Posts: 6,660 ✭✭✭Blitzkrieger


    Thanks for the advice but no joy :(

    HTTPSession.java does seem to have all the right methods in it but I still get that error.

    shortlist.java:81: Method getAttributeNames() not found in interface javax.servl
    et.http.HttpSession.
    Enumeration names = session.getAttributeNames();
    ^
    shortlist.java:85: Method getAttribute(java.lang.String) not found in interface
    javax.servlet.http.HttpSession.
    name = session.getAttribute(type).toString();
    ^
    shortlist.java:103: Method setAttribute(java.lang.String, java.lang.String) not
    found in interface javax.servlet.http.HttpSession.
    session.setAttribute(specific, model);
    ^
    shortlist.java:117: Method getAttributeNames() not found in interface javax.serv
    let.http.HttpSession.
    Enumeration names = session.getAttributeNames();
    ^
    shortlist.java:121: Method getAttribute(java.lang.String) not found in interface
    javax.servlet.http.HttpSession.
    name = session.getAttribute(type).toString();
    ^
    shortlist.java:129: Method removeAttribute(java.lang.String) not found in interf
    ace javax.servlet.http.HttpSession.
    session.removeAttribute(type);
    ^
    shortlist.java:141: Method getAttributeNames() not found in interface javax.serv
    let.http.HttpSession.
    Enumeration names = session.getAttributeNames();
    ^
    shortlist.java:145: Method getAttribute(java.lang.String) not found in interface
    javax.servlet.http.HttpSession.
    name = session.getAttribute(type).toString();
    ^
    8 errors

    All those methods are listed but don't show up :(


  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    Are you sure you have the right path and classpath - that youre not importing an older version? Do you have multiple versions of these libraries (and Java itself) installed?

    jc


  • Registered Users Posts: 6,660 ✭✭✭Blitzkrieger


    I do have multiple installations but I replaced them all with the new version. Everything else is in a backup dir and shouldn't be accessed.


  • Advertisement
Advertisement