Comple errors using JOptionPane

I'm trying to write a Java program using JOptionPane dialog/display boxes that reads an integer and checks whether it is even using true/false statements. I also want the program must check if the number the user entered is between 1 and 1000.
I haven't found alot of help in the book I have and i've found some help in another forum but it doesn't seem to compile well, I get the following errors:
IntegerRead.java:39: cannot find symbol
symbol : method valueOf(java.lang.String)
location: class Integer
int number = Integer.valueOf(s);
^
Integer.java:13: cannot find symbol
symbol : class Scanner
location: class Integer
Scanner input = new Scanner( System.in );
^
Integer.java:13: cannot find symbol
symbol : class Scanner
location: class Integer
Scanner input = new Scanner( System.in );
Here is the code:
// Assignment 2.1: IntegerRead.java
// This program reads an integer, checks if it's even and is between 1 and 1000.
import javax.swing.JOptionPane; // program uses class JOptionPane
public class IntegerRead
public static boolean isNumber(String args)
if(args.length() > 3)
throw new IllegalArgumentException("Invalid argument");
else
boolean isNumber = false;
for(int i = 0; i < args.length(); i++)
char c = args.charAt(i);
if(Character.isDigit(c))
isNumber = true;
else
isNumber = false;
return isNumber;
public static boolean isEven(int aNumber)
int a = aNumber & 1;
return (a == 0);
public static void main(String args[])
String s = JOptionPane.showInputDialog("Please enter number between 0 to 999");
System.out.println("Is Number " + isNumber(s));
if(isNumber(s))
int number = Integer.valueOf(s);
System.out.println("Number " + number + "is Even " + isEven(number));
for(int i = 0; i < 999; i++)
System.out.println(i + " is " + isEven(i));
I know i'm missing very simple. I'm new and have tried to build upon what I have so far, but I can't figure it out.
Thanks....
Edited by: Scott.Dishman on Jul 9, 2008 4:07 PM

You have a class named Integer somewhere on your class path. Get rid of it or rename it. If you've already renamed your Integer.java file, you still need to delete the Integer.class file. You should never create your own class that has the same name as a class in the standard java.lang package.

