Can we throw an error in java ,if yes plz give an example?

Hi,
How can we throw an error in java like an exception(using try catch).If an error can be thrown then what is the diffrence between error and exception because both can be thrown using throwble.
Thanks
Sumit

Error and Exception both are subclasses of Throwable class, so both can be thrown(I don't want to explain by an example). Now Error class defines exceptions that are not expected to be caught under normal circumstances. Exceptions of type Error are used by Java run-time system to indicate errors having to do with the run-time environment, itself.
"Stack Overflow" is an example of Error.
Errors are generally caused in response to catastrophic failures which can't be handeled by your program.

Similar Messages

  • How can I handle runtime errors in Java

    Please some one tell me what are runtime errors and How can I handle them using java code
    This is important
    Thanks in Advance
    Chowdary AK

    The java equivalent of function pointers is the one-instance class, as used to pass handlers to swing components, for example. Often an anonymous class is used.
    Put your function signature in an interface, and pass an object that implements that interface:
    public Class1 {
      public interface CallBack {
        void myMethod(String arg1);
      CallBack callb;
      public Class1(CallBack callb) {
       this.callb = callb;
      callb.myMethod("A string");
    class2 {
       first = new Class1(new Class1.CallBack() {
         public void myMethod(String arg1) {
           ... do something ...

  • Can we catch the error in java??

    can we catch/handle the error????if yes the how........

    this is a great site for interview questions: http://tinyurl.com/1c2

  • Editable ALV - how to throw an error message for a specific line & field

    Hi all,
    I've implemented an editable ALV and also the ON_DATA_CHECK event to check the values, entered in the ALV. So this works fine and I can check the values.
    But now, I want to throw an error message corresponding to the field in the ALV, where the error occured.
    How can I throw this error message corresponding to a specific line/field in the ALV?
    I was using REPORT_ATTRIBUTE_ERROR_MESSAGE and REPORT_ELEMENT_ERROR_MESSAGE but without success.
    I'm also using a loop over the "CHANGES" in the ALV and within this loop, I use
    elem_alv = node_alv->get_element( index = <change>-element_index ) 
    to get the element for the message.
    CALL METHOD lo_message_manager->REPORT_ELEMENT_ERROR_MESSAGE
      EXPORTING
        MESSAGE_TEXT              = 'my message'
        ELEMENT                   = elem_alv
    *    ATTRIBUTES                =
    *    PARAMS                    =
    *    MSG_USER_DATA             =
    *    IS_PERMANENT              = ABAP_FALSE
    *    SCOPE_PERMANENT_MSG       = CO_MSG_SCOPE_CTXT_ELEMENT
    *    MSG_INDEX                 =
    *    CANCEL_NAVIGATION         =
    *    IS_VALIDATION_INDEPENDENT = ABAP_FALSE.
    2.) is it right, that for an editable ALV, I can't use the WDDOBEFOREACTION to do the checks?
    If I try to use this, I can't get the values of my ALV table to check it.
    Thanks,
    Andreas

    Hi Andreas,
    I have tried to replicate your problem and I am getting the desired output. I have a row by name TEMP_NEW in my ALV and I want to throw an error message whenever the user enters a value of 4 for that particular field. Please find my coding as below. The important thing is where we perform the actual comparison between the r_value and 4. r_value is defined in SALV_WD_S_TABLE_MOD_CELL as reference to type DATA. So suppose the user enters a value of say 3 in the TEMP_NEW field of the ALV then r_value would contain 3 but if you observe its type in debugging mode it would be as TYPE REF TO I and not TYPE I. So you cannot directly say something like:
    "if ls_modified_cells-r_value = 3" as this would lead to a syntax error. Define a field-symbol say <temp> and then use it to get the actual value into it by saying like:
    ASSIGN ls_modified_cells-r_value->* TO <temp>.
    Then you can use this <temp> for comparison in your IF statement like:
    IF  <temp> = 3.
    Find the entire coding as below:
    METHOD check_data.
      DATA: lr_node TYPE REF TO if_wd_context_node,
            lr_element TYPE REF TO if_wd_context_element,
            ls_modified_cells TYPE salv_wd_s_table_mod_cell.
      FIELD-SYMBOLS <temp> TYPE data.
    " get message manager
      DATA lo_api_controller     TYPE REF TO if_wd_controller.
      DATA lo_message_manager    TYPE REF TO if_wd_message_manager.
      lo_api_controller ?= wd_this->wd_get_api( ).
      CALL METHOD lo_api_controller->get_message_manager
        RECEIVING
          message_manager = lo_message_manager.
      lr_node = wd_context->get_child_node( name = 'NODE' ).
      LOOP AT r_param->t_modified_cells INTO ls_modified_cells.
        lr_element = lr_node->get_element( index = ls_modified_cells-index ).
        IF ls_modified_cells-attribute = 'TEMP_NEW'.
    " Get the value extracted into the field symbol from the reference variable
          ASSIGN ls_modified_cells-r_value->* TO <temp>.
    " Use the value present in this field-symbol for your comparison
          IF  <temp> = 4.
    " report message
            CALL METHOD lo_message_manager->report_attribute_error_message
              EXPORTING
                message_text   = 'Sample message text'
                element        = lr_element
                attribute_name = ls_modified_cells-attribute.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDMETHOD.
    Hope this helps resolve your problem.
    Regards,
    Uday

  • Error message:- java.rmi.RemoteException: Unexpected fault was returned by

    Hi All,
    When we trying to fetch documents from plum tree portal using a java api, we are getting below error message. please can anyone guide us,
    error message:- java.rmi.RemoteException: Unexpected fault was returned by the server (faultcode: Server.userException, faultstring: org.xml.sax.SAXParseException: Content is not allowed in prolog.)
    thanks in advance
    Srinivas

    Cross-posted:
    error message:- java.rmi.RemoteException: Unexpected fault was returned by

  • I need to throw an error message if the terms&conditions checkbox is not checked on click of Submit Button. Can anyone suggest.

    I need to throw an error message if the terms&conditions checkbox is not checked on click of Submit Button in webdynpro java. Can anyone suggest.

    My Apologies. The simplest way- write the following code in the action of the Submit button-
    if (<check box not checked>)
    wdComponentAPI.getMessageManager().reportException("Please accept Terms and Conditions to continue",false);
    else
         continueExecution();
    The exception message will be shown on top of the view.
    You may like to use Message Area UI element and place it at the bottom of the WD4J view to show our exception message at the bottom of the view.
    I hope this helps !
    Cheers,
    -Amol Gupta

  • File upload in KM throws a system exception: java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key xtlt_Required

    Hi All,
    We are on Netweaver 7.01 SP14. (well I understand we are way behind patch levels, but a simple file upload should be working ?/)
    We are trying to upload (HTML &/ Image) a file in one of the KM's public folder.
    As and when we select folder and click on upload we get the below message:
    Below is the error trace details:
    Full Message Text
    com.sapportals.wdf.WdfException
    at com.sapportals.wcm.control.edit.ResourceUploadControl.render(ResourceUploadControl.java:688)
    at com.sapportals.wdf.layout.HorizontalLayout.renderControls(HorizontalLayout.java:42)
    at com.sapportals.wdf.stack.Pane.render(Pane.java:155)
    at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
    at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
    at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
    at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
    at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
    at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
    at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
    at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
    at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
    at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
    at com.sapportals.wdf.WdfCompositeController.internalRender(WdfCompositeController.java:709)
    at com.sapportals.wdf.WdfCompositeController.buildComposition(WdfCompositeController.java:674)
    at com.sapportals.htmlb.AbstractCompositeComponent.preRender(AbstractCompositeComponent.java:33)
    at com.sapportals.htmlb.Container.preRender(Container.java:120)
    at com.sapportals.htmlb.Container.preRender(Container.java:120)
    at com.sapportals.htmlb.Container.preRender(Container.java:120)
    at com.sapportals.portal.htmlb.PrtContext.render(PrtContext.java:408)
    at com.sapportals.htmlb.page.DynPage.doOutput(DynPage.java:238)
    at com.sapportals.wcm.portal.component.base.KMControllerDynPage.doOutput(KMControllerDynPage.java:134)
    at com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:133)
    at com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134)
    at com.sapportals.wcm.portal.component.base.ControllerComponent.doContent(ControllerComponent.java:88)
    at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
    at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
    at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
    at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
    at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:645)
    at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
    at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
    at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:249)
    at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:557)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:430)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1064)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
    at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
    at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
    at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
    at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
    --- Nested WDF Exception -----------------------
    java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key xtlt_Required
    at java.util.ResourceBundle.getObject(ResourceBundle.java:327)
    at java.util.ResourceBundle.getObject(ResourceBundle.java:324)
    at java.util.ResourceBundle.getString(ResourceBundle.java:287)
    at com.sapportals.wcm.util.resource.ResourceBundles.getString(ResourceBundles.java:55)
    at com.sapportals.wcm.control.base.WcmBaseControl.getBaseBundleString(WcmBaseControl.java:150)
    at com.sapportals.wcm.control.base.WcmBaseControl.getBaseBundleString(WcmBaseControl.java:176)
    at com.sapportals.wcm.control.edit.ResourceUploadControl.renderUploadFileContent(ResourceUploadControl.java:773)
    at com.sapportals.wcm.control.edit.ResourceUploadControl.render(ResourceUploadControl.java:655)
    at com.sapportals.wdf.layout.HorizontalLayout.renderControls(HorizontalLayout.java:42)
    at com.sapportals.wdf.stack.Pane.render(Pane.java:155)
    at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
    at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
    at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
    at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
    at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
    at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
    at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
    at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
    at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
    at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
    at com.sapportals.wdf.WdfCompositeController.internalRender(WdfCompositeController.java:709)
    at com.sapportals.wdf.WdfCompositeController.buildComposition(WdfCompositeController.java:674)
    at com.sapportals.htmlb.AbstractCompositeComponent.preRender(AbstractCompositeComponent.java:33)
    at com.sapportals.htmlb.Container.preRender(Container.java:120)
    at com.sapportals.htmlb.Container.preRender(Container.java:120)
    at com.sapportals.htmlb.Container.preRender(Container.java:120)
    at com.sapportals.portal.htmlb.PrtContext.render(PrtContext.java:408)
    at com.sapportals.htmlb.page.DynPage.doOutput(DynPage.java:238)
    at com.sapportals.wcm.portal.component.base.KMControllerDynPage.doOutput(KMControllerDynPage.java:134)
    at com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:133)
    at com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134)
    at com.sapportals.wcm.portal.component.base.ControllerComponent.doContent(ControllerComponent.java:88)
    at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
    at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
    at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
    at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
    at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:645)
    at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
    at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
    at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:249)
    at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:557)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:430)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1064)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
    at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
    at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
    at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
    at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176) 

    Hi Vijay,
    Thanks for the quick reply.
    I have gone through the notes 1535201  & now on 1606563  after your advise.
    Both the notes says the fix is available on 7.01 after SP 07 and we are on SP 14 already.
    Also just in case I did checked with our basis and they confirmed we are a head and we have the above notes in our release already.
    Unfortunately the notes are not the solution to the investigation till date.
    Thanks,
    Sai

  • How can I throw a hard 404 error to apache when a JSP is not found.

    How can I throw a hard 404 error to apache when a JSP is not found.
    I want to let apache handle the error.

    [email protected] (Jeremy Conner) wrote in
              <[email protected]>:
              >How can I throw a hard 404 error to apache when a JSP is not found.
              >I want to let apache handle the error.
              >
              >
              First thought that comes to mind is to return HTML that tells the browser
              redirect to a nonexistent file under Apache. You can't tell Apache to
              throw a 404 unless you're in a mod. Maybe something they could add to the
              proxy, but until then, I think a redirection in the response HTML is your
              only option.
              Jesse
              

  • Am trying to upgrade iPad 2 to 6.1.2 and it shows error like "Unable to verify Update" you are no longer connected to the internet. But am connect to my wi-fi. Can somebody throw some light on this.

    Am trying to upgrade iPad 2 to 6.1.2 and it shows error like "Unable to verify Update" you are no longer connected to the internet. But am connect to my wi-fi. Can somebody throw some light on this.
    ============================================================
    Throws error saying
    "Unable to Verify Update"
    iOS 6.1.2 failed verification because you are no longer connected to the internet
    ============================================================
    Can anybody please respond

    Try this and see if it resolves the issue.
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.
    Then try again.

  • Firefox crashes and when attempting to launch after the crash it won't and throw and error msg that js.3250 can't be found- but same file is in Mozilla directory. I must then download new 3.6.8 and lose all tabs.

    # Question
    Firefox crashes and when attempting to launch after the crash it won't launch; throwing an error msg that " js.3250 can't be found" - but same file is in Mozilla directory.
    I must then download new 3.6.8 and lose all tabs and history.

    I have a similar problem. Recently my FF8 has been crashing a lot. It regularly locks up an entire core of my PC and often just shuts down. It has just done it a moment ago and when it started back up it did the whole "this is embarrassing" thing and asked me if I wanted to reload my tabs. I deselected the one that I was trying to view as I suspected that it may have been the cause (unlikely; it was node4.co.uk) but anyway, let's skip it just in case. Click on the button to restore and up pops my homepage only. So all of my other tabs, which I was using for work incidentally, are gone.
    This is not the first time this has happened on FF8. It happened a lot recently on FF6 I think it was (so hard to keep track now, Mozilla) and I switched to Chrome as a result, but it turns out that it crashes even more than FF6 did. FF7 was a vast improvement but FF8 is so unstable/unpredictable for me at the moment that I think I'd rather use IE9 than this. It's driving me mental, clearly! I wish I could kill the process manually and have it retry restoring tabs. Hey, there's an idea Mozilla; give us a menu item that allows us to restore the session to how it started to try again or at the very least get a list of the pages we were looking at. They don't show up in Recently Closed Windows and the Restore Previous Session is greyed out too. Gah! Help!

  • OutOfMemory error in java.awt.image.DataBufferInt. init

    We have an applet application that performs Print Preview of the images in the canvas. The images are like a network of entities (it has pictures of the entities involve (let's say Person) and how it links to other entities). We are using IE to launch the applet.
    We set min heap space to 128MB, JVM max heap space to 256MB, java plugin max heap space to 256MB using the Control Panel > Java.
    When the canvas width is about 54860 and height is 1644 and perform Print Preview, it thows an OutOfMemoryError in java.awt.image.DataBufferInt.<int>, hence, the Print Preview page is not shown. The complete stack trace (and logs) is as follows:
    Width: 54860 H: 1644
    Max heap: 254 # using Runtime.getRuntime().maxMemory()
    javaplugin.maxHeapSize: 256M # using System.getProperties("javaplugin.maxHeapSize")
    n page x n page : 1x1
    Exception in thread "AWT-EventQueue-2" java.lang.OutOfMemoryError: Java heap space
         at java.awt.image.DataBufferInt.<init>(Unknown Source)
         at java.awt.image.Raster.createPackedRaster(Unknown Source)
         at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
         at java.awt.image.BufferedImage.<init>(Unknown Source)
         at com.azeus.gdi.chart.GDIChart.preparePreview(GDIChart.java:731)
         at com.azeus.gdi.chart.GDIChart.getPreview(GDIChart.java:893)
         at com.azeus.gdi.ui.GDIUserInterface.printPreviewOp(GDIUserInterface.java:1526)
         at com.azeus.gdi.ui.GDIUserInterface$21.actionPerformed(GDIUserInterface.java:1438)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Drilling down the cause of the problem. The OutOfMemory occurred in the constructor of DataBufferInt when it tried to create an int array:
    public DataBufferInt(int size) {
    super(STABLE, TYPE_INT, size);
    data = new int[size]; # this part produce out of memory error when size = width X height
    bankdata = new int[1][];
    bankdata[0] = data;
    The OutOfMemory error occurred when size is width * height (54860 X 1644) which is 90,189,840 bytes (~86MB).
    I can replicate the OutOfMemory error when initiating an int array using a test class when it uses the default max heap space but if I increase the heap space to 256MB, it cannot be replicated in the test class.
    Using a smaller width and height with product not exceeding 64MB, the applet can perform Print Preview successfully.
    Given this, I think the java applet is not using the value assigned in javaplugin.maxHeapSize to set the max heap space, hence, it still uses the default max heap size and throws OutOfMemory in int array when size exceeds the default max heap space which is 64MB.
    For additional information, below is some of the java properties (when press S in java applet console):
    browser = sun.plugin
    browser.vendor = Sun Microsystems, Inc.
    browser.version = 1.1
    java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
    java.awt.printerjob = sun.awt.windows.WPrinterJob
    java.class.path = C:\PROGRA~1\Java\jre6\classes
    java.class.version = 50.0
    java.class.version.applet = true
    java.runtime.name = Java(TM) SE Runtime Environment
    java.runtime.version = 1.6.0_17-b04
    java.specification.version = 1.6
    java.vendor.applet = true
    java.version = 1.6.0_17
    java.version.applet = true
    javaplugin.maxHeapSpace = 256M
    javaplugin.nodotversion = 160_17
    javaplugin.version = 1.6.0_17
    javaplugin.vm.options = -Xms128M -Djavaplugin.maxHeapSpace=256M -Xmx256m -Xms128M
    javawebstart.version = javaws-1.6.0_17
    Kindly advise if this is a bug in JRE or wrong setting. If wrong setting, please advise on the proper way to set the heap space to prevent OutOfMemory in initializing int array.
    Thanks a lot.
    Edited by: rei_xanther on Jun 28, 2010 12:01 AM
    Edited by: rei_xanther on Jun 28, 2010 12:37 AM

    rei_xanther wrote:
    ..But the maximum value of the int data type is 2,147,483,647. That is the maximum positive integer value that can be stored in (the 4 bytes of) a signed int, but..
    ..The value that I passed in the int array size is only 90,189,840...its only connection with RAM is that each int requires 4 bytes of memory to hold it.
    new int[size] -- size is 90,189,840Sure. So the number of bytes required to hold those 90,189,840 ints is 360,759,360.
    I assumed that one element in the int array is 1 byte. ..Your assumption is wrong. How could it be possible to store 32 bits (4 bytes) in 8 bits (1 byte)? (a)
    a) Short of some clever compression algorithm applied to the data.

  • How can i execute Spaces API in java main class?

    Hi
    I am able to execute Spaces API through portal application. However if i try to execute it in java main class, its throwing an exception
    "SEVERE: java.io.FileNotFoundException: .\config\jps-config.xml (The system cannot find the path specified)"
    oracle.wsm.common.sdk.WSMException: WSM-00145 : Keystore location or path can not be null or empty; it must be configured through JPS configuration or policy configuration override.
    How can i set this path, so that i can execute Spaces API from java main class.
    Need this main class to configure in cron job, to schedule a task.
    Regards
    Raj

    Hi Daniel
    Currently i have implemented create functionality in my portal application using Spaces API, which is working fine. Now the requirement is, i need to implement a "Cron Job" to schedule a task, which will execute to create space(for example once in a week). Cron job will execute only the main method. So I have created java main class, in which I have used Spaces API to perform create space operation. Then it was giving exception.
    Later I understood the reason, as I am executing the Space API with a simple JSE client, its failing since a simple java program has no idea of default-keystore.jks, jps-config.xml, Security Policy. Hence i have included those details in main class. Now I am getting new error,
    SEVERE: WSM-06303 The method "registerListener" was not called with required permission "oracle.wsm.policyaccess"
    For your reference i have attached the code below, please help. How can i use Spaces API in java main method(i mean public static void main(String[] args) by giving all required information.
        public static void main(String[] args) throws InstantiationException,
                                                      GroupSpaceWSException,
                                                      SpacesException {
            Class2 class2 = new Class2();
            GroupSpaceWSContext context = new GroupSpaceWSContext();
            FactoryFinder.init(null);
            context.setEndPoint("http://10.161.226.30/webcenter/SpacesWebService");
            context.setSamlIssuerName("www.oracle.com");
            context.setRecipientKeyAlias("orakey");
            Properties systemProps = System.getProperties();
            systemProps.put("java.security.policy","oracle/wss11_saml_or_username_token_with_message_protection_client_policy");
            systemProps.put("javax.net.ssl.trustStore","C:\\Oracle\\Middleware11.1.7\\wlserver_10.3\\server\\lib\\cacerts.jks");
    systemProps.put("oracle.security.jps.config","C:\\Oracle\\Middleware11.1.7\\user_projects\\domains\\workspace\\system11.1.1.7.40.64.93\\DefaultDomain\\config\\fmwconfig\\jps-config.xml");
            systemProps.put("javax.net.ssl.keyStore",C:\\Oracle\\Middleware11.1.7\\user_projects\\domains\\workspace\\system11.1.1.7.40.64.93\\DefaultDomain\\config\\fmwconfig\\consumer.jks");
            systemProps.put("javax.net.ssl.keyStorePassword", "Test12");
            System.setProperties(systemProps);
            GroupSpaceWSClient groupSpaceWSClient;
            try {
                groupSpaceWSClient = new GroupSpaceWSClient(context);
                System.out.println("URL: " +
                                   groupSpaceWSClient.getWebCenterSpacesURL());
                //delete the Space
                List<String> groupSpaces = groupSpaceWSClient.getGroupSpaces(null);
                System.out.println("GroupSpaces:: " + groupSpaces.size());
            } catch (Exception e) {
    Regards
    Raj

  • I am getting Error! java.sql.SQLException:General error

    hi every body,
    I struck with this error , can any one suggest in solving this.
    I had a table in oracledatabase ,i have successfully created a table and inserted clob column with an attachment like xxx.txt.
    table format----> id and text columns
    Now my question is to retrieve that data and store it in local disk i am getting this error
    import java.io.*;
    import java.sql.*;
    //import java.sql.SQLException;
    public class Cread {
    public static void main(String[] args) throws ClassNotFoundException,IOException,SQLException {
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection cn=DriverManager.getConnection("jdbc:odbc:sivadsn","scott","tiger");
    Statement s = cn.createStatement();
    ResultSet rs=s.executeQuery("Select text from ram where id=10");
    if(rs.next()){
    FileOutputStream file=new FileOutputStream("c:/store.txt");
    InputStream fin=rs.getBinaryStream(1);
    int c;
    while((c=fin.read())!=-1){
    file.write(c);
    fin.close();
    s.close();
    rs.close();
    catch(IOException e){
    e.printStackTrace();
    System.out.println("Err:"+e);
    I am getting the error as
    java.sql.SQLException: General error
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(Unknown Source)Error! java.sql.SQLException: General error
    at attach.Clobread.main(Clobread.java:30)

    That usually means something is wrong with the syntax of your sql.
    As a guess 'text' is probably a keyword and shouldn't be used as a field name. It is possible that the same is true for 'id'

  • Getting Error in java mapping: Parsing empty source. Root element expected!

    Hi Experts,
       I am using java mapping for schema validation of input message. I have followed all the standard procedures and implemented the java class in the interface mapping.
    My interface mapping is like this:
    OrderData --->Java Class ---SchemaValidate
                         Mesg Map ---OrderData_to_BAP --->BAPI Msg
    So first I want to validate the schema of the input message. If the input message is invalid then XI should throw an exception. Then I use the actual message mapping to map the input order data to the BAPI input parameters.
    In the java code I am using xerces parser.
    The java code works fine when I run it as a standalone application.
    The interface mapping also works fine if I don't include the java mapping. Ofcourse schema validation does not happen.
    But when I test the interface mapping by including the java mapping then I am getting the error:
    Call method execute of the application Java mapping SchemaValidate
    Java mapping SchemaValidate completed. (execute() of SchemaValidate
    com.sap.aii.utilxi.misc.api.BaseRuntimeException: Parsing an empty source. Root element expected!
    What am I doing wrong? Why it is not getting the root element?
    My Java code is as follows:
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    import com.sap.aii.mapping.api.StreamTransformationException;
    import java.io.*;
    import java.util.Map;
    import javax.xml.parsers.*;
    import org.xml.sax.helpers.*;
    import org.xml.sax.*;
    import org.apache.xerces.jaxp.*;
    Sample mapper for SAP-XI
    @author Gopal
    public class SchemaValidate implements StreamTransformation {
        //Constants when using XML Schema for SAX parsing.
         static final String JAXP_SCHEMA_LANGUAGE =
         "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
         static final String W3C_XML_SCHEMA =
         "http://www.w3.org/2001/XMLSchema";
         static final String JAXP_SCHEMA_SOURCE =
         "http://java.sun.com/xml/jaxp/properties/schemaSource";
    Injection of mapping parameters
    from integration engine
    @param map Map with configuration data
        public void setParameter(Map map) {
    Mapping implementation
    @param inputStream Input data from integration engine
    @param outputStream Output data to integration engine
        public void execute(InputStream inputStream,
                            OutputStream outputStream)
          throws StreamTransformationException {
            try {
                  // obtain an object of class javax.xml.parsers.SAXParser,
                  SAXParserFactory spf = SAXParserFactoryImpl.newInstance();
                  spf.setNamespaceAware(true);
                  spf.setValidating(true);
                  SAXParser sp = spf.newSAXParser();
                  // setup the schema file
                  sp.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
                  sp.setProperty(JAXP_SCHEMA_SOURCE, new File("IOReqMsgSchema.xsd"));
                  //parse the input xml using the given schema
                  sp.parse(inputStream, new ParseErrorHandler());
            catch(SAXException se) {
              se.printStackTrace();
            catch ( Exception e ) {
              throw new StreamTransformationException( e.getMessage() );
    My input message is :
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:OrderCreate_request xmlns:ns0="mynamespace">
       <ORDER>HTEST1234567</ORDER>
       <ORDER_TYPE>z001</ORDER_TYPE>
       <ORDER_NAME>Test Order</ORDER_NAME>
       <CO_AREA>INTC</CO_AREA>
       <CCTR_POSTED>1234567890888888888</CCTR_POSTED>
       <CURRENCY>USD</CURRENCY>
       <PERSON_RESP>12345679</PERSON_RESP>
    </ns0:OrderCreate_request>
    Kindly help! please this is urgent!!!!!!
    Thanks
    Gopal
    Edited by: gopalkrishna baliga on Feb 28, 2008 9:34 AM

    Hi Stefan,
       I did the code changes to return output stream and the java code works perfectly in standalone mode in my PC.
       But when I use the same in the Java mapping with XI then It throws an error "Getting Error in java mapping: Parsing empty source. Root element expected!".
    My XI J2EE server has JDK1.4.3.11.
    Is there any limitation of using SAX parser in XI? If Yes, then which parser should be used for schema validation in XI?
    I have included the XSD file for schema validation along with class files in the .jar file. This jar file is then imported in XI repository. Is the XI engine not able to read the XSD file?
    Do I have to handle reading XSD file differently? Any suggession how?
    Is this parser error due to some security access?
    Kindly help me! I have been struggling with this problem since 2 weeks. I will be greatfull to you if you can help me.
    Thanks
    Gopal

  • Endeca : multi invoice pay throwing correct error for internal user but it is failing to throw the same error for external user

    Hi,
    1) Internal User expected exception:
    Exception: Payments,apply credits,disputes and print are not supported when multiple customer/currency transactions are selected
    2) External User is throwing below error instead of throwing above exception.
    Error
      You are trying to access a page that is no longer active.
      The referring page may have come from a previous session. Please select Home
       to proceed.
    found this MACCHECK from fnd logs of external user payment.
    MACCHECK: . Parameter failing validation is :mode. The parameter mode with value MultiPay could not be recognized as part of Server's response on the previous request.  Incoming URL is : /OA_HTML/OA.jsp?page=/oracle/apps/ar/irec/endeca/webui/EndecaDummyPG . Current URL is : /OA_HTML/OA.jsp?page=/oracle/apps/ar/irec/endeca/webui/OIREndecaCustHomePG&akRegionApplicationId=222&_ti=1125493452&oapc=10&retainAM=Y&addBreadCrumb=N&oas=6-LL4ndIUFLX-2zjQAQD6A.. . Referer URL is : https://<hostname>:4443/endeca/web/ar/customer?doAsUserLanguageId=en_US&languageId=en_US . HTTP Request Method is : POST
    can someone please help.
    Thanks,
    RRS

    Well, I compared my classpath between my windows batch file and the
    makefile (that comes with the samples installation) on Solaris and realized
    that I am using different sets of jars.
    So, I removed the extra jars from the makefile to narrow down the
    problem. If I remove the /opt/SUNWam/lib/servlet.jar from the makefile,
    I can reproduce this problem on the Solaris box as well.
    When I include this servlet.jar on my windows machine the program works!
    Only jars I have in my classpath are amclientsdk.jar and servlet.jar which
    I have copied from my installation (/opt/SUNWam/lib) on the Solaris box.
    Just the same way, by copying the am_services.jar, saaj-api.jar, and jaxm-api.jar,
    from the Solarix box to the windows machine,
    I am also able to pull the assertions from the Access Manager.
    I installed Sun Java Enterprise System 2005Q1 on a Solaris 10 machine.
    During the installation, I configured to install the Access Manager
    in Sun Application Server.
    Why do I need to have different set of jars on the windows machine
    for the Access Manager client SDK ?
    Could you please point me to a download link where I could download
    the correct Windows Access Manager Client SDK for
    Sun Java System Access Manager 6.0 (Sun JES 2005Q1)?
    Thanks.

Maybe you are looking for

  • Flash files in iWeb - Thanks

    While it's been possible to place flash files in iWeb with workarounds in the past it's now easy with the new version. The HTML snippet feature has saved the day, Thanks Apple! I can hardly imagine the net without Flash. To see an example go here: ht

  • Steps required for two way interface

    Hi i have a scenario SAP seneds Transfer order (Idoc) to external systems via XI middleware, then external system confirm and send the XML file to SAP system visa XI. i roughly know that i have to use File and IDOC adpaters.but i dont know what are t

  • Running more than one batch on the same resource at the same time.

    Dear all, as i'm working in paper industry , i have to release more than one batch at the same time using batchable resource , but i have problem in declaring the resource usage , if i run 3 batches on the same resource for i hour , what is the resou

  • How do I burn photos from macbook air to dvd to play on dvd player

    how do I burn my photos to a dvd to be played on dvd player?

  • XI VPN

    Hi Gurus I want to connect my R/3 system to an XI System which is located in a different physical location which is accessible through VPN How do i get this R/3 Application defined as a Business System/Service in the XI SLD. Also i need the basic SLD