OutOfMemory Exceptions on Servlets, Try-Catch unable to help

Hi, I'm playing with Java servlets right now and I seem to be getting some OutOfMemory errors. The weird thing is that even though I had identify the souce of error and tried to enclose it with a try-catch, the exception still occurs. Why is that so?

OutOfMemoryError is actually a java.lang.Error, not a RuntimeException. So if you use a try/catch like this
try {
  // stuff
} catch (Exception e) {..}Errors will fall through, since Error is not a subtype of Exception. (Check the API.)
You can catch it by catching Error or Throwable, like this:
try {
  // stuff
} catch (Error e) { //  this is rarely a good idea
}But you normally wouldn't want to do this. When there's no memory left, there's not a whole lot you can do about it, and most of the code you might want to put inside the catch block will merely throw another OutOfMemoryError.
As voronetskyy said, you're either creating too many (or too large) objects (typically in an endless loop), or you have specified too little memory for your application.

Similar Messages

  • Exception handling with try/catch in acrobat

    Hi
    I have a problem using a try/catch block in my acrobat document-script. Try to enter the following into the debugger-console:
    try{nonexistentFunction();}catch(e){console.println('\nacrobat can't catch')}
    and run it. The output will be:
    nonexistentFunction is not defined
    1:Console:Exec
    acrobat can't catch
    true
    The whole point of a rty/catch block is for the application  NOT to throw an exception, but instead execute the catch-part of the  statement. However, acrobat does both: It throws an exception AND  executes the catch-block.
    Is there another way to suppress the exception, or to make the try/catch-block work as it's supposed to?

    > Also Adobe provides for free the JS or compiled file for Acrobat Reader to support the JS console.
    Where is that file located ? How to install it or where to place it ?
    What is the method referred by try67 on his site where he sells a product ?
    Is that the same as the compiled file you refer to ? or did he sell his solution to adobe ?
    It is helpful if people can get an idea of the nature of choices available and make informed decisions, than a cloak and dagger approach.
    For some jobs that we have, I have been very frustrated by a consultant who wont even give basic info for transparent billing despite all assurances for privacy, as a result we are forced to do the job ourselves.
    Dying Vet

  • How to accept 2 strings in a class with try catch method..help!!

    the program below will accept two strings and compare str1 and str2 if equal. this program uses functions. can any one help me with this?
    import java.io.*;
    public class StrCompare {
         private BufferedReader takyoin = null;
         //private BufferedReader intakyo = null;
         * @param args
         public StrCompare(){
              takyoin = new BufferedReader(new InputStreamReader(System.in));
              //intakyo = new BufferedReader(new InputStreamReader(System.in));
         public String UserInput(){
         public static void main(String[] args) {
              // TODO Auto-generated method stub
    }

    What are you talking about? There is no such thing as "try-catch-methods", and there are no functions but methods.
    Strings by the way have their own means of comparision. Apart from that: do your own homework.

  • Exception error..try/catch

    I was wondering if someone could direct me to a site or book that decribes what some of the exceptions are, and in what class they are in ( already built for you ) Such as NumberFormatException ClassNotFoundException and so on. Basically I know what I want to look for just don't know if my package already , sun, already has something built for it. I hope I'm explaining myself well enough.
    Thanks alot!!

    Exceptions are not restricted by class. Any class can throw any exception. If you are looking for a pre-built exception that represents, for instance, an occurrance of Foo, try looking in the API reference for FooException in the index.
    Java divides exceptions into the packages in which they logically belong. So IOException is in the java.io package. To my knowledge there are "general purpose" exceptions in java. They all have a specific purpose. Usually developers end up having to write their own exceptions.
    The API doc is your best bet though.

  • Catch exception in servlet and display it in jsp

    I'm trying to catch an exception of any type in a servlet and make a jsp page handle it (display the error message). How can I pass that exception from the servlet to the jsp page?
    Thank you

    I'm trying to catch an exception of any type in a
    servlet and make a jsp page handle it (display the
    error message). How can I pass that exception from the
    servlet to the jsp page?
    Thank you In your servlet:
    try
    catch (Throwable t)
    session.putValue("ErrorMessage", t.toString());
    response.sendRedirect("/Error.jsp");
    return;
    }In Error.jsp:
    <%
    String errorMessage = (String)session.getValue("ErrorMessage");
    %>
    <html>
    <%= errorMessage %>
    </html>HTH

  • Performance impact on using too much try catch block

    I have several questions here:
    1. The system that I'm developing requires to be high performance, but I am not sure how will try catch block affect overall performance.
    2. I wanted to know which would be more efficient (result in faster processing)
    Have several generic try catch OR catch all exceptions individually?
    ex:
    try {
    } catch (Exception e){
    }vs.
    try{
    } catch (MalformedUrlException me){
    } catch(SQLException){
    }3. Which one would be faster, one big try catch block or several small try catch blocks?
    ex.
    try{
    //read from io file
    //query database
    //parse data
    //write to file
    //query database again
    } catch(Exception e){
    //log exception
    }vs.
    try{
    //read from io file
    } catch(FileNotFoundException fnfe){
    //log exception
    try{
    //query database
    }catch(SQLException se){
    //log exception
    try{
    //parse data
    }catch(SaxParserException saxe){
    //log exception
    try{
    //query database again
    }catch(SQLException se2){
    //log exception
    try{
    //write to file
    } catch(FileNotFoundException fnfe){
    //log exception

    1. The system that I'm developing requires to be high performance, but I am not sure how will try catch block affect overall performance.Compared to what? You can't write an equivalent program that doesn't have a try-catch block, so the answer would have to be that it doesn't affect performance at all.
    2. I wanted to know which would be more efficient (result in faster processing)Have several generic try catch OR catch all exceptions individually?
    You still have it backwards. Do you need to do different things for different exceptions? If so, then that's what you have to do and there is no other code that might be "faster".
    Here's what you should do. Write the code that needs to be written. Don't leave out necessary stuff because of performance reasons. (If you left out all your code, the program would run much faster.) Then find out which parts of the program ACTUALLY take the most time and work on speeding them up.

  • RAISERROR with Try/Catch does not exit after exception in catch block

    I am trying to propogate an error from within my proc out to the caller.
    In the attached example I have 2 sets of try catch blocks.
    I raiserror in the first
    catch the error and then raiserror again. (I expect to exit)
    I do not expect :
    to get to print 'post test'
    to get to second try block.
    but this does not exit, instead the code flows as per 2 runs.
    I do not understand the reason for the flows, as it seems counterintuitive to be raising an error but then still print following exceptions. I cannot seem to find any references that explains this behaviour.
     running tests together results
    print '-------------------------------------------------------'
    print 'test 15'
    exec test_raiseerror 15
    print '-------------------------------------------------------'
    print 'test 16'
    exec test_raiseerror 16
    print '-------------------------------------------------------'
    print 'test 17'
    exec test_raiseerror 17
    print '-------------------------------------------------------'
    print 'test 18'
    exec test_raiseerror 18
    print '-------------------------------------------------------'
    'RESULTS'
    test 15
    error number provided: 15
    Msg 50000, Level 15, State 1, Procedure test_raiseerror, Line 21
    name hello 15
    post test
    15
    Msg 50000, Level 15, State 1, Procedure test_raiseerror, Line 37
    name hello 2 15
    post test2
    test 16
    error number provided: 16
    Msg 50000, Level 16, State 1, Procedure test_raiseerror, Line 21
    name hello 16
    post test
    16
    Msg 50000, Level 16, State 1, Procedure test_raiseerror, Line 37
    name hello 2 16
    post test2
    test 17
    error number provided: 17
    post test
    17
    post test2
    test 18
    error number provided: 18
    post test
    18
    post test2
    Msg 50000, Level 17, State 1, Procedure test_raiseerror, Line 21
    name hello 17
    Msg 50000, Level 17, State 1, Procedure test_raiseerror, Line 37
    name hello 2 17
    Msg 50000, Level 18, State 1, Procedure test_raiseerror, Line 21
    name hello 18
    Msg 50000, Level 18, State 1, Procedure test_raiseerror, Line 37
    name hello 2 18
    run tests seperately
    exec test_raiseerror 15
    error number provided: 15
    RESULTS 15
    Msg 50000, Level 15, State 1, Procedure test_raiseerror, Line 21
    name hello 15
    post test
    15
    Msg 50000, Level 15, State 1, Procedure test_raiseerror, Line 37
    name hello 2 15
    post test2
    exec test_raiseerror 16
    RESULTS 16
    error number provided: 16
    Msg 50000, Level 16, State 1, Procedure test_raiseerror, Line 21
    name hello 16
    post test
    16
    Msg 50000, Level 16, State 1, Procedure test_raiseerror, Line 37
    name hello 2 16
    post test2
    exec test_raiseerror 17
    RESULTS 17
    error number provided: 17
    post test
    17
    post test2
    Msg 50000, Level 17, State 1, Procedure test_raiseerror, Line 21
    name hello 17
    Msg 50000, Level 17, State 1, Procedure test_raiseerror, Line 37
    name hello 2 17
    exec test_raiseerror 18
    RESULTS 18
    error number provided: 18
    post test
    18
    post test2
    Msg 50000, Level 18, State 1, Procedure test_raiseerror, Line 21
    name hello 18
    Msg 50000, Level 18, State 1, Procedure test_raiseerror, Line 37
    name hello 2 18
     CODEBLOCK:
    if object_id('test_raiseerror','P') is not null
    drop proc test_raiseerror
    go
    create proc test_raiseerror(@id as int) as
    begin
    begin try
    declare @name varchar(20)
    select @name = 'hello'
    raiserror('name %s %d',@id,1,@name,@id)
    print 'next'
    end try
    begin catch
    declare @errormessage nvarchar(4000)
    declare @errornum int
    select @errormessage = error_message()
    , @errornum = error_severity()
    print 'error number provided: ' + convert(varchar(2),@errornum)
    raiserror(@errormessage, @errornum,1)
    print 'post test'
    end catch
    begin try
    select @name = 'hello 2'
    raiserror('name %s %d', @id,1,@name, @id)
    end try
    begin catch
    select @errormessage = error_message()
    , @errornum = error_severity()
    print @errornum
    raiserror(@errormessage, @errornum,1)
    print 'post test2'
    end catch
    end
    go
    sqlserver 2008 & 2008 R2

    There is a Connect that describes a similiar complaint.  But basically a raiserror inside a catch block does not terminate the procedure, it will continue with any additional code in the CATCH and FINALLY unless it hits a return statement.
    http://connect.microsoft.com/SQLServer/feedback/details/275308/have-raiserror-work-with-xact-abort

  • Doubt on try/catch exception object

    why it is not advisable to catch type exception in try catch block. Its confusing me. If i catch exception object then it will show whatever exception occured.
    btw, i was just go through duke stars how it works and saw this
    http://developers.sun.com/forums/top_10.jsp
    Congrats!

    Because there are many different kinds of Exception. If you have some specific local strategy for dealing with a particular excepion then you should be using a specific catch block.
    If you don't then you should allow the expection to end the program, and ideally you should deal with all the expceptions in one top-level handler, so you should throw, rather than catch the exceptions in your methods. Often at the outer most level of the program or thread you will actually catch Throwable (not just Exception) to deal with any unanticipated problems in a general kind of way.
    Also, you should be keeping track of what exceptions might be thrown, so that rather than using Exception in a throws clause or catch block, you should use the particular exceptions. Exceptions, generally, indicate a recoverable error that you really ought to be recovering from rather than just printing a stacktrace.
    That's why exceptions are treated differently from runtime errors.

  • Try/Catch Unknown Host Exception

    I need to validate for an error of Unknown Host Exception, in case someone tries connected to a server that doesn't exist, or types the wrong host name, so i can display a message. how do I do that, with a try catch block.
    I thought i would do:
    try{
          my code here such as...
          DatagramSocket socket = new DatagramSocket();
          // send request
          InetAddress address = InetAddress.getByName(args[0]);
          DatagramPacket packet = new DatagramPacket(buf, buf.length, address, 4445);
          socket.send(packet);
        ...and so on, more code...
           socket.close();
    } catch (IOException e) {
           e.printStackTrace();
           System.out.println("Unknown host " + args[0]);
    }

    thanks, i also had to take out the e.printStackTrace(); and replace that with
    my error message and System.exit(0); and I got what i needed!

  • Try catch exception handling

    Hi there,
    Was wondering if you could assist in me getting my head around try catch exception handling? I have this code:
    JOptionPane.showMessageDialog(null, "A subject consists of term names and definitions.\nYou should indicate the size and name of the subject");
             inputSubName = JOptionPane.showInputDialog(null, "Enter the Subject Name:");
             inputSubSize = JOptionPane.showInputDialog(null, "Enter the Subject's Term Size:");
             try {
                  size = Integer.parseInt(inputSubSize);
                  catch (NumberFormatException e) {
                            JOptionPane.showMessageDialog(null, "'" + inputSubSize + " is invalid " + " Please enter digits only");
                            inputSubSize = JOptionPane.showInputDialog(null, "Enter the Subject's Term Size:");
                            size = Integer.parseInt(inputSubSize);
             //create a new Subject object and pass in its name and size
             Subject sub = new Subject(inputSubName, size);
    ...My query is, if I catch an exception, how do I get the code to repeat the try again until the user inputs a correct data type? If the user above inputs something other than a number, it will catch it once and repeat the joptionpane inputbox, but if they do the same thing twice round - then the program bombs out. Is there a way i can get the code to retry the try until they input correctly?
    Cheers.

    eg.
    int size = 0;          
    while (true) {
         try {
              size = Integer.parseInt(inputSubSize);
              break;
         catch (NumberFormatException e) {
              JOptionPane.showMessageDialog(null, "'" + inputSubSize
                        + " is invalid " + " Please enter digits only");
              inputSubSize = JOptionPane.showInputDialog(null,
                        "Enter the Subject's Term Size:");
    }

  • Catch exception, but continue try{ ?

    I have a http timeout error that is handled by a printing of the stack trace, but how do I continue it so the while loop still continues?
    try {
    while(rs.next()) {
    httpConection.setConnectTimeout(15000);
    httpConnection.connect();
        }//end while loop
          con.close();
         catch(Exception e)
         continue; // <--- Won't let me do this, since it is not in a loop
         }//end catch
        thanks in advance

            public static void main(String[] args) {
         try {
          Statement stmt;
          ResultSet rs;
          Class.forName("com.mysql.jdbc.Driver");
          System.out.println("URL: " + url);
          System.out.println("Connection: " + con);
          stmt = con.createStatement();
          stmt = con.createStatement(
                   ResultSet.TYPE_SCROLL_INSENSITIVE,
                         ResultSet.CONCUR_READ_ONLY);
          while(rs.next()){
            int theInt= rs.getInt("id");
            String URLs = rs.getString("url");
            String urlString = URLs;
                  URL httpurl = new URL(urlString);
                URLConnection connection =
                httpurl.openConnection();
                if (connection instanceof HttpURLConnection) {
                    HttpURLConnection httpConnection =
                     (HttpURLConnection)connection;
                     httpConnection.setConnectTimeout(15000);
                     httpConnection.connect();
                  } // End IF
                 // Continue
          // End If(connection instanceof)...
          } // End While
          con.close();
         } // End TRY
        catch(Exception e) { }
            }Thats how I have the exception now.. If i try anything else it says need catch or finally for try?

  • Does Labview have Try Catch exception handling?

    1) Does Labview have Try Catch functions, exception handling?
    2) Can Labview access a file or download a file using http or https?
    3) How can labview  read data from an ex ternal server http or https?
    This is in labview 2009 or 2011

    Hi E,
             1. you can chain together your VIs with the error wires, such that if an error occurs in one of them, none of the following VIs will execute.  That's  like throwing an exception - it interrupts the execution chain.  You then "catch" that exception by putting an error handler wherever necessary, but not necessarily in every single VI.Hope  You wouldn't put try..catch inside every single .NET function, instead you handle the exception at the level at which is most appropriate. Same thing can be done in LabVIEW.
    Also see this.
    2. The attached example downloads a picture with http "GET" command.
        Dilbert.Main_LV71.vi 160 KB
    3.see this thread:
       http://forums.ni.com/t5/LabVIEW/Read-a-text-file-from-Labview-web-server-http/td-p/267434
    Yes!!The same thing pointed out by nijims.
    Thanks as kudos only

  • Problem with a Try/catch exception

    Hello everyone here on the forums. I'm brand new to Java and have a bit of a problem with a try catch statement I'm making. In the following code if a user enters a non-integer number the program will display "Sorry, incompatible data." Problem is it gets caught in a loop and continues to display "Sorry, incompatible data." My aim with the try catch was if the user is not quite smart enough to understand quadratic programs don't use symbols and characters it would state it isn't correct and continue running the program.
    Heres my code thus far:
    package finishedquadraticprogram;
    import java.util.*;
    * @author Matt
    public class quad {
         * @param args the command line arguments
        public static void main(String[] args) {
            boolean verification = true;
            double a, b, c, root1, root2, discriminant;
            Scanner keyInput = new Scanner(System.in);
            while ( verification)
            try
            System.out.println("a: ");
            a = keyInput.nextDouble();
            System.out.println("b: ");
            b = keyInput.nextDouble();
            System.out.println("c: ");
            c = keyInput.nextDouble();
            discriminant = Math.sqrt(b * b - 4 * a * c);
            root1 = (-b + discriminant) / 2 * a;
            root2 = (-b - discriminant) / 2 * a;
            verification = false;
            System.out.println("Root 1 = " +root1+ "\nRoot 2 = " +root2);
            } //try
            catch  (InputMismatchException iMe)
              System.out.println( "Sorry. incompatible data." );  
    }I'm pretty sure the problem is something to do with the keyboard buffer, but I'm not sure what I need to do to either reset it or clear it, whichever one works. (Oh, and how would I go about making the program use complex numbers? I realize Java can't use complex numbers and will just display NaN ... any ideas how to make this work?)
    Thanks a lot for all of your help guys, it's appreciated.

    this is better:
    package finishedquadraticprogram;
    import java.util.*;
    /** @author Matt */
    public class quad
       private static final double TOLERANCE = 1.0e-9;
       /** @param args the command line arguments */
       public static void main(String[] args)
          boolean verification = true;
          double a, b, c, root1, root2, discriminant;
          Scanner keyInput = new Scanner(System.in);
          while (verification)
             try
                System.out.println("a: ");
                a = keyInput.nextDouble();
                System.out.println("b: ");
                b = keyInput.nextDouble();
                System.out.println("c: ");
                c = keyInput.nextDouble();
                discriminant = Math.sqrt(b * b - 4 * a * c);
                if (Math.abs(a) < TOLERANCE)
                   root1 = 0.0;
                   root2 = -c/b;
                else
                   root1 = (-b + discriminant) / (2 * a);
                   root2 = (-b - discriminant) / (2 * a);
                verification = false;
                System.out.println("Root 1 = " + root1 + "\nRoot 2 = " + root2);
             } //try
             catch (InputMismatchException iMe)
                System.out.println("Sorry. incompatible data.");
                keyInput.next();
    }

  • Weblogic 8.1 SP4 getting Java.lang.outofMemory exception

    Dear experts,
    We are running WL8.1 SP4 on our Solaris 5.9 Server.
    We want to do MQ implementatin on this server and for the same some kernel parameters were changed.
    now our system has below parameters in /etc/system:
    set semsys:seminfo_semmsl=1000
    set semsys:seminfo_semvmx=32767
    set shmsys:shminfo_shmmax=4294967295
    set shmsys:shminfo_shmmin=1
    set shmsys:shminfo_shmseg=2048
    set shmsys:shminfo_shmmni=2048
    set semsys:seminfo_semmni=1024
    set semsys:seminfo_semaem=16384
    set semsys:seminfo_semmap=1026
    set semsys:seminfo_semmns=16384
    set semsys:seminfo_semopm=100
    set semsys:seminfo_semmnu=16384
    set semsys:seminfo_semume=256
    set msgsys:msginfo_msgmni=50
    set msgsys:msginfo_msgmap=1026
    set msgsys:msginfo_msgmax=4096
    set msgsys:msginfo_msgmnb=65535
    set msgsys:msginfo_msgtql=4096
    set msgsys:msginfo_msgssz=16
    set msgsys:msginfo_msgseg=8192
    set rlim_fd_cur=10000
    set rlim_fd_max=10000
    and below in /etc/profile:
    ulimit -s unlimited
    ulimit -d unlimited
    but as soon as server was rebooted and we tried to start the weblogic we got java.lang.outofmemory exception.
    details as below:
    admin_trace:
    java.lang.OutOfMemoryError
         at java.util.zip.ZipFile.open(Native Method)
         at java.util.zip.ZipFile.<init>(ZipFile.java:112)
         at java.util.zip.ZipFile.<init>(ZipFile.java:72)
         at weblogic.servlet.internal.WebAppHelper.makeImplicitMapFromJars(WebAppHelper.java:479)
         at weblogic.servlet.internal.WebAppServletContext.extractClassFiles(WebAppServletContext.java:5436)
         at weblogic.servlet.internal.WebAppServletContext.setDocroot(WebAppServletContext.java:5253)
         at weblogic.servlet.internal.WebAppServletContext.init(WebAppServletContext.java:545)
         at weblogic.servlet.internal.WebAppServletContext.<init>(WebAppServletContext.java:496)
         at weblogic.servlet.internal.HttpServer.loadWebApp(HttpServer.java:637)
         at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:619)
         at weblogic.j2ee.J2EEApplicationContainer.prepareWebModule(J2EEApplicationContainer.java:3191)
         at weblogic.j2ee.J2EEApplicationContainer.prepareModules(J2EEApplicationContainer.java:1581)
         at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1227)
         at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1070)
         at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2513)
         at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2463)
         at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2379)
         at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:866)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:594)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:508)
         at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    --------------- nested within: ------------------
    weblogic.management.ManagementException: [Deployer:149233]An unexpected error was encountered during the deployment process. - with nested exception:
    [java.lang.OutOfMemoryError]
         at weblogic.management.deploy.slave.SlaveDeployer.convertThrowable(SlaveDeployer.java:1017)
         at weblogic.management.deploy.slave.SlaveDeployer.access$500(SlaveDeployer.java:124)
         at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2395)
         at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:866)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:594)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:508)
         at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    managed2_trace:
    [java.lang.OutOfMemoryError].
    java.lang.OutOfMemoryError
         at java.util.zip.ZipFile.open(Native Method)
         at java.util.zip.ZipFile.<init>(ZipFile.java:112)
         at java.util.zip.ZipFile.<init>(ZipFile.java:72)
         at weblogic.servlet.internal.WebAppHelper.makeImplicitMapFromJars(WebAppHelper.java:479)
         at weblogic.servlet.internal.WebAppServletContext.extractClassFiles(WebAppServletContext.java:5436)
         at weblogic.servlet.internal.WebAppServletContext.setDocroot(WebAppServletContext.java:5253)
         at weblogic.servlet.internal.WebAppServletContext.init(WebAppServletContext.java:545)
         at weblogic.servlet.internal.WebAppServletContext.<init>(WebAppServletContext.java:496)
         at weblogic.servlet.internal.HttpServer.loadWebApp(HttpServer.java:637)
         at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:619)
         at weblogic.j2ee.J2EEApplicationContainer.prepareWebModule(J2EEApplicationContainer.java:3191)
         at weblogic.j2ee.J2EEApplicationContainer.prepareModules(J2EEApplicationContainer.java:1581)
         at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1227)
         at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1070)
         at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:823)
         at weblogic.management.deploy.slave.SlaveDeployer$Application.prepare(SlaveDeployer.java:3029)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareAllApplications(SlaveDeployer.java:967)
         at weblogic.management.deploy.slave.SlaveDeployer.resume(SlaveDeployer.java:349)
         at weblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.resume(DeploymentManagerServerLifeCycleImpl.java:229)
         at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:131)
         at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:966)
         at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:361)
         at weblogic.Server.main(Server.java:32)
    --------------- nested within: ------------------
    weblogic.management.ManagementException: [Deployer:149233]An unexpected error was encountered during the deployment process. - with nested exception:
    [java.lang.OutOfMemoryError]
         at weblogic.management.deploy.slave.SlaveDeployer.convertThrowable(SlaveDeployer.java:1017)
         at weblogic.management.deploy.slave.SlaveDeployer.access$500(SlaveDeployer.java:124)
         at weblogic.management.deploy.slave.SlaveDeployer$Application.prepare(SlaveDeployer.java:3034)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareAllApplications(SlaveDeployer.java:967)
         at weblogic.management.deploy.slave.SlaveDeployer.resume(SlaveDeployer.java:349)
         at weblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.resume(DeploymentManagerServerLifeCycleImpl.java:229)
         at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:131)
         at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:966)
         at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:361)
         at weblogic.Server.main(Server.java:32)
    >
    need help to identify what exactly went wrong and where.
    Thanks

    Hi,
    As you are using WLS8.1 It means your JDK will be JDK1.4 and there is a Bug already available with JDK1.4 for the Same issue ... Please find the below link:
    http://bugs.sun.com/bugdatabase/view_bug.do;:YfiG?bug_id=4705373 (For Sun JDK1.4)
    AND
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6373059 (For Sun JDK 1.5.0_05)
    Please try to switch to JRockit JDK.
    Thanks
    Jay SenSharma
    http://weblogic-wonders.com/weblogic (WebLogic Wonders Are Here)

  • Can't find class because of try catch block ?!

    Hello,
    I'm using the JNI to use a java library from my c++ code.
    JNI can't find the "Comverse10" class below, but when i put the try catch block in createMessage in comment, FindClass succeeds ?!
    Unfortunatly i need the code inside the try block ;-)
    I tried a few things, but none of them worked:
    - let createMessage throw the exception (public void createMessage throws ElementAlreadyExistsException ), so there isn't a try catch block in createMessage => result: the same
    - make a "wrapper" class Comverse that has a Comverse10 object as attribute and just calls the corresponding Comverse10.function. Result: Comvers could be found, but not constructed (NewObject failed).
    Can someone tell me what is going on ?!
    Thank you,
    Pieter.
    //Comverse10 class
    public class Comverse10 {
    MultimediaMessage message;
    /** Creates a new instance of Comverse10 */
    public Comverse10() {
    public void createMessage() {
    TextMediaElement text1 = new TextMediaElement("Pieter");
    text1.setColor(Color.blue);
    SimpleSlide slide1 = new SimpleSlide();
    //if i put this try catch block in comment, it works ?!
    try{
    slide1.add(text1);
    catch(com.comverse.mms.mmspade.api.ElementAlreadyExistsException e){}
    MessageContent content = new MessageContent();
    content.addSlide(slide1);
    this.message = new MultimediaMessage();
    message.setContent(content);
    message.setSubject("Mijn subjectje");
    for those of you who are intersted: here's my C++ code:
    //creation of JVM
    HRESULT Java::CreateJavaVMdll()
         HRESULT HRv = S_OK;
    char classpath[1024];
         jint res;
         if(blog)     this->oDebugLog->Printf("CreateJavaVMdll()");
         strcpy(classpath,"-Djava.class.path="); /*This tells jvm that it is getting the class path*/
         strcat(classpath,getenv("PATH"));
         strcat(classpath,";D:\\Projects\\RingRing\\MMSComposer;C:\\Progra~1\\j2sdk1~1.1_0\\lib");     //;C:\\Comverse\\MMS_SDK\\SDK\\lib\\mail.jar;C:\\Comverse\\MMS_SDK\\SDK\\lib\\activation.jar;C:\\Comverse\\MMS_SDK\\SDK\\lib\\mmspade.jar
         //------Set Options for virtual machine
         options[0].optionString = "-Djava.compiler=NONE"; //JIT compiler
         options[1].optionString = classpath;                                        //CLASSPATH
         //------Set argument structure components
         vm_args.options = options;
         vm_args.nOptions = 2;
         vm_args.ignoreUnrecognized = JNI_TRUE;
         vm_args.version = JNI_VERSION_1_4;
         /* Win32 version */
         HINSTANCE hVM = LoadLibrary("C:\\Program Files\\j2sdk1.4.1_01\\jre\\bin\\client\\jvm.dll");
         if (hVM == NULL){
              if(blog) oDebugLog->Printf("Can't load jvm.dll");
              return E_FAIL;
         if(blog) oDebugLog->Printf("jvm.dll loaded\n");
         LPFNDLLFUNC1 func = (LPFNDLLFUNC1)GetProcAddress(hVM, "JNI_CreateJavaVM");
         if(!func){
              if(blog)     oDebugLog->Printf("Can't get ProcAddress of JNI_CreateJavaVM");
              FreeLibrary(hVM);     hVM = NULL;
              return E_FAIL;
         if(blog)     oDebugLog->Printf("ProcAddress found");
         res = func(&jvm,(void**)&env,&vm_args);
         if (res < 0) {
    if(blog)     oDebugLog->Printf("Can't create JVM with JNI_CreateJavaVM %d\n",res);
    return E_FAIL;
         if(blog)     oDebugLog->Printf("JVM created");
         return HRv;
    //finding Comverse10 class:
    HRESULT CALLAS MMSComposer::InitializeJNI(void)
         HRESULT HRv=E_FAIL;
         DWORD T=0;
         try
              if(blog)     oDebugLog->Printf("\nInitializeJNI()");
              bJVM = FALSE;
              jni = new Java(oDebugLog);
              if(jni->CreateJavaVMdll()!=S_OK){
                   if(blog)     oDebugLog->Printf("CreateJavaVMdll() failed");     
                   return HRv;
              jclass jcls = jni->env->FindClass("Comverse10");
              if (jcls == 0) {
    if(blog)     oDebugLog->Printf("Can't find Comverse10 class");
                   jclass jcls2 = jni->env->FindClass("test");
                   if (jcls2 == 0) {
                        if(blog)     oDebugLog->Printf("Can't find test class");
                        return HRv;
                   if(blog)     oDebugLog->Printf("test class found %08x",jcls2);
    return HRv;
              if(blog)     oDebugLog->Printf("Comverse10 class found %08x",jcls);
              jmethodID mid = jni->env->GetMethodID(jcls , "<init>", "()V");
              if (mid == 0) {
                   if(blog)     oDebugLog->Printf("Can't find Comverse10() constructor");
    return HRv;
              if(blog)     oDebugLog->Printf("Comverse10() constructor found");
              jobject jobj = jni->env->NewObject(jcls,mid);
              if(jobj==0)
                   if(blog)     oDebugLog->Printf("Can't construct a Comverse10 object");
    return HRv;
              if(blog)     oDebugLog->Printf("Comverse10 object constucted");
              //Create Global reference, so java garbage collector won't delete it
              jni->jobj_comv = jni->env->NewGlobalRef(jobj);
              if(jni->jobj_comv==0)
                   if(blog)     oDebugLog->Printf("Can't create global reference to Comverse10 object");
    return HRv;
              if(blog)     oDebugLog->Printf("global reference to Comverse10 object %08x created",jni->jobj_comv);
              bJVM=TRUE;
              HRv=S_OK;
         }     catch( IDB * bgError ) { throw bgError->ErrorTrace("InitializeJNI::~InitializeJNI",HRv, 0, T); }
              catch(...) { throw IDB::NewErrorTrace("InitializeJNI::~InitializeJNI",HRv, 0, T ); }
              return HRv;

    >
    I would guess that the real problem is that that the
    exception you are catching is not in the class path
    that you are defining.Thanks jschell, that was indeed the case.
    I don't have the docs, but I would guess that
    FindClass() only returns null if an exception is
    thrown. And you are not checking for the exception.
    Which would tell you the problem.Ok, i'll remember that. But what with exceptions thrown in my java code, the documents say
    // jthrowable ExceptionOccurred(JNIEnv *env);
    // Determines if an exception is being thrown. The exception stays being thrown until either the native code calls ExceptionClear(), or the Java code handles the exception
    so, what if the java code throws an exception and catches it, will i be able to see that in my c++ code with ExceptionOccurred ?
    or
    should the java method be declared to throw the exception (and not catch it inside the method)
    Again, thank you for your help, it's greatly appreciated !

Maybe you are looking for