Similar Messages

  • Complie Error for menus (Swing)

    I'm receiving the following complie error. Also, listed is the area for code that is getting the error.
    Thank you for any help that you can provide.
    Error Message:
    P5AWT should be declared abstract; it does not define menuSelected(javax.swing.event.MenuEvent) in P5AWT
    public class P5AWT extends JFrame
    Program:
    public class P5AWT extends JFrame
         implements ActionListener, MenuListener
    private JTextField inputfile;
    private JTextField outputfile;
    private JTextArea ta;
    private JMenuItem newMT, openMT, saveAsMT, exitMT;
    String curFile, filename = "";
    int numstaff;
    Employee[] staff;
    public P5AWT()
    super ("P5AWT Starter Program");
    addWindowListener(new WindowAdapter()
    { public void windowClosing(WindowEvent e) { System.exit(0); }} );
    JMenuBar mb = new JMenuBar ();
    setMenuBar(mb);
    JMenu fileMenu = new JMenu ("File");
    mb.add(fileMenu);
    fileMenu.add (newMT = new JMenuItem ("New", new MenuShortcut(KeyEvent.VK_N)));
    newMT.addMenuListener( new NewCommand());
    fileMenu.add (openMT = new JMenuItem ("Open", new MenuShortcut(KeyEvent.VK_O)));
    openMT.addMenuListener( new LoadFileCommand());
    fileMenu.add (saveAsMT = new JMenuItem ("Save As"));
    saveAsMT.addMenuListener( new SaveAsFileCommand());
    fileMenu.add (exitMT = new JMenuItem ("Exit"));
    exitMT.addMenuListener( new CloseCommand());
    JPanel p3 = new JPanel();
    p3.setLayout(new FlowLayout(FlowLayout.CENTER));
    ta = new JTextArea(20, 60);
    p3.add(ta);
    setLayout(new FlowLayout(FlowLayout.CENTER)); // this overides everything, why?
    add(p3);
    }

    menuSelected is a Abstract method. That means if you implement the MenuListener Class you SHOULD define the menuSelected() event.
    I am not correct with the Method names but logically it seems that tis is the problem.
    Another thing, use setJMenuBar() instead setMenuBar()
    Regards ,
    Karan

  • A complie error of my jsp

    I met a complie error of my jsp, could you tell me what is the problem?
    Here is a part of my jsp, I omit the html part.
    <%
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    java.sql.Connection conn1;
    conn1=DriverManager.getConnection("jdbc:mysql://130.225.76.177/exwh?user=kun&password=some_pass");
    Statement stmt1 = conn.createStatement ();
    ResultSet rs1 = stmt1.executeQuery("select site_name from site, location, location_coountry, country where country.country="Algerina" and country.countryid = location.countryid and location_country.locationid = location.locationid and location.siteid =site.siteid");
    if (rs1 !=null)
    while(rs1.next())
    String sn1=rs1.getString("site_name");
    %>
    <li><a href="DisplaySite?site_name=<%=sn2.replace( ','+') %">'><%= sn2%></a><li><br>
    <%
    stmt1.close();
    conn1.close();
    %>
    The error comments is following:
    Internal Servlet Error:
    org.apache.jasper.JasperException: Unable to compile Note: sun.tools.javac.Main has been deprecated.
    /usr/local/tomcat/work/DEFAULT/projsp/jsp/allsites_3.java:68: ')' expected.
    ResultSet rs1 = stmt1.executeQuery("select site_name from site, location, location_coountry, country where country.country="Algerina" and country.countryid = location.countryid and location_country.locationid = location.locationid and location.siteid =site.siteid");
    ^
    1 error, 1 warning
    at org.apache.tomcat.facade.JasperLiaison.javac(JspInterceptor.java:898)
    at org.apache.tomcat.facade.JasperLiaison.processJspFile(JspInterceptor.java:733)
    at org.apache.tomcat.facade.JspInterceptor.requestMap(JspInterceptor.java:506)
    at org.apache.tomcat.core.ContextManager.processRequest(ContextManager.java:968)
    at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:875)
    at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
    at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
    at java.lang.Thread.run(Thread.java:536)
    What is the meaning of the error comment? I have checked my code, I have not found where need the ")".
    Hopefully,, someone can give me a hint!

    Check this :-
    java.sql.Connection conn1;
    conn1=DriverManager.getConnection("jdbc:mysql://130.225.76.177/exwh?user=kun&password=some_pass");
    Statement stmt1 = conn.createStatement ();
    You have declared conn1 and using conn.
    Check this too:-
    ResultSet rs1 = stmt1.executeQuery("select site_name from site, location, location_coountry, country where country.country="Algerina" and country.countryid = location.countryid and location_country.locationid = location.locationid and location.siteid =site.siteid");
    It expects a ")" after [country="] as the string ends there. Try using country.country='Algerina' instead of country.country="Algerina"

  • Compling error

    HI, anyone konw why there is compling error? I have got a list of record from db and the following script is used to update one record when i click submit button on that record
    Thx a lot
    Chikkit
    error
    Update.java:23: incompatible types
    found : java.lang.String
    required: java.lang.String[]
    String name[] = req.getParameter("name");
    ^
    Update.java:24: incompatible types
    found : java.lang.String
    required: java.lang.String[]
    String email[] = req.getParameter("email");
    ^
    Update.java:25: incompatible types
    found : java.lang.String
    required: java.lang.String[]
    String message[] = req.getParameter("message");
    ^
    3 errors
    script
    package chikkit;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.sql.*;
    public class Update extends HttpServlet {
    private Connection conn = null;
    private Statement stat = null;
    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
    PrintWriter out = res.getWriter();
    res.setContentType("text/html");
    //String name, email, message;
    //name = req.getParameter("name");
    //email = req.getParameter("email");
    //message = req.getParameter("message");
    String name[] = req.getParameter("name");
    String email[] = req.getParameter("email");
    String message[] = req.getParameter("message");
    //top html-tags here:
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Thanks</title>");
    out.println("</head>");
    try {
    String dbURL = "jdbc:HypersonicSQL:/members/aFomaSX4K3nMurOq8wdg4oKLfyWvjK6m/myDB/myDB";
    Class.forName("org.hsql.jdbcDriver");
    conn = DriverManager.getConnection(dbURL, "sa", "");
    stat = conn.createStatement();
    } catch (Exception e) {
    out.println("<br>ERROR: Could not connect to database<br>");
    out.print(e);
    for(int i=0;i<name.length;i++)
    String sql = "update guest set email =" + email[i] +
    "where name =" + name;
    try {
    int numRows = stat.executeUpdate(sql);
    stat.close();
    } catch (SQLException s) {
    out.println("<br>ERROR: Could not update database<br>");
    out.print(s);
    //try {
    //int numRows = stat.executeUpdate(sql);
    //stat.close();
    //} catch (SQLException s) {
    //out.println("<br>ERROR: Could not update database<br>");
    //out.print(s);
    out.println("<body bgcolor=\"#FFFFFF\" text=\"#000000\">");
    out.println("<p> </p>");
    out.println("<h3>Thanks for your entry to my guestbook, " + name + "<br>");
    out.println("</h3>");
    out.println("Go to back to: <a href=\"http://www.mycgiserver.com/~chikkit/GuestBook.jsp\">Viewing the guestbook</a> | ");
    out.println("<a href=\"http://www.mycgiserver.com/~chikkit/input.html\">Writing the guestbook</a> | ");
    out.println("<a href=\"http://www.mycgiserver.com/~chikkit/tutorial.html\">Tutorial</a>");
    out.println("</body>");
    out.println("</html>");
    try {
    conn.close();
    } catch (SQLException s) {
    out.println("<br>ERROR: Unable to close database connection<br>");

    The getParameter method returns a String, so the correct way to use it is:
    String name = req.getParameter("name");
    String email = req.getParameter("email");
    ... and so on.
    i hope it works!!!

  • Using JOptionPane to exit program & Using toString method

    Hello,
    In my program I have to use a toString method below
    public String toString(Hw1NCBEmployee[] e)
            String returnMe = String.format(getStoreName() + "\n" + getStoreAddress() + "\n" + getCityState() +  "\nYou have " + getEmpCount() + "employee(s)");
            return returnMe;
    }Now, at first, when I initially tested my code, it was working just fine, printing out the right way
    Point is -- now that Im practically finished with my program, and am going back and running it - calling the toString method gives me the address rather than the information . . . Can anyone help me with this issue??
    Also, Im using JOptionPane to display everything, but -- at first, it worked fine, then (around the same time I started having the above problem) it stopped exiting the do-while loop:
    while(go)
                 int option = JOptionPane.showConfirmDialog(null, "Do you want to enter employee information?", "Welcome!", JOptionPane.YES_NO_OPTION);
                     if(option == JOptionPane.NO_OPTION)
                        go = false;  //exit loop
            

    ncjb wrote:
    well, for the toString - I have to print out the info inside the array -- am I right in thinking that the only way to do this is to pass in the array ??If the array is part of the class then there is no need to pass it as a parameter. If it is being passed in from outside the class then I have to question your design. Why should class X being formatting data that is not a representation of itself?
    and i have 2 other files that go with this program . . . I just want to know if there is a way to make sure that when the user presses the NO option, it will exit the loop -- the piece of code you see if apart of an entire method (not long) -- do you want me to include this??You read that link I provided REAL quick!

  • Error message: AgServerMigration ERROR Using store provider as a session is deprecated.

    Hi.  I'm using a MacBook Pro, OS X 10.6.5.  I have been opening files in Lightroom, editing them, and then doing finishing touches in CS5.  When I save the file in CS5 and close it, my Mac returns the above message in Console eight times:
    AgServerMigration ERROR Using store provider as a session is deprecated.
    AgServerMigration ERROR Using store provider as a session is deprecated.
    AgServerMigration ERROR Using store provider as a session is deprecated.
    AgServerMigration ERROR Using store provider as a session is deprecated.
    AgServerMigration ERROR Using store provider as a session is deprecated.
    AgServerMigration ERROR Using store provider as a session is deprecated.
    AgServerMigration ERROR Using store provider as a session is deprecated.
    AgServerMigration ERROR Using store provider as a session is deprecated.
    I have no idea what this means, or whether it is a problem.  Does anyone know what this is?
    Thanks.

    I see the same thing and have done for some time. The actual file is being saved back. etc. So, in that respect both Lr and Ps are working fine. IOW, ignore it.

  • Received HTTP response code 500 : Internal Server Error using connection Fi

    Hi everybody,
    I have configured a file-webservice-file without BPM scenario...as explained by Bhavesh in the following thread:
    File - RFC - File without a BPM - Possible from SP 19.
    I have used a soap adapter (for webservice) instead of rfc .My input file sends the date as request message and gets the sales order details from the webservice and then creates a file at my sender side.
    I monitored the channels in the Runtime work bench and the error is in the sender ftp channel.The other 2 channel status is "not used" in RWB.
    1 sender ftp channel
    1 receiver soap channel
    1 receiver ftp channel.
    2009-12-16 15:02:00 Information Send binary file "b.xml" from ftp server "10.58.201.122:/", size 194 bytes with QoS EO
    2009-12-16 15:02:00 Information MP: entering1
    2009-12-16 15:02:00 Information MP: processing local module localejbs/AF_Modules/RequestResponseBean
    2009-12-16 15:02:00 Information RRB: entering RequestResponseBean
    2009-12-16 15:02:00 Information RRB: suspending the transaction
    2009-12-16 15:02:00 Information RRB: passing through ...
    2009-12-16 15:02:00 Information RRB: leaving RequestResponseBean
    2009-12-16 15:02:00 Information MP: processing local module localejbs/CallSapAdapter
    2009-12-16 15:02:00 Information The application tries to send an XI message synchronously using connection File_http://sap.com/xi/XI/System.
    2009-12-16 15:02:00 Information Trying to put the message into the call queue.
    2009-12-16 15:02:00 Information Message successfully put into the queue.
    2009-12-16 15:02:00 Information The message was successfully retrieved from the call queue.
    2009-12-16 15:02:00 Information The message status was set to DLNG.
    2009-12-16 15:02:02 Error The message was successfully transmitted to endpoint com.sap.engine.interfaces.messaging.api.exception.MessagingException: Received HTTP response code 500 : Internal Server Error using connection File_http://sap.com/xi/XI/System.
    2009-12-16 15:02:02 Error The message status was set to FAIL.
    Please help.
    thanks a lot
    Ramya

    Hi Suraj,
    You are right.The webservice is not invoked.I see the same error in the sender channel and the receiver soap channel status is "never used".
    2009-12-16 15:52:25 Information Send binary file  "b.xml" from ftp server "10.58.201.122:/", size 194 bytes with QoS BE
    2009-12-16 15:52:25 Information MP: entering1
    2009-12-16 15:52:25 Information MP: processing local module localejbs/CallSapAdapter
    2009-12-16 15:52:25 Information The application tries to send an XI message synchronously using connection File_http://sap.com/xi/XI/System.
    2009-12-16 15:52:25 Information Trying to put the message into the call queue.
    2009-12-16 15:52:25 Information Message successfully put into the queue.
    2009-12-16 15:52:25 Information The message was successfully retrieved from the call queue.
    2009-12-16 15:52:25 Information The message status was set to DLNG.
    2009-12-16 15:52:27 Error The message was successfully transmitted to endpoint com.sap.engine.interfaces.messaging.api.exception.MessagingException: Received HTTP response code 500 : Internal Server Error using connection File_http://sap.com/xi/XI/System.
    2009-12-16 15:52:27 Error The message status was set to FAIL.
    what can I do about this?
    thanks,
    Ramya

  • Getting "Method 'sign_in' does not exist" Error (using Charles)

    This may be a bit off the FLEX field, and have to do with Zend Framework's ZEND_AMF class. Unfortunately I haven't been able to dig anything up, and comments posted on Wade Arnolds site have not received any responses, so I thought I'd give it a go here.
    My ServiceController Class:
    public function loginAction()
         $this->_helper->viewRenderer->setNoRender();
         $server = new Zend_Amf_Server();
         $server->setClass('LoginAmfService', 'LoginService');
         $server->setClassMap('CurrentUserVO', 'CurrentUserVO');
         $server->setProduction(false);
         print($server->handle());
    My LoginAmfService class:
    class LoginAmfService
          * Main login function.
          * @param  string        $name
          * @param  string        $password
          * @return CurrentUserVO
         public function sign_in($name, $password)
              $authAdapter     = new Zend_Auth_Adapter_DbTable(Zend_Registry::get('db'), 'users', 'user_name', 'password', 'PASSWORD(?) AND active = 1');
              $returnValue     = new CurrentUserVO();
              $authAdapter->setIdentity(htmlspecialchars($name))
                   ->setCredential(htmlspecialchars($password));
              $authResult = $authAdapter->authenticate();
              if ($authResult->isValid())
                   $userArray                          = $authAdapter->getResultRowObject(array('id', 'first_name', 'last_name', 'title', 'photo'));
                   $returnValue->first_name     = $userArray->first_name;
                   $returnValue->last_name          = $userArray->last_name;
                   $returnValue->title               = $userArray->title;
                   $returnValue->photo               = $userArray->photo;
                   $returnValue->token               = $userArray->id;
              return $returnValue;
          * Function used to log people off.
         public function sign_out()
              $authAdapter = Zend_Auth::getInstance();
              $authAdapter->clearIdentity();
    My SignIn FLEX module (the relevant portions):
         <mx:RemoteObject
              id="LoginRemote"
              destination="login"
              source="SignIn"
              showBusyCursor="true"
              fault="parentDocument.handleFault(event)"
         >
               <mx:method name="sign_in" result="signin_handle(event)" />
               <mx:method name="sign_out" result="signout_handle(event)" />
         </mx:RemoteObject>
         <mx:Script>
              <![CDATA[
                   import mx.rpc.events.FaultEvent;
                   import mx.utils.ArrayUtil;
                   import mx.rpc.events.ResultEvent;
                   import mx.controls.Alert;
                   import com.brassworks.ValueObjects.CurrentUserVO;
                   import mx.events.VideoEvent;
                   [Bindable]
                   private var this_user:CurrentUserVO = new CurrentUserVO();
                   private function mdl_init():void
                        focusManager.setFocus(txt_username);
                   private function signin_handle(event:ResultEvent):void
                             this_user = event.result as CurrentUserVO;
                             if (this_user.token == null) {Alert.show("Supplied login credentials are not valid. Please try again.");}
                             else
                                  this.parentApplication.setUser(this.this_user);
                   private function signout_handle(event:ResultEvent):void
                   private function sign_in(event:Event):void
                        try
                             //Alert.show(txt_name.text + "|" + txt_password.text);
                             LoginRemote.sign_in(txt_username.text, txt_password.text);
                        catch (error:Error)
                             this.parentDocument.handleFault(error);
                   private function sign_out(event:Event):void
                   private function show_error(error:Error, s_function:String):void
                        Alert.show("Method:" + s_function + "\nName: " + error.name + "\nID: " + error.errorID + "\nMessage: " + error.message + "\nStack Trace: " + error.getStackTrace() + "\nError: " + error.toString());
                   private function handleFault(event:FaultEvent):void
                        Alert.show(event.fault.faultDetail, event.fault.faultString);
              ]]>
         </mx:Script>
    Now, all this is great and good, as it works with Zend Framework 1.7.6. However, when I try to upgrade to 1.7.8 (to take advantage of session management and other bug-fixes), I get the following error (using Charles):
    #1 /var/web/htdocs/core/library/Zend/Amf/Server.php(390): Zend_Amf_Server->_handle(Object(Zend_Amf_Request_Http))
    #2 /var/web/htdocs/core/application/default/controllers/ServicesController.php(73): Zend_Amf_Server->handle()
    #3 /var/web/htdocs/core/library/Zend/Controller/Action.php(503): ServicesController->loginAction()
    #4 /var/web/htdocs/core/library/Zend/Controller/Dispatcher/Standard.php(285): Zend_Controller_Action->dispatch('loginAction')
    #5 /var/web/htdocs/core/library/Zend/Controller/Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
    #6 /var/web/htdocs/core/application/bootstrap.php(39): Zend_Controller_Front->dispatch()
    #7 /var/web/htdocs/core/public/index.php(5): Bootstrap->runApp()
    #8 {main} ?Method "sign_in" does not exist
    I have no idea why this would not work anymore. My assumption is that I am not correctly setting up Zend_Amf (but then again, my counter-argument is that it worked before, so ..... ????)
    Thanks for any help!
    -Mike

    For those that are also fighting this issue:
    The problem appears to be that the RemoteObject needs to specify the class containing the methods as a source parameter. According to this bug report (http://framework.zend.com/issues/browse/ZF-5168) it is supposed to have been addressed, but apparently has re-emerged in Zend_Amf since version 1.7.7.
    Using my example above, I would have to specify the RO as:
    <mx:RemoteObject
              id="LoginRemote"
              destination="login"
              source="LoginAmfService"
              showBusyCursor="true"
              fault="parentDocument.handleFault(event)"
         >
               <mx:method name="sign_in" result="signin_handle(event)" />
               <mx:method name="sign_out" result="signout_handle(event)" />
         </mx:RemoteObjecct>

  • Does anyone know how to delete a template created in error using PAGES?

    I created some templates in error using PAGES and cannot figure out how to remove them/delete them.  Anyone know how to do this?  Fran

    Look in the More like this on the right.

  • I´m trying to open an excel file in numbers not being successful. The error msg is unexpectedly error using plugin SFCompatibility can you help me?

    I´m trying to open an excel file in numbers not being successful. The error msg is unexpectedly error using plugin SFCompatibility can you help me? Already changed the extension of the excel document to xlsx an now gives an unknown import error.

    In Excel have you tried saving directly to xls (not xlsx) and opening the xls in Numbers?
    If you have a complicated workbook in Excel that uses lots of Excel's advanced features, Numbers may not be able to handle the import.  It does pretty well on basic things, though.
    If you're just trying to get data into Numbers, then often copy-paste from Excel is easier than trying to open xls files.
    SG

  • Error using BPEL console

    I just encountered an error using the BPEL console in one of our test environments. I got the error when I clicked 'Manage BPEL Domain' and then clicked the 'Threads' tab. I also get the error when I click the 'Statistics' tab. Other tabs are OK, 'Configuration', 'Logging', 'Adapter Stats'.
    Note that this is happening on one test server, other dev/test servers are OK.
    Oracle BPEL Server version 10.1.3.3.1
    Build: 0
    Build time: Wed Jan 16 02:42:55 PST 2008
    Build type: release
    Source tag: PCBPEL_10.1.3.3.1_GENERIC_RELEASE
    Exception Message:
    [javax.servlet.ServletException]
    The system encounters errors while running as the authenticated identity.
    Exception Trace:
    javax.servlet.ServletException: The system encounters errors while running as the authenticated identity.
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:429)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:623)
         at com.evermind.server.http.ServletRequestDispatcher.unprivileged_include(ServletRequestDispatcher.java:160)
         at com.evermind.server.http.ServletRequestDispatcher.access$000(ServletRequestDispatcher.java:51)
         at com.evermind.server.http.ServletRequestDispatcher$1.oc4jRun(ServletRequestDispatcher.java:97)
         at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:283)
         at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:102)
         at com.evermind.server.http.EvermindPageContext.include(EvermindPageContext.java:453)
         at domain.jspService(_domain.java:210)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter$1.run(JAZNFilter.java:396)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:410)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:623)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:259)
         at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51)
         at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193)
         at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:283)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198)
         at com.collaxa.cube.fe.DomainFilter.doFilter(DomainFilter.java:131)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at oracle.security.jazn.oc4j.JAZNFilter$1.run(JAZNFilter.java:396)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:410)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:302)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:190)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)

    I just encountered an error using the BPEL console in one of our test environments. I got the error when I clicked 'Manage BPEL Domain' and then clicked the 'Threads' tab. I also get the error when I click the 'Statistics' tab. Other tabs are OK, 'Configuration', 'Logging', 'Adapter Stats'.
    Note that this is happening on one test server, other dev/test servers are OK.
    Oracle BPEL Server version 10.1.3.3.1
    Build: 0
    Build time: Wed Jan 16 02:42:55 PST 2008
    Build type: release
    Source tag: PCBPEL_10.1.3.3.1_GENERIC_RELEASE
    Exception Message:
    [javax.servlet.ServletException]
    The system encounters errors while running as the authenticated identity.
    Exception Trace:
    javax.servlet.ServletException: The system encounters errors while running as the authenticated identity.
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:429)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:623)
         at com.evermind.server.http.ServletRequestDispatcher.unprivileged_include(ServletRequestDispatcher.java:160)
         at com.evermind.server.http.ServletRequestDispatcher.access$000(ServletRequestDispatcher.java:51)
         at com.evermind.server.http.ServletRequestDispatcher$1.oc4jRun(ServletRequestDispatcher.java:97)
         at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:283)
         at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:102)
         at com.evermind.server.http.EvermindPageContext.include(EvermindPageContext.java:453)
         at domain.jspService(_domain.java:210)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter$1.run(JAZNFilter.java:396)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:410)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:623)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:259)
         at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51)
         at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193)
         at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:283)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198)
         at com.collaxa.cube.fe.DomainFilter.doFilter(DomainFilter.java:131)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at oracle.security.jazn.oc4j.JAZNFilter$1.run(JAZNFilter.java:396)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:410)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:302)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:190)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)

  • Warnings/Errors using getClass().newInstance()

    I'm getting some warnings & errors using getClass().newInstance() on an object. I can't however see what's wrong.
    First a little background, Bar is a class that manages a set of beans, including creation. One of the actions is to create a special copy of bean, the method that does this does some bookkeeping (such that a particular instance of Bar will only work with objects it created).
    This class was originally written in 1.4 and I'm now trying to genericify it.
    First attempt:
    public class Bar<T extends Foo> {
        public T getFlaggedBean(T fromBean) throws InstantiationException, IllegalAccessException {
            T newBean = fromBean.getClass().newInstance();
            // do some stuff
            return newBean;
    }This yielded: "Type mismatch: cannot convert from capture#1-of ? extends Foo to T"
    I can cast:
            T newBean = (T) fromBean.getClass().newInstance();Which drops me to a warning a can suppress: "Type safety: Unchecked cast from capture#1-of ? extends Foo to T".
    The code runs fine like that, but I'd rather not even have a warning to suppress, I don't like suppress them unless I know that it really is safe.
    The code above looks perfectly reasonable to me, I can't figure out why it could be problematic, which leads me to wonder if I'm missing something. We've got a parameter that is of type T or a subclass of it, calling getClass().newInstance() creates an new object such that origobj.getClass() == newobj.getClass() *. Since that class is T or a subclass of it, it should be assignable to T.
    The code above when, compiled and subjected to type erasure, effectively produces a method that looks like this:
        public Foo getFlaggedBean(Foo fromBean) throws InstantiationException, IllegalAccessException {
            Foo newBean = (Foo) fromBean.getClass().newInstance();
            // do some stuff
            return newBean;
        }Note that the cast to Foo is strictly unnecessary.
    There's a couple ways I could solve this, such as:
        public <S extends T> T getFlaggedBean(Class<S> useClass, S fromBean) throws InstantiationException, IllegalAccessException {
            T newBean = useClass.newInstance();
            // do some stuff
            return newBean;
        }I'd rather not change the API, though. Can anybody give me an idea where the initial code, with warnings could be unsafe?
    Neil
    * Unless you're mucking about with class loaders, but that problem would be an issue with non-generic code too.

    Paul,
    So does that bit of the JLS mean that my compiler is doing something wrong when it finds the getClass() call, in the code below, to return Class<? extends Foo> rather than Class<? extends T>? If the latter were returned it would compile fine.
    public class Bar<T extends Foo> {
        public T getFlaggedBean(T fromBean) throws InstantiationException, IllegalAccessException {
            T newBean = fromBean.getClass().newInstance(); // doesn't compile
            // do some stuff
            return newBean;
    }I was initially distracted by the "capture#1-of" and thought that was culprit, but as the code below demonstrates calling getInstance() on an instance of a class the compiler notes as "Class<capture#1-of ? extends Foo>" assigns to Foo just fine. Interestingly in this code my IDE says that getClass() is returning "Class<? extends Foo>", both javac and the IDE spat out "Class<capture#1-of ? extends Foo>" when the 1st line of the method had a warning or error. I assume that "Class<? extends Foo>" and "Class<capture#n-of ? extends Foo>" are equivalent and that "capture#n-of" is something fairly internal to the compiler. Can anyone shed light on that?
    public class Bar<T extends Foo> {
        public Foo getFlaggedBean(T fromBean) throws InstantiationException, IllegalAccessException {
            Foo newBean = fromBean.getClass().newInstance(); // this works
            // do some stuff
            return newBean;
    }

  • XML Form Builder Error using JRE Version 1.6.0_05

    Hi Experts,
    I am trying to create an XML Form using XML Form Builder. But I noticed that the root nodes under the data model area of the said tool is not clickable(even if it has + sign on it)thus hindering me to continue. I encounter this error using jre version 1.6.0_05.
    Can someone help with this?
    Thanks a lot
    Edited by: Leah Mendoza on Oct 9, 2008 2:07 AM
    Edited by: Leah Mendoza on Oct 9, 2008 2:07 AM

    Hi Leah,
    Have you tried double clicking?
    If this doesn't solve the issue, you might want to try using a different version of the browser and disable the pop up blocker on your browser.
    Please try this out and let me know.
    Regards
    Mazin

  • Errors using add_user_to_list

    All,
    i seem to have come across an error using the portal30.wwsec_api.add_user_to_list function. I believe the error could be with my code....the error i get :-
    Step : 11 - ORA-01086: savepoint 'ADDUSERTOLIST_SAVEPOINT' never established
    ORA-06512: at "PORTAL30.WWSEC_API", line 1915
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "PORTAL30.WWCTX_SSO", line 849
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "PORTAL30.WWCTX_SSO", line 669
    ORA-06502: PL/SQL: numeric or value error
    The piece of code i have running through a CURSOR FOR LOOP is as follows..
    FOR assign_users_to_group IN cur_assign_group LOOP
    -- Maintain the portal account
    portal30.wwsec_api.add_user_to_list
    ( p_person_id => assign_users_to_group.person_id,
    p_to_group_id => assign_users_to_group.group_id,
    p_is_owner => 0
    END LOOP;
    The CURSOR FOR LOOP selects out the correct person_id and group_id for which the new user is to be assigned. I then attempt to add the user to the (already created) group. Has anybody had this type of error before??
    Thanks for any help,
    Matt.
    null

    Just to keep you all up to date with the situation. i have now progressed onto DELETE_USER_FROM_LIST, and quite unsuccessfully too.....
    This time i have this piece of code....
    -- Maintain the portal account
    portal30.wwsec_api.delete_user_from_list
    ( p_group_id => revoke_users_from_groups.group_id,
    p_member_person_id => revoke_users_from_groups.person_id
    I run this piece of code as PORTAL30, just like the ADD_USER_TO_LIST function. Except this time I get another error
    declare
    ERROR at line 1:
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "PORTAL30.WWSEC_API", line 2465
    ORA-06512: at line 5
    Needle in a haystack, or does somebody out there have an idea??
    Thanks, Matt.
    null

  • Using JOptionPane in a non-event dispatching thread

    I am currently working on a screen that will need to called and displayed from a non-event dispatching thread. This dialog will also capture a user's selection and then use that information for later processing. Therefore, the dialog will need to halt the current thread until the user responds.
    To start, I tried using the JOptionPane.showInputDialog() method and set the options to a couple of objects. JOptionPane worked as advertised. It placed the objects into a combobox and allowed the user to select one of them. However, it also gave me something unexpected. It actually paused the non-event handling thread until the user had made a selection. This was done without the JOptionPane code being wrapped in a SwingUtilities.invokeLater() or some other device that would force it to be launched from an Event Handling Thread.
    Encouraged, I proceeded to use JOptionPane.showInputDialog() substituting the "message" Object with a fairly complex panel (JRadioButtons, JLists, JTextFields, etc.) that would display all of the variety of choices for the user. Now, when the screen pops up, it doesn't paint correctly (like what commonly occurs when try to perform a GUI update from a non-event dispatching thread) and the original thread continues without waiting for a user selection (which could be made if the screen painted correctly).
    So, here come the questions:
    1) Is what I am trying to do possible? Is it possible to create a fairly complex GUI panel and use it in one of the static JOptionPane.showXXXDialog() methods?
    2) If I can't use JOptionPane for this, should I be able to use JDialog to perform the same type function?
    3) If I can use JDialog or JFrame and get the threading done properly, how do I get the original thread to wait for the user to make a selection before proceeding?
    I have been working with Java and Swing for about 7-8 years and have done some fairly complex GUIs, but for some reason, I am stumped here. Any help would be appreciated.
    Thanks.

    This seems wierd that it is functioning this way. Generally, this is what is supposed to happen. If you call a JOptionPane.show... from the Event Dispatch Thread, the JOptionPane will actually begin processing events that normally the Event Dispatch Thread would handle. It does this until the user selects on options.
    If you call it from another thread, it uses the standard wait and notify.
    It could be that you are using showInputDialog for this, try showMessageDialog and see if that works. I believe showInputDialog is generally used for a single JTextField and JLabel.

Maybe you are looking for