RunTimeException Question

Hi!
I'm still learning java and I have a question that so far none of my friends was able to answer.
If you to the hierarchy of java Throwable is like this:
Object
I
Throwable
I I
Error Exception
... I
... RunTimeException
Why RunTimeException is under Exception and not under Error? RunTimeException is a unchecked and not check like Exception.
Shouldn't it be under Error instead?
Best regards

skalster wrote:
Why RunTimeException is under Exception and not under Error? RunTimeException is a unchecked and not check like Exception.Shouldn't it be under Error instead?Hi,
An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions. The ThreadDeath error, though a "normal" condition, is also a subclass of Error because most applications should not try to catch it.
A method is not required to declare in its throws clause any subclasses of Error that might be thrown during the execution of the method but not caught, since these errors are abnormal conditions that should never occur.
These are the subclassses of Error > AssertionError, AWTError, CoderMalfunctionError, FactoryConfigurationError, LinkageError, ThreadDeath, TransformerFactoryConfigurationError, VirtualMachineError
But RuntimeException is the superclass of those exceptions that can be thrown during the normal operation of the Java Virtual Machine.
A method is not required to declare in its throws clause any subclasses of RuntimeException that might be thrown during the execution of the method but not caught.
Checked Exception are used for recoverable conditions But UnChecked exceptions are caused by programmer
mistake by violating some contract.
hope i have clarified something

Similar Messages

  • RuntimeException while Role Mining (OIA integration with Waveset)

    HI All...
    I would appreciate some help with the following, If anybody has any ideas.... plz.
    My Appologies if it is in the wrong category but there is no Identity Analytics category.
    My PoC Environment consists of
    Vm #1
    Centos 5.5 (64bit)
    JDK 1.6.0_25 (64bit)
    Oracle Waveset 8.1.1 patch 4 (145769-05)
    MySql (5.0.77)
    Oracle Glassfish 3.1.1 (Zip Distro)
    VM #2
    Centos 5.5 (64Bit)
    JDK 1.6.0_25 (64bit)
    Oracle Identity Analytics 11.1.1.3.6 (p12831135)
    MySql (5.0.77)
    Apache Tomcat 6.0.32
    VM #3
    Centos 5.5 (64Bit)
    JDK 1.6.0_25 (64bit)
    MySql (5.0.77)
    All components are installed and configured as described in their respective documentation. Waveset and Analytics each have their own repository locally and the 3rd VM contains a database with 2x Tables (each configured as a resource in Waveset). Table 1x - 32 000 entries, Table 2x 45 000 entries.
    Integration was configured and tested successfully.
    From a Waveset side the Accounts contained in the 2x Tables have be reconciled with Waveset and shows up as expected. Column mapped, and users on direct resource assignments (No Roles yet...)
    From an Analytics side I have done the following:
    1. Import the same Business Structure that was used in Waveset into Analytics using csv import.
    2. Import the Global Users from Waveset using the configured provisioning server instance.
    3. Import the Resource Metadata from Waveset.
    4. Import the Resources from Waveset.
    5. Import the Accounts from Waveset.
    Up to this point this all completed successfully.
    I ran some custom SQL updates to link the Global Users to the relevant Business Structure (bu_globalusers table) as this was not done during the import. (even thou waveset.organization maps to RMBUname and customproperty1) but no matter.
    If I log into Analytics I can go to the Identity Warehouse and see the Business Structure, see the Users assigned to a Business Structure and the Accounts linked to that user.
    I can go to Resources and see the Attributes defined under each, as well as sample search results when I select an attribute.
    I modified the WEB-INF/rolemining-context.xml: <property name="roleminingAccountThreshold" value="*50000*"/> to allow for the number of records in the database tables during role mining.
    I configured the Resource type for one of the resources to have one of the attributes minable. I then went and scheduled a Role Mining Task to mine that resource.
    The task ran with the following result:
    13:39:10,119 DEBUG [RMEServiceUtil] About to call scheduler service to schedule roleMiningRun : com.vaau.rbacx.scheduling.domain.SchedulerRoleMiningJob@106e94
    13:39:10,127 DEBUG [SqlMapRoleMiningOptionsDaoImpl] LoadingRoleMiningOptionsWrapper
    13:39:10,209 DEBUG [FindRolesHelper] Loading Role Mining Run from backend: 31
    13:39:10,209 DEBUG [SqlMapRoleMiningRunDaoImpl] Loading RoleMiningRunWrapper
    13:39:10,216 DEBUG [FindRolesHelper] Loading Role Mining Options from backend: 31
    13:39:10,216 DEBUG [RMEServiceUtil] About to call scheduler service to schedule roleMiningRun : com.vaau.rbacx.scheduling.domain.SchedulerRoleMiningJob@106e94
    13:39:10,224 DEBUG [SqlMapRoleMiningOptionsDaoImpl] LoadingRoleMiningOptionsWrapper
    13:39:10,232 DEBUG [SqlMapRoleMiningRunDaoImpl] Loading RoleMiningRunWrapper
    13:39:10,261 DEBUG [MLRbacxRoleMiningServiceImpl] Creating DataRecords...
    13:39:10,306 DEBUG [RoleMiningConfigurationManagerImpl] Retrieving Role Mining configuration
    13:39:10,306 DEBUG [RoleMiningConfigurationManagerImpl] Returning in memory role mining configuration
    13:39:10,308 DEBUG [NamespaceEndpointInstanceCreator] Calling account manager to count accounts
    13:39:10,838 DEBUG [NamespaceEndpointInstanceCreator] Accounts counted by account manager
    13:39:10,838 DEBUG [NamespaceEndpointInstanceCreator] 1 endpoints had 32675 accounts
    13:39:10,838 DEBUG [RoleMiningConfigurationManagerImpl] Retrieving Role Mining configuration
    13:39:10,838 DEBUG [RoleMiningConfigurationManagerImpl] Returning in memory role mining configuration
    13:39:10,839 DEBUG [NamespaceEndpointInstanceCreator] Normalizer flag is true
    13:39:10,839 DEBUG [NamespaceEndpointInstanceCreator] Loading accounts in endpoints
    13:39:10,839 DEBUG [NamespaceEndpointInstanceCreator] Calling account manager to load accounts
    13:39:31,222 ERROR [SqlMapTemplateConcurrentReader] End:getAccountAttributeWrappersRootOnly, com.vaau.commons.dao.concurrent.ibatis.SqlMapTemplateConcurrentReader@4dbff46fResult: Error, Parameters:{rootIdList=[24633, 24658, 24683, 24708, 24733, ...
    49158, 49183, 49208], endPointId=1}
    13:39:31,232 ERROR [SqlMapTemplateConcurrentReader] End:getAccountAttributeWrappersRootOnly, com.vaau.commons.dao.concurrent.ibatis.SqlMapTemplateConcurrentReader@fa85648Result: Error, Parameters:{rootIdList=[6, 31, 55, 80, 105, 129, 154, 178, 202, ...
    +Repeats a bunch of times+
    +Repeats a bunch of times+
    2755, 762771, 762787, 762803], endPointId=1}
    14:09:35,912 ERROR [MLRbacxRoleMiningServiceImpl] Problem starting role mining processjava.lang.RuntimeException: Error while executing query:getAccountAttributeWrappersRootOnly
    14:09:35,913 ERROR [RoleMiningExecutor] Role Mining run exit with errors. com.vaau.rbacx.rolemining.service.RoleMiningException: java.lang.RuntimeException: Error while executing query:getAccountAttributeWrappersRootOnly
    Traced it to a file called WEB-INF/classes/com/vaau/rbacx/dao/ibatis/maps/AccountAttributeWrapper.xml which had some "^M" character in it but nothing serious.
    The Entry in question looks like follows:
    <select id="getAccountAttributeWrappersRootOnly" resultMap="hierarchyWrappers-with-metadata">
    select aah.id as aah_id, aah.root_id as aah_root_id, aah.parent_id as aah_parent_id,
    av.id as attribute_value_id, av.attribute_id, a.name as attribute_name, av.attribute_value,
    avm.high_privileged, avm.data_owner_id, avm.data_owner_name, avm.classification, avm.definition
    from acct_attr_hier_nodes aah
    join attribute_values av on aah.attribute_value_id = av.id
    left join attribute_value_metadata avm on (av.id=avm.attribute_value_id and #endPointId:BIGINT#=avm.endpoint_id)
    join attributes a on av.attribute_id = a.attributekey
    where 1=1
    <dynamic prepend="and">
    <iterate property="rootIdList" open="aah.id in (" close=")" conjunction=",">
    #rootIdList[]:BIGINT#
    </iterate>
    </dynamic>
    </select>
    The SQL executes against the DB without error, had to removed the "+#endPointId:BIGINT#=avm.endpoint_id+" as "+avm.endpoint_id=1+" does not exist in the DB by the time I execute the Query.
    Could not find the same Xml entry in Oracle Analytics 11.1.1.3.0, so I'm assuning its fairly new or linked to a previous bug....
    So finally getting to the Question: What is this and how can I get it fixed...? If anyone has any Ideas it would be much appreciated.
    Thank You,
    Pieter
    Edited by: user9372024 on Aug 26, 2011 7:22 AM

    I am facing the same issue - has anyone had any luck with integrating the two?
    Thanks in advance.

  • Urgent help with quick translation questions

    Hello,
    I am somewhat new to Java. I have a translation to hand in in a few hours (French to English). Argh! I have questions on how I worded some parts of the translation (and also if I understood it right). Could you, great developers, please take a look and see if what I wrote makes sense? I've put *** around the words I wasn't sure about. If it sounds strange or is just plain wrong, please let know. I also separated two terms with a slash, when I was in doubt of which one was the best.
    Many thanks in advance.
    1) Tips- Always ***derive*** the exceptions java.lang.Exception and java.lang.RuntimeException.
    Since these exceptions have an excessively broad meaning, ***the calling layers will not know how to
    distinguish the message sent from the other exceptions that may also be passed to them.***
    2) The use of the finally block does not require a catch block. Therefore, exceptions may be passed back to the
    calling layers, while effectively freeing resources ***attributed*** locally
    3) TIPS- Declare the order for SQL ***statements/elements*** in the constant declaration section (private static final).
    Although this recommendation slightly hinders reading, it can have a significant impact on performance. In fact, since
    the layers of access to data are ***low level access***, their optimization may be readily felt from the user’s
    perspective.
    4) Use “inlining.”
    Inlining is a technique used by the Java compiler. Whenever possible, during compilation, the compiler
    copies the body of a method in place of its call, rather than executing a ***memory jump to the method***.
    In the example below, the "inline" code will run twice as fast as the ***method call***
    5)tips - ***Reset the references to large objects such as arrays to null.***
    Null in Java represents a reference which has not been ***set/established.*** After using a variable with a
    large size, it must be ***reassigned a null value.*** This allows the garbage collector to quickly ***recycle the
    memory allocated*** for the variable
    6) TIPS Limit the indexed access to arrays.
    Access to an array element is costly in terms of performance because it is necessary to invoke a verification
    that ***the index was not exceeded.***
    7) tips- Avoid the use of the “Double-Checked Locking” mechanism.
    This code does not always work in a multi-threaded environment. The run-time behavior ***even depends on
    compilers.*** Thus, use the following ***singleton implementation:***
    8) Presumably, this implementation is less efficient than the previous one, since it seems to perform ***a prior
    initialization (as opposed to an initialization on demand)***. In fact, at runtime, the initialization block of a
    (static) class is called when the keyword MonSingleton appears, whether there is a call to getInstance() or
    not. However, since ***this is a singleton***, any occurrence of the keyword will be immediately followed by a
    call to getInstance(). ***Prior or on demand initializations*** are therefore equivalent.
    If, however, a more complex initialization must take place during the actual call to getInstance, ***a standard
    synchronization mechanism may be implemented, subsequently:***
    9) Use the min and max values defined in the java.lang package classes that encapsulate the
    primitive numeric types.
    To compare an attribute or variable of primitive type integer or real (byte, short, int, long, float or double) to
    ***an extreme value of this type***, use the predefined constants and not the values themselves.
    Vera

    1) Tips- Always ***derive*** the exceptions java.lang.Exception and java.lang.RuntimeException.***inherit from***
    ***the calling layers will not know how to
    distinguish the message sent from the other exceptions that may also be passed to them.***That's OK.
    while effectively freeing resources ***attributed*** locally***allocated*** locally.
    3) TIPS- Declare the order for SQL ***statements/elements*** in the constant declaration section (private static final).***statements***, but go back to the author. There is no such thing as a 'constant declaration section' in Java.
    Although this recommendation slightly hinders reading, it can have a significant impact on performance. In fact, since
    the layers of access to data are ***low level access***, their optimization may be readily felt from the user’s
    perspective.Again refer to the author. This isn't true. It will make hardly any difference to the performance. It is more important from a style perspective.
    4) Use “inlining.”
    Inlining is a technique used by the Java compiler. Whenever possible, during compilation, the compiler
    copies the body of a method in place of its call, rather than executing a ***memory jump to the method***.
    In the example below, the "inline" code will run twice as fast as the ***method call***Refer to the author. This entire paragraph is completely untrue. There is no such thing as 'inlining' in Java, or rather there is no way to obey the instruction given to 'use it'. The compiler will or won't inline of its own accord, nothing you can do about it.
    5)tips - ***Reset the references to large objects such as arrays to null.***Correct, but refer to the author. This is generally considered bad practice, not good.
    Null in Java represents a reference which has not been ***set/established.******Initialized***
    After using a variable with a
    large size, it must be ***reassigned a null value.*** This allows the garbage collector to quickly ***recycle the
    memory allocated*** for the variableAgain refer author. Correct scoping of variables is a much better solution than this.
    ***the index was not exceeded.******the index was not out of range***
    The run-time behavior ***even depends on compilers.***Probably a correct translation but the statement is incorrect. Refer to the author. It does not depend on the compiler. It depends on the version of the JVM specification that is being adhered to by the implementation.
    Thus, use the following ***singleton implementation:***Correct.
    it seems to perform ***a prior initialization (as opposed to an initialization on demand)***.I would change 'prior' to 'automatic pre-'.
    ***this is a singleton***That's OK.
    ***Prior or on demand initializations***Change 'prior' to 'automatic'.
    ***a standard
    synchronization mechanism may be implemented, subsequently:***I think this is nonsense. I would need to see the entire paragraph.
    ***an extreme value of this type******this type's minimum or maximum values***
    I would say your author is more in need of a technical reviewer than a translator at this stage. There are far too serious technical errors in this short sample for comfort. The text isn't publishable as is.

  • JNDI Lookup in Servlet  - Design Question

    I will appreciate if someone answers/clarifies my following questions.
    I am using Tomcat Connection pooling.
    1. If I understand correctly- with Connection Pooling - Server will take
    care of opening the connections with DB
    So if the Max users allowed is 10, it means that at any given time 10
    Concurrent users will be allowed access to DB.
    2.. Where do I place the code for doing the context lookup?
    I have many servlets called by JSP pages and these servlets will be
    accessing Database.
    (a) Shall I place the context lookup code in each of the servlets Init
    Method, but by doing so I am writing the same code again and
    again.
    If I understand correctly the Context lookup code is following 3 lines
    or Can I squeeze more code in Init()
    Context i = new InitialContext();
    Context e = (Context) i.lookup("java:comp/env");
    DataSource d = (DataSource) e.lookup("jdbc/mytestdb");
    Again if I have 30 Servlets, is this still a good idea?
    (b) If there is an alternative to 2 (a), like having another class or
    something, please elaborate on that and which part of code should
    be in this alternative.
    My application will be using JSP pages to call servlets that access Database to update or display results.
    Thank you very much.

    Thanks for reply.
    Yes, I have read that putting connection code in init of servlet is not good. Hence
    I have now a DbHelper Class that takes care of opening and returning a Connection when called.
    Servlets call this DbHelper class to get connection.
    Is the following a good idea?
    DbHelper.java
    import javax.naming.*;
    import javax.sql.*;
    import java.sql.*;
    public class DbHelper {
         //private final static String DATASOURCENAME  = "java:comp/env/jdbc/schooljsp";
         public static Connection getConnection(String jndiName){
              System.out.println(jndiName);
              try {     
             Context ctx = new InitialContext();
              DataSource datasource = (DataSource)ctx.lookup(jndiName);
              Connection con = null;
                   if (datasource != null) {
                      con = datasource.getConnection();
                   return con;
         }  catch (NamingException ex){
                throw new RuntimeException("Init: Cannot get connection" + ex);
           }  catch ( SQLException e){
               throw new RuntimeException("Cannot get Connections from Datasource");
    }And MY Servlet code
    public class AuthServlet1 extends HttpServlet {
         private final static String DATASOURCENAME  = "java:comp/env/jdbc/schooljsp";
         public void doGet(HttpServletRequest req, HttpServletResponse res)
              throws ServletException, IOException {
              res.setContentType("text/html");
              PrintWriter out = res.getWriter();
          try {
              Connection conn = DbHelper.getConnection(DATASOURCENAME);
              Statement stmt = conn.createStatement();
              ResultSet rs = stmt.executeQuery("select * from SIGNUP");
               out.println("SIGNUP<br>");
              while (rs.next()) {
                   out.print(rs.getString(1));
                   out.print(" ");
                   out.print(rs.getInt(2));
                   out.println("<br>");
              rs.close();
              stmt.close();
            }catch (Exception e) { System.out.println("Error e : " + e); }
    }Or I can make it more robust and better?
    Thanks a lot.

  • Good old EJBException question...

    I've trawled through this forum for a good explanation of EJBException versus RemoteException. I've not found anything I consider particularly intuitive. In fact, I've been amazed by some of the confusion that seems to exist about this, with some people responding with answers that are simply wrong.
    So, for my own enlightenment and hopefully the other people who've asked this question - could someone please give an explanation of when to throw an EJBException, when to throw a RemoteException (if ever) and when to throw another type of Exception?
    I'm also interested in what the client is guaranteed to receive in each of these cases and what effect this has on the bean that has thrown it.
    And just to keep things good and simple could they try to do it without mentioning "the specification"? I have read the specification but would like to know how it manifests itself in the real world and what is considered "good practice" in this matter.
    Many thanks in advance.

    hey kevin, you causing problems again!
    you've probably seen this article by now on EJBExcepitons at the serverside.com but here is the link anyway:
    http://www-106.ibm.com/developerworks/java/library/j-ejbexcept.html
    EJB exceptions are mine field but there are a couple solid guidelines that i follow when designing my beans with exceptions:
    1. Application Exceptions ( not descendants of RuntimeException or RemoteException ) are passed back to the client as is to give them the chance to take the appropriate recovery action. So before you leave your business method, you'd better make damned sure that you don't compromise data integrity. If you can't guarantee data integrity do the EJBContext.setRollbackOnly() thing. Which means that as a client you should get into the habit of doing UserTransaction.getStatus().
    2. Runtime Exceptions ( ignore EJBException for now ). I don't catch them but i'm not expecting them, and i don't know what to do with them. Thankfully, the container does (which is to log the exception, throw back RemoteExceptions to remote clients and EJBException to local clients, rollback the transaction and then take the bean instance out of service). So i delegate the handling of runtime exceptions to the container. i do not catch Throwable in my bean methods.
    3. System Exception ( EJBExceptions ). Where possible using EJB standard exceptions such as CreateException and FinderException. If my bean throws a checked exception, i need to gauge whether or not i can recover from it. I can't, i wrap it in an EJBException and throw it out for the container to do its stuff ( log, raise client exception, rollback and die ). Otherwise, i perform clean up in my bean to return my resources to the state they were before i started executing this method and raise the checked exception.
    In the article above the author's penultimate section talks about when to use an application exception over a system exception. Its always the client the determines which way your go. For example, what should you do during a create ejb you need to look up some data in the database and an SQLException is raised. Within the create method it is an application exception for sure because the system is not compromised, however, from the clients point of view, the bean cannot be created because key data was missing. Hence, the method should wrap the SQLException in an EJBException and throw it out to make sure the bean is not created. (If fact, the method retry something else and if nothing else works raise the EJBException).
    cleve

  • Three tier architecture questions

    Hello,
    My question is in regards to using Toplink in a three tier architecture situation. If I wish to send an object A which has a collection of Bs and B has a collection of C ( A nested object structure with two or more levels of indirection). Is the best solution to have the named query be part of a unit of work so that even if on the client side somebody unknowingly were to make the modification to one of the entity objects ( a POJO) the shared session cache would not be affected ?
    This is assuming the client side HTTP layer and the RMI/EJB layer are on different JVMs.
    Some of the other suggestions I have heard is to retrieve it from the shared session cache directly and if in case I need to modify one or more of the objects do a named query lookup on that object alone and then proceed to register that object in a unit of work and then commit the changes.
    Also the indirection would have to be utilised before the data objects are sent to the Servlet layer I presume ?(That is if I do a a.getAllOfBObjects() on the servlet side I would get a nullpointer exception unless all of B were already instatiated on the server side). Also when the objects are sent back to the server do I do a registerObject on all the ones that have changed and then do a deepMergeClone() before the uow.commit() ?
    Thanks,
    Aswin.

    Aswin,
    If your client is remote to the EJB tier then all persistent entities are detached through serialization. In this architecture you do not need to worry about reading and modifying the shared instance as it never the one being changed on the client (due to serialization).
    Yes, you do need to ensure that all required indirect relationships are instantiated on the server prior to returning them from the EJB call.
    Yes, you do need to merge the changes of the detached instance when returned to the server. I would also recommend first doing a read for the entity being merged (by primary key) on the new UnitOfWork prior to the merge. This will handle the case where you are merging into a different node of the cluster then where you read as well as allowing you to check for the case where the entity no longer exists in the database (if the read returns null then the merge will result in an INSERT and this may not be desired).
    Here is an example test case that does this:
        public void test() throws Exception {
            Employee detachedEmp = getDeatchedEmployee("Jill", "May");
            assertNotNull(detachedEmp);
            // Remove the first phone number
            PhoneNumber phone = detachedEmp.getPhoneNumber("Work");
            assertNotNull("Employee does not have a Work Phone Number",
                          detachedEmp.getPhoneNumber("Work"));
            detachedEmp.removePhoneNumber(phone);
            UnitOfWork uow = session.acquireUnitOfWork();
            Employee empWC = (Employee) uow.readObject(detachedEmp);
            if (empWC == null) { // Deleted
                throw new RuntimeException("Could not update deleted employee: " + detachedEmp);
            uow.deepMergeClone(detachedEmp);
            uow.commit();
         * Return a detached Employee found by provided first name and last name.
         * Its phone number relationship is instantiated.
        public Employee getDeatchedEmployee(String firstName, String lastName) {
            ReadObjectQuery roq = new ReadObjectQuery(Employee.class);
            ExpressionBuilder builder = roq.getExpressionBuilder();
            roq.setSelectionCriteria((builder.get("firstName").equal(firstName)).and(builder.get("lastName").equal(lastName)));
            Employee employee = (Employee)session.executeQuery(roq);
            employee.getPhoneNumbers().size();
            return (Employee)SerializationHelper.serialize(employee);
        }One other note: In these types of application optimistic locking is very important. You should also make sure that the locking field(s) are mapped into the object and not stored only in the TopLink cache. This will ensure the locking semantics are maintained across the detachment to the client and the merge back.
    Doug

  • JCO Server implementation questions

    Hi experts,
    I want to try to create a JCO Server with the JCO 3 library.
    I'm kinda lost in all the links I've found since there is still a lot of things from the JCO 2 on the internet and I don't understand everything I'm doing.
    Please note that there is already a working Java JCO server with old IBM tools and we need to migrate to JCO 3.
    So here are my questions :
    What do I have to do exactly in the sm59 transaction ?
    Here is what I get in the RSGWLST transaction http://i.imgur.com/IRgAyO8.png http://i.imgur.com/YyfDQbt.png (Loic-PC is my machine so I guess my java jco server is up.) Is everything ok ?
    I have followed this link (Java Program for Creating a Server Connection - Components of SAP Communication Technology - SAP Library) to create my java jco server. What exactly are ServerDataProvider.JCO_GWHOST, ServerDataProvider.JCO_GWSERV and above all ServerDataProvider.JCO_PROGID)
    How do I testmy Java JCO server ? I understood that I have to call STFC_TRANSACTION in se37 where I put my jco destination (previously set up in sm59 ?) and a string but I have a dump when I'm tying that.
    I hope someone can help me, everything is still really blurry to me.
    Regards
    Here is the code I use to try to connect :
        static String SERVER_NAME1 = "JCO_SERVER";
        static String DESTINATION_NAME1 = "ABAP_AS_WITHOUT_POOL";
        static String DESTINATION_NAME2 = "ABAP_AS_WITH_POOL";
        static
            Properties connectProperties = new Properties();
            connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "172.16.200.114");
            connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR,  "00");
            connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "500");
            connectProperties.setProperty(DestinationDataProvider.JCO_USER,   "develop2");
            connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "passw0rd");
            connectProperties.setProperty(DestinationDataProvider.JCO_LANG,   "en");
            createDataFile(DESTINATION_NAME1, "jcoDestination", connectProperties);
            connectProperties.setProperty(DestinationDataProvider.JCO_POOL_CAPACITY, "3");
            connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT,    "10");
            createDataFile(DESTINATION_NAME2, "jcoDestination", connectProperties);
            Properties servertProperties = new Properties();
            servertProperties.setProperty(ServerDataProvider.JCO_GWHOST, "sapdevdb02");
            servertProperties.setProperty(ServerDataProvider.JCO_GWSERV, "sapgw00");
            servertProperties.setProperty(ServerDataProvider.JCO_PROGID, "JCOServer");
            servertProperties.setProperty(ServerDataProvider.JCO_REP_DEST, "ABAP_AS_WITH_POOL");
            servertProperties.setProperty(ServerDataProvider.JCO_CONNECTION_COUNT, "2");
            createDataFile(SERVER_NAME1, "jcoServer", servertProperties);

    Hi Loic.
    The properties GWHost is Gateway Host and GWSERV stands for Gateway Server.
    Please look at this link to get more details:
    Possible Parameters (SAP Library - Components of SAP Communication Technology)
    Could you please put your full code for this class?
    I'm saying this because the code you have wrote only creates the propreties file that JCO uses to configure the server but you have to run your server through the main statement.
    You have to do something like that on your StfcConnectionHandler class.
    public static void main(String[] args) {
           step1SimpleServer();
    See my example:
    StfcConnectionHandler class--------------------
    package main;
    import com.sap.conn.jco.JCoException;
    import com.sap.conn.jco.JCoFunction;
    import com.sap.conn.jco.server.DefaultServerHandlerFactory;
    import com.sap.conn.jco.server.JCoServer;
    import com.sap.conn.jco.server.JCoServerContext;
    import com.sap.conn.jco.server.JCoServerFactory;
    import com.sap.conn.jco.server.JCoServerFunctionHandler;
    public class StfcConnectionHandler implements JCoServerFunctionHandler {
      private static final String SERVER_NAME1 = "YOUR_SERVER_NAME";
      public void handleRequest(JCoServerContext serverCtx, JCoFunction function) {
      System.out
      .println("----------------------------------------------------------------");
      System.out.println("call              : " + function.getName());
      System.out
      .println("ConnectionId      : " + serverCtx.getConnectionID());
      System.out.println("SessionId         : " + serverCtx.getSessionID());
      System.out.println("TID               : " + serverCtx.getTID());
      System.out.println("repository name   : "
      + serverCtx.getRepository().getName());
      System.out
      .println("is in transaction : " + serverCtx.isInTransaction());
      System.out.println("is stateful       : "
      + serverCtx.isStatefulSession());
      System.out
      .println("----------------------------------------------------------------");
      System.out.println("gwhost: " + serverCtx.getServer().getGatewayHost());
      System.out.println("gwserv: "
      + serverCtx.getServer().getGatewayService());
      System.out.println("progid: " + serverCtx.getServer().getProgramID());
      System.out
      .println("----------------------------------------------------------------");
      System.out.println("attributes  : ");
      System.out.println(serverCtx.getConnectionAttributes().toString());
      System.out
      .println("----------------------------------------------------------------");
      System.out.println("req text: "
      + function.getImportParameterList().getString("REQUTEXT"));
      function.getExportParameterList().setValue("ECHOTEXT",
      function.getImportParameterList().getString("REQUTEXT"));
      function.getExportParameterList().setValue("RESPTEXT", "Hello World");
      static void step1SimpleServer() {
      JCoServer server;
      try {
      server = JCoServerFactory.getServer(SERVER_NAME1);
      } catch (JCoException ex) {
      throw new RuntimeException("Unable to create the server "
      + SERVER_NAME1 + ", because of " + ex.getMessage(), ex);
      JCoServerFunctionHandler stfcConnectionHandler = new StfcConnectionHandler();
      DefaultServerHandlerFactory.FunctionHandlerFactory factory = new DefaultServerHandlerFactory.FunctionHandlerFactory();
      factory.registerHandler("STFC_CONNECTION", stfcConnectionHandler);
      server.setCallHandlerFactory(factory);
      server.start();
      System.out.println("The program can be stopped using <ctrl>+<c>");
      public static void main(String[] args) {
      step1SimpleServer();
    StepByStepServer class
    package main;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.util.Properties;
    import com.sap.conn.jco.ext.DestinationDataProvider;
    import com.sap.conn.jco.ext.ServerDataProvider;
    public class StepByStepServer
        static String SERVER_NAME1 = "SERVER";
        static String DESTINATION_NAME1 = "ABAP_AS_WITHOUT_POOL";
        static String DESTINATION_NAME2 = "ABAP_AS_WITH_POOL";
        static
            Properties connectProperties = new Properties();
            connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "ls4065");
            connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR,  "85");
            connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "800");
            connectProperties.setProperty(DestinationDataProvider.JCO_USER,   "farber");
            connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "laska");
            connectProperties.setProperty(DestinationDataProvider.JCO_LANG,   "en");
            createDataFile(DESTINATION_NAME1, "jcoDestination", connectProperties);
            connectProperties.setProperty(DestinationDataProvider.JCO_POOL_CAPACITY, "3");
            connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT,    "10");
            createDataFile(DESTINATION_NAME2, "jcoDestination", connectProperties);
            Properties servertProperties = new Properties();
            servertProperties.setProperty(ServerDataProvider.JCO_GWHOST, "binmain");
            servertProperties.setProperty(ServerDataProvider.JCO_GWSERV, "sapgw53");
            servertProperties.setProperty(ServerDataProvider.JCO_PROGID, "JCO_SERVER");
            servertProperties.setProperty(ServerDataProvider.JCO_REP_DEST, "ABAP_AS_WITH_POOL");
            servertProperties.setProperty(ServerDataProvider.JCO_CONNECTION_COUNT, "2");
            createDataFile(SERVER_NAME1, "jcoServer", servertProperties);
        static void createDataFile(String name, String suffix, Properties properties)
            File cfg = new File(name+"."+suffix);
            if(!cfg.exists())
                try
                    FileOutputStream fos = new FileOutputStream(cfg, false);
                    properties.store(fos, "for tests only !");
                    fos.close();
                catch (Exception e)
                    throw new RuntimeException("Unable to create the destination file " + cfg.getName(), e);
    Regards

  • JMS queue question

    Hi all,
    I am using Weblogic Application Server and say I have 1000 messages in a JMS Queue say "Q1".
    Q1. How are these messages picked up from the queues? i.e. by a thread etc.
    Q2. If they are picked up by threads then who configures these threads? Are they default threads created by the Weblogic Application Server or are user-created threads?
    Q3. Also, if 20 threads are involved in picking the messages from the queue and of them one thread snaps while picking the message then what will happen? and what will be the solution??
    Thanks.

    Q1/Q2*:
    The answer to your question is "its provider specific".
    You will need someone who explicitly works on weblogic to provide specifics so you may want to utilize a weblogic specific forum instead of a generic JMS forum
    I'll try to answer this in very generic terms that should apply to all providers:
    If you are receiving messages with an MDB: there is a thread pool associated with the resource adapter which plugs the JMS provider into the server. This is generally configured as part of the application server configuration. That pool dictates the maximum number of threads which can call the same MDB's at the same time.
    If you are receiving messages with a Servlet: In this case, you are probably calling receive within the servlet. That will use the thread provide by the webstack which is executing the servlet
    If you are receiving messages in an AppClient or Standalone provider: You are using your own thread if you call receive(), or a thread provided by the provider if you are calling onMessage()
    In all cases, the provider may be allocating additional threads "beneath the covers" to process those messages.
    Q3*:
    I'm not quite sure what snaps means. Threads run until they exit. I'm going to guess that the question is "what if the MDB or code throws a RuntimeException". If you mean something different, please supply a more specific description of the error.
    This one depends on what whether or not you are using transactions and how you are receiving those messages.
    If you are using transactions in an MDB: the transaction will rollback and the message will be redelivered to another consumer.
    In all other cases, it depends on the specifics (I was going to list them but it seems like to much work for a Friday afternoon).
    If you are using a non-transacted or non-MDB method to retrieve the messages, let me know and I can tell you how, per the JMS and J2EE specs, it should work. I'll need to know acknowledge mode/transaction, type of client and if you are calling receive() or onMessage().
    -- Linda

  • JMSBridgesXA/xa-compliant-oracleaq - how do TX work? StartupClass questions

    Hallo all,
              yesterday we called in our (very simple) MDB sessionContext.setRollbackOnly().
              Expected behavior: Oracle AQ should resend the JMS message after a while (queue_table still needs to have the message).
              Seen behavior: The JMS message was removed from Oracle AQ queue table and has not been resent. It got lost completely.
              Question: What do we have to do, that the MDB supports JMS transactions? We already defined Required in the deployment descriptor and referenced "AQXAJMSConnectionFactory" as factory in weblogic-ejb.jar.xml.
              Is there the requirement to use resource-ref's (probably this is not the case for incoming MDB's. Only interesting if doing a JMS send inside a MDB or Stateless Session EJB?).
              How does the JMSBrdigesXA project work together with BEA JTA TransactionManager?
              DipsStartupClass: What does it do exactly?
              It seems to instantiate the required AQ Factory and Queue classes and binds them to BEA JNDI.
              But also it creates a AQjmsConnection, AQjmsSession and Destination and starts the Connection and Session! (e.g createXAQueueConnection).
              Why does it have to do this?
              MDB's deployed to BEA JMS and referencing a JMSConnectionFactory don't need a StartupClass, so the normal factories seem to establish the connection internally (is BEA pooling JMS resources here internally in addition???)
              Does it make any difference using in Constants "thin" or "oci8"?
              The class DipsAQXAQueueConnection and method createXAQueueSession() creates an OracleXAConnection by passing getOCIConnectionPool().getConnection().
              What does this mean? Why OCI? Is the "thin" property working nevertheless?
              Does the DipsStartupClass create ONE Oracle connection to Oracle AQ or do we have to specify somewhere any Oracle pool size?
              What would we have to do if multiple MDB's have to listen to different queues?
              Looks like that we need multiple StartupClasses because of queue_table_name and queue bindings (JNDI AQJMSQueue).
              But what does this mean to the AQXAJMSConnectionFactory?
              Would we have to bind it multiple times under different names (e.g 3 MDB's, 3 factories)?
              How many Oracle AQ DB connections have to be open?
              Is there a new DipsAQXAConnectionFactory / DipsAQConnectionFactory which does all the things internally on the fly so we can deploy MDB's as we would work with BEA JMS (besides StartupClass for the "Referencable" solution)?
              What did you change for your tests the oracle.jms.DipsAQXAQueueSession constructor to? The current sources of JMSBridgesXA Oracle AQ look incompatible with aqapi13.jar (I tried also aqapi.jar and aqapi11.jar)!
              AQjmsSession needs a fith argument java.sql.Connection.
              Shall we call:
              super(aqjc, sessAck, flag, j, oraXAConn.getConnection())
              or
              super(aqjc, sessAck, flag, j, null)
              May be the first (we did that) be the reason of the NON TX behavior if java.sql.Connection is set to AutoCommit by default to true?
              Somewhere in this weblogic.developer.interest.jms forum I read that only Oracle 10g aqapi.jar is XA cabable?
              We have to use Oracle 9.2.0.6 and I defenitly have to use TX's.
              I even would have to get this working:
              1. MDB recieves AQ JMS message
              2. does some business logic
              3. send a JMS message to another queue
              4. commits if 2 and 3 was successful by removing the JMS message from the Oracle AQ.
              However, a MDB rollback MUST ensure, that the received Oracle AQ/JMS message won't be lost.
              With best regards
              Thomas Heiss
              Message was edited by:
              Thomas.Heiss
              Message was edited by:
              Thomas.Heiss

    Dear Eric,
              Thank you very much for your input.
              Unfortunately also a RuntimeException does not rollback/keep the message in AQ queue in our test MDB environment.
              So TX is still some open issue for us.
              Today we made the decision to go with a MapMessage (instead of Oracle custom data type) and do all AQ receive/send stuff manually (because of time running away).
              Meanwhile I also tried Oracle 10g R2 database aqapi13.jar; has a completely different constructor in AQjmsSession which does not seem to be compatible anymore with DipsStartupClass package.
              I wonder how aqapi13.jar from Oracle 10g should work without DipsStartupClass.
              Oracle 10g application server may provide an adapter solution; but I would need to find, check and test it with BEA MDB's first.
              Today we found out, that AQ propagation needs queues defined to be multi_consumer queues.
              Unfortunately settings multi_consumer TRUE and a DEQUEUE (in aqapi13.jar with DipsStartupClass) does not play well together. It's missing a consumer name.
              Then it will only work with recipient list.
              I hope next weeks I will find some Oracle AQ guru which may show me a way out of all this disaster :)
              Regards
              Thomas Heiss

  • JTextArea(Field) & JDropMenu Questions

    I am wondering how to take the values put in by a user into a TextArea(TextField) and a ComboDrop(DropMenu) and have whatever is inserted into them saved into a document using FileWriter/PrintWriter...
    I have the plain textboxes working by using the get text methods and outputFile.println([object]); fine... I just need to know how to incorporate using a text field instead... my teacher mentioned something about using the /n to get multiple lines but I am unclear on the actual code used.
    Also, how to have it recognize what object is selected in a dropmenu and have that object passed to the document saved. (In this case we are making it save all the input information from a patient form to an HTML document-- it is just a mock program for a 101 class).
    Again I have the textboxes identified as strings and used the gettext method to hold the info in them and then the file writer/outputFile/println to send it to a document... just wondering how to do that for a text area and a dropmenu...
    One last question too I am using a Try and Catch method with the IO class(Exception)... but I am using net beans and had to manually import the IO class. My outputFile.Println(); are all tagged in red... is there another class I need to import besides the IO?
    Thanks.

    Check out my RememberData class. This works with comboboxes
    Textfields and TextAreas would be trickier; you'd need to know when to add an entry although if you just wanted to restore the entry on the next start you could just continually save everything or do it on focuslost
    Anyhoo here is RememberData. You are free to use and modify this class but please do not change the package or take credit for it as your own work.
    RememberData.java
    ================
    * Created on Jul 3, 2005 by @author Tom Jacobs
    package tjacobs.io;
    import java.awt.Component;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.*;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipException;
    import java.util.zip.ZipFile;
    import java.util.zip.ZipInputStream;
    import java.util.zip.ZipOutputStream;
    import javax.swing.DefaultListModel;
    import javax.swing.JComboBox;
    import javax.swing.JList;
    import javax.swing.ListModel;
    import javax.swing.MutableComboBoxModel;
    import javax.swing.event.ListDataEvent;
    import javax.swing.event.ListDataListener;
    import javax.swing.event.ListSelectionEvent;
    import javax.swing.event.ListSelectionListener;
    import tjacobs.zip.ZipUpdate;
    public class RememberData implements Runnable {
         private static HashMap<ListModel, JComboBox[]> mComboDependencies = new HashMap<ListModel, JComboBox[]>();
         private static HashMap<ListModel, CommonListDataListener> mModelListeners = new HashMap<ListModel, CommonListDataListener>();
         private static HashMap<ListModel, File> mFileMap = new HashMap<ListModel, File>();
         public static final String FOOTER = "\n\n\n";
         private boolean sWritingToFile = false;
         private static ArrayList<CommonListDataListener> sQueue;
         private boolean sRunning = true;
         private static RememberData sSingleton;
         private static boolean useZip = true;
         private RememberData() {
              super();
         public void run() {
              while (sRunning) {
                   if (sQueue.size() != 0) {
                        CommonListDataListener listener = sQueue.remove(0);
                        listener.saveChanges();
                   else {
                        synchronized (RememberData.class) {
                             try {
                                  RememberData.class.wait();
                             catch (InterruptedException ex) {}
         public void addDependencies(MutableComboBoxModel model, JComboBox[] combos) {
              if (sSingleton == null) {
                   //don't know how this could happen, but it's good just to be paranoid
                   throw new Error("RememberData: Singleton is null");
              mComboDependencies.put(model, combos);
              if (combos != null) {
                   ModelListener l = new ModelListener(model);
                   for (int i = 0; i < combos.length; i++) {
                        combos.addActionListener(l);
         private static class ModelListener implements ActionListener {
              private MutableComboBoxModel mModel;
              public ModelListener(MutableComboBoxModel model) {
                   mModel = model;
              public void actionPerformed(ActionEvent ae) {
                   //disable Listener
                   CommonListDataListener l = mModelListeners.get(mModel);
                   if (l == null) {
                        throw new RuntimeException("model must have listener");
                   JComboBox[] combos = mComboDependencies.get(mModel);
                   File f = mFileMap.get(mModel);
                   mModel.removeListDataListener(l);
                   loadData(mModel, f, combos);
                   mModel.addListDataListener(l);
                   //enable Listener
         public static void RememberData(MutableComboBoxModel model, File f) {
              RememberData(model, f, null);
         public static void RememberData(MutableComboBoxModel model, File base, JComboBox[] dependencies) {
              mFileMap.put(model, base);
              loadData(model, base, dependencies);
              CommonListDataListener l = new CommonListDataListener(model);
              model.addListDataListener(l);
              mModelListeners.put(model, l);
              if (sSingleton == null) {
                   sSingleton = new RememberData();
              sSingleton.addDependencies(model, dependencies);
         private static File getRelativeFile(File f, JComboBox[] dependencies) {
              if (dependencies != null) {
                   String path = f.getAbsolutePath();
                   int idx = path.lastIndexOf(".");
                   String ending = idx == -1 ? "" : path.substring(idx + 1);
                   path = idx == -1 ? path : path.substring(0, idx);
                   StringBuffer sb = new StringBuffer(path);
                   for (int i = 0; i < dependencies.length; i++) {
                        sb.append("-" + dependencies[i].getSelectedItem().toString());
                   f = new File(sb.toString() + ending);
              return f;
         private static void loadData(MutableComboBoxModel model, File f, JComboBox[] dependencies) {
              //create file name
              if (!useZip) {
                   f = getRelativeFile(f, dependencies);
              //test if exists
              if (f.exists()) {
                   try {
                        String s;
                        if (!useZip) {
                             s = IOUtils.loadTextFile(f);
                        else {
                             ZipFile zip = new ZipFile(f);
                             ZipEntry entry = zip.getEntry(getRelativeFile(f, dependencies).toString());
                             s = IOUtils.loadAllString(zip.getInputStream(entry));
                        int size = model.getSize();
                        for (int i = 0; i < size; i++) {
                             model.removeElementAt(0);
                        LineNumberReader lnr = new LineNumberReader(new StringReader(s));
                        lnr.readLine();
                        String line;
                        while ((line = lnr.readLine()) != null) {
                             model.addElement(line);
                   catch (IOException iox) {
                        iox.printStackTrace();
         private static String getHeader(Component c) {
              String name = c.getName();
              return c.getClass().getName() + " " + (name == null ? "Unnamed" : name) + "\n";
         public synchronized static void addToQueue(CommonListDataListener l) {
              if (sQueue == null) {
                   sQueue = new ArrayList<CommonListDataListener>();
              sQueue.remove(l);
              sQueue.add(l);
              if (sSingleton == null) {
                   sSingleton = new RememberData();
                   Thread t = new Thread(sSingleton, "Remember Data Thread");
                   t.setPriority(Thread.MIN_PRIORITY);
                   t.start();
              } else {
                   RememberData.class.notify();
         private static class CommonListDataListener implements ListDataListener {
              private DefaultListModel mModel;
              private MutableComboBoxModel mComboModel;
              private ListDataEvent ev;
              public CommonListDataListener(DefaultListModel model) {
                   mModel = model;
              public CommonListDataListener(MutableComboBoxModel model) {
                   mComboModel = model;
              public void contentsChanged(ListDataEvent ev) {
                   this.ev = ev;
                   addToQueue(this);
              public void intervalAdded(ListDataEvent ev) {
                   this.ev = ev;
                   addToQueue(this);
              public void intervalRemoved(ListDataEvent ev) {
                   this.ev = ev;
                   addToQueue(this);
              void saveChanges() {
                   File file = mFileMap.get(mModel);
                   JComboBox[] dependencies = mComboDependencies.get(mModel);
                   PrintWriter pw = null;
                   try {
                        if (!useZip) {
                             file = getRelativeFile(file, dependencies);
                             pw = new PrintWriter(new FileWriter(file));
                             String contents = null;
                             contents = getSaveString();
                             pw.print(contents);
                             pw.close();
                        else {
                             ZipUpdate.update(file.getPath(), getRelativeFile(file, dependencies).toString());
                   catch (IOException iox) {
                        iox.printStackTrace();
              public boolean equals (Object o) {
                   if (o instanceof CommonListDataListener) {
                        CommonListDataListener lis = (CommonListDataListener) o;
                        return lis.mModel == mModel;
                   return false;
              private String getSaveString() {
                   StringBuilder sb = new StringBuilder();
                   if (mModel != null) {
                        int size = mModel.getSize();
                        for (int i = 0; i < size; i++) {
                             if (i != 0) {
                                  sb.append('\n');
                             sb.append(mModel.getElementAt(i).toString());
                        return sb.toString();
                   //else
                   int size = mComboModel.getSize();
                   for (int i = 0; i < size; i++) {
                        if (i != 0) {
                             sb.append('\n');
                        sb.append(mComboModel.getElementAt(i).toString());
                   return sb.toString();

  • RuntimeException - Transaction Rollback

              Hi,
              I am using weblogic 6.1 on WINDOWS platform..
              hv few questions on Container Managed Transactions:
              1. What is the Bean-default transaction attribute
              (If I don't specify any transaction attribute for
              one of the method in SLSB).
              2. Does Weblogic container rollbacks transaction for any
              RuntimeException that has been thrown from Business
              method OR only for EJBException.
              3. What are the pros and cons of Specifying a Transaction
              attribute for a Business method that only executes
              SELECT statements.
              4. if I want to manage my trasaction explicitly using
              USerTransaction (Client Demarcated) do I hv control
              over Distributed transactions.
              thx,
              Ramesh
              

    Ramesh <[email protected]> wrote:
              > Hi,
              > I am using weblogic 6.1 on WINDOWS platform..
              > hv few questions on Container Managed Transactions:
              > 1. What is the Bean-default transaction attribute
              > (If I don't specify any transaction attribute for
              > one of the method in SLSB).
              I think the default is 'Supports'
              > 2. Does Weblogic container rollbacks transaction for any
              > RuntimeException that has been thrown from Business
              > method OR only for EJBException.
              Yes. There is a table in the 'Exception Handing' section of the EJB
              spec which describes what happens when bean methods throw various
              exceptions.
              > 3. What are the pros and cons of Specifying a Transaction
              > attribute for a Business method that only executes
              > SELECT statements.
              At the very least it wil decrease number of ejbLoad()'s if you
              use Entity Beans.
              > 4. if I want to manage my trasaction explicitly using
              > USerTransaction (Client Demarcated) do I hv control
              > over Distributed transactions.
              > thx,
              > Ramesh
              Dimitri
              

  • System.out vs System.err questions

    Hello,
    System.out and System.err both seem to direct regular and error output to the stdout. I have the following questions:
    1. I used System.setOut() to direct regular output to "Output.txt" and System.setErr() to direct errors to "Errors.txt". I purposely made the program to throw some exceptions, wanting to redirect them to "Errors.txt". It did not work. My question is "What kind of errors setErr() would direct to an error file?"
    2. Without using setErr(), errors go to stdout. My question is "Does Java hava a configuration file I can configue to direct regular output to stdout, but errors to a user-defined file such as errors.log?"
    Thanks!

    I see the stack trace in file err.txt:
    import java.io.*;
    public class Example {
        public static void main(String[] args) throws FileNotFoundException {
            System.setOut(new PrintStream(new FileOutputStream("out.txt"), true));
            System.setErr(new PrintStream(new FileOutputStream("err.txt"), true));
            System.out.println("<stdout>");
            System.err.println("<stderr>");
            throw new RuntimeException("here we go");
    }

  • CMP EJB lifecycle questions

    Specs say, "RuntimeException thrown from a create method of the bean class results
    in transition to a "does not exist" state and the container must not invoke any
    method on the instance after a Runtimeexception has been caught"
    When and how does weblogic ultimately dispose off that bean? Does it hog up an
    "active bean" from the pool meanwhile ? Does it cause a "leak" ?
    Can we turn off the stack trace for application exceptions re-thrown by the container?
    If the container doesn't maintain a pool for beans (max_beans_in_cache=0), then
    is the number of instances that can be active unlimited or limited only by memory
    available ? (in short can I turn cache off?)
    are the objects returned by Finder methods activated by the weblogic container
    which commit strategy is used by weblogic (from spec --> optionA optionB or optionC
    or another one )?

    Chetan Desai wrote:
    Specs say, "RuntimeException thrown from a create method of the bean class results
    in transition to a "does not exist" state and the container must not invoke any
    method on the instance after a Runtimeexception has been caught"Yes
    >
    When and how does weblogic ultimately dispose off that bean?It becomes garbage and will be collected by gc.
    Does it hog up an
    "active bean" from the pool meanwhile ?No
    Does it cause a "leak" ?
    No
    >
    Can we turn off the stack trace for application exceptions re-thrown by the container?
    The container logs system exceptions. It does not log application exceptions.
    >
    If the container doesn't maintain a pool for beans (max_beans_in_cache=0), thenmax-beans-in-pool equal to 0 or max-beans-in-cache = 0?
    >
    is the number of instances that can be active unlimited or limited only by memory
    available ? (in short can I turn cache off?)Are you trying to turn max-beans-in-cache off? I don't understand the question or what
    you're trying to achieve?
    >
    are the objects returned by Finder methods activated by the weblogic container
    By default, CMP beans will prefetch the associated data. You can disable this by turning
    finders-load-beans to false, but this is usually a bad idea.
    >
    which commit strategy is used by weblogic (from spec --> optionA optionB or optionC
    or another one )?All 3 are possible. I'd suggest that you take a look at the documentation for the
    Database and Exclusive concurrency options.
    There are also Read-Only entity beans.
    -- Rob
    AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
    by Michael Girdley, Rob Woollen, and Sandra Emerson
    http://learnWebLogic.com
    [att1.html]

  • MulticastSocket Multicast socket receive error: java.lang.RuntimeException: I/O error opening JAR file from file:/D:/weblogic/mycluster/server86/tmp_deployments/ejbjar-17327.jar

    Hi,
              I need some help.
              Product=weblogic5.1.0
              Revision=(Release Level)=
              Problem Description=
              I am doing cluster of weblogic server, I have no problem to set up the
              cluster and to run servlet and EJB examples.
              However, on my command line for startcluster I got a lot of message as
              followed:
              Fri Aug 18 11:31:44 EDT 2000:<E> <MulticastSocket> Multicast socket receive
              error: java.lang.RuntimeException: I/O error opening JAR file from
              file:/D:/weblogic/mycluster/server86/tmp_deployments/ejbjar-17327.jar
              java.util.zip.ZipException: error in opening zip file
              at java.util.zip.ZipFile.open(Native Method)
              at java.util.zip.ZipFile.<init>(ZipFile.java, Compiled Code)
              at java.util.zip.ZipFile.<init>(ZipFile.java, Compiled Code)
              at weblogic.boot.ServerClassLoader.deploy(ServerClassLoader.java,
              Compiled Code)
              at
              weblogic.cluster.AnnotatedServiceOffer.expandClassPath(AnnotatedServiceOffer
              .java, Compiled Code)
              at
              weblogic.cluster.AnnotatedServiceOffer.readObject(AnnotatedServiceOffer.java
              , Compiled Code)
              at
              weblogic.common.internal.WLObjectInputStreamBase.readPublicSerializable(WLOb
              jectInputStreamBase.java, Compiled Co
              de)
              at
              weblogic.common.internal.WLObjectInputStreamBase.readLeftover(WLObjectInputS
              treamBase.java, Compiled Code)
              at
              weblogic.common.internal.WLObjectInputStreamBase.readObjectBody(WLObjectInpu
              tStreamBase.java, Compiled Code)
              at
              weblogic.common.internal.WLObjectInputStreamBase.readObject(WLObjectInputStr
              eamBase.java, Compiled Code)
              at
              weblogic.common.internal.WLObjectInputStreamBase.readObjectWL(WLObjectInputS
              treamBase.java, Compiled Code)
              at
              weblogic.common.internal.WLObjectInputStreamBase.readArrayList(WLObjectInput
              StreamBase.java, Compiled Code)
              at weblogic.cluster.StateDump.readObject(StateDump.java, Compiled
              Code)
              at
              weblogic.common.internal.WLObjectInputStreamBase.readPublicSerializable(WLOb
              jectInputStreamBase.java, Compiled Co
              de)
              at
              weblogic.common.internal.WLObjectInputStreamBase.readLeftover(WLObjectInputS
              treamBase.java, Compiled Code)
              at
              weblogic.common.internal.WLObjectInputStreamBase.readObjectBody(WLObjectInpu
              tStreamBase.java, Compiled Code)
              at
              weblogic.common.internal.WLObjectInputStreamBase.readObject(WLObjectInputStr
              eamBase.java, Compiled Code)
              at
              weblogic.common.internal.WLObjectInputStreamBase.readObjectWL(WLObjectInputS
              treamBase.java, Compiled Code)
              at weblogic.cluster.TMSocket.execute(TMSocket.java, Compiled Code)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
              Code)
              The message freshed about every 20 seconds.
              Another question, I used a iplanet web server as a proxy server with a
              cluster of two weblogic servers pluged in, although I set
              weblogic.properties to round-robin, however, when I run a fibonacci servlet,
              it does not do the round-robin. It always go to one machine for a lot of
              times. Any idea?
              Thank you for your help.
              Tom
              

    May i presume that your cluster is configured on a shared file system?.
              I have seen this problem only if you cluster is configured on different machines
              and if the directory structure is not identical.
              let us know..
              Kumar
              Cameron Purdy wrote:
              > First, update to SP4 (or SP5 if it is out now). Second, follow the cluster
              > instructions on setting up deployments for a cluster. The only
              > implementation that I have used is the single shared location that all the
              > servers load from.
              >
              > --
              >
              > Cameron Purdy
              > http://www.tangosol.com
              >
              > "Tom Gan" <[email protected]> wrote in message
              > news:[email protected]...
              > > Hi,
              > > I need some help.
              > >
              > > Product=weblogic5.1.0
              > > Revision=(Release Level)=
              > > Problem Description=
              > > I am doing cluster of weblogic server, I have no problem to set up the
              > > cluster and to run servlet and EJB examples.
              > > However, on my command line for startcluster I got a lot of message as
              > > followed:
              > > Fri Aug 18 11:31:44 EDT 2000:<E> <MulticastSocket> Multicast socket
              > receive
              > > error: java.lang.RuntimeException: I/O error opening JAR file from
              > > file:/D:/weblogic/mycluster/server86/tmp_deployments/ejbjar-17327.jar
              > > java.util.zip.ZipException: error in opening zip file
              > > at java.util.zip.ZipFile.open(Native Method)
              > > at java.util.zip.ZipFile.<init>(ZipFile.java, Compiled Code)
              > > at java.util.zip.ZipFile.<init>(ZipFile.java, Compiled Code)
              > > at weblogic.boot.ServerClassLoader.deploy(ServerClassLoader.java,
              > > Compiled Code)
              > > at
              > >
              > weblogic.cluster.AnnotatedServiceOffer.expandClassPath(AnnotatedServiceOffer
              > > .java, Compiled Code)
              > > at
              > >
              > weblogic.cluster.AnnotatedServiceOffer.readObject(AnnotatedServiceOffer.java
              > > , Compiled Code)
              > > at
              > >
              > weblogic.common.internal.WLObjectInputStreamBase.readPublicSerializable(WLOb
              > > jectInputStreamBase.java, Compiled Co
              > > de)
              > > at
              > >
              > weblogic.common.internal.WLObjectInputStreamBase.readLeftover(WLObjectInputS
              > > treamBase.java, Compiled Code)
              > > at
              > >
              > weblogic.common.internal.WLObjectInputStreamBase.readObjectBody(WLObjectInpu
              > > tStreamBase.java, Compiled Code)
              > > at
              > >
              > weblogic.common.internal.WLObjectInputStreamBase.readObject(WLObjectInputStr
              > > eamBase.java, Compiled Code)
              > > at
              > >
              > weblogic.common.internal.WLObjectInputStreamBase.readObjectWL(WLObjectInputS
              > > treamBase.java, Compiled Code)
              > > at
              > >
              > weblogic.common.internal.WLObjectInputStreamBase.readArrayList(WLObjectInput
              > > StreamBase.java, Compiled Code)
              > > at weblogic.cluster.StateDump.readObject(StateDump.java, Compiled
              > > Code)
              > > at
              > >
              > weblogic.common.internal.WLObjectInputStreamBase.readPublicSerializable(WLOb
              > > jectInputStreamBase.java, Compiled Co
              > > de)
              > > at
              > >
              > weblogic.common.internal.WLObjectInputStreamBase.readLeftover(WLObjectInputS
              > > treamBase.java, Compiled Code)
              > > at
              > >
              > weblogic.common.internal.WLObjectInputStreamBase.readObjectBody(WLObjectInpu
              > > tStreamBase.java, Compiled Code)
              > > at
              > >
              > weblogic.common.internal.WLObjectInputStreamBase.readObject(WLObjectInputStr
              > > eamBase.java, Compiled Code)
              > > at
              > >
              > weblogic.common.internal.WLObjectInputStreamBase.readObjectWL(WLObjectInputS
              > > treamBase.java, Compiled Code)
              > > at weblogic.cluster.TMSocket.execute(TMSocket.java, Compiled Code)
              > > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
              > > Code)
              > >
              > > The message freshed about every 20 seconds.
              > >
              > > Another question, I used a iplanet web server as a proxy server with a
              > > cluster of two weblogic servers pluged in, although I set
              > > weblogic.properties to round-robin, however, when I run a fibonacci
              > servlet,
              > > it does not do the round-robin. It always go to one machine for a lot of
              > > times. Any idea?
              > > Thank you for your help.
              > > Tom
              > >
              > >
              > >
              

  • Multicast socket receive error: java.lang.RuntimeException: I/O error opening JAR file from file:/D:/weblogic/mycluster/server86/tmp_deployments/ejbjar-17327.jar

    Hi,
    I need some help.
    Product=weblogic5.1.0
    Revision=(Release Level)=
    Problem Description=
    I am doing cluster of weblogic server, I have no problem to set up the
    cluster and to run servlet and EJB examples.
    However, on my command line for startcluster I got a lot of message as
    followed:
    Fri Aug 18 11:31:44 EDT 2000:<E> <MulticastSocket> Multicast socket receive
    error: java.lang.RuntimeException: I/O error ope
    ning JAR file from
    file:/D:/weblogic/mycluster/server86/tmp_deployments/ejbjar-17327.jar
    java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java, Compiled Code)
    at java.util.zip.ZipFile.<init>(ZipFile.java, Compiled Code)
    at weblogic.boot.ServerClassLoader.deploy(ServerClassLoader.java,
    Compiled Code)
    at
    weblogic.cluster.AnnotatedServiceOffer.expandClassPath(AnnotatedServiceOffer
    .java, Compiled Code)
    at
    weblogic.cluster.AnnotatedServiceOffer.readObject(AnnotatedServiceOffer.java
    , Compiled Code)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readPublicSerializable(WLOb
    jectInputStreamBase.java, Compiled Co
    de)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readLeftover(WLObjectInputS
    treamBase.java, Compiled Code)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readObjectBody(WLObjectInpu
    tStreamBase.java, Compiled Code)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readObject(WLObjectInputStr
    eamBase.java, Compiled Code)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readObjectWL(WLObjectInputS
    treamBase.java, Compiled Code)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readArrayList(WLObjectInput
    StreamBase.java, Compiled Code)
    at weblogic.cluster.StateDump.readObject(StateDump.java, Compiled
    Code)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readPublicSerializable(WLOb
    jectInputStreamBase.java, Compiled Co
    de)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readLeftover(WLObjectInputS
    treamBase.java, Compiled Code)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readObjectBody(WLObjectInpu
    tStreamBase.java, Compiled Code)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readObject(WLObjectInputStr
    eamBase.java, Compiled Code)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readObjectWL(WLObjectInputS
    treamBase.java, Compiled Code)
    at weblogic.cluster.TMSocket.execute(TMSocket.java, Compiled Code)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
    Code)
    The message freshed about every 20 seconds.
    Another question, I used a iplanet web server as a proxy server with a
    cluster of two weblogic servers pluged in, although I set
    weblogic.properties to round-robin, however, when I run a fibonacci servlet,
    it does not do the round-robin. It always go to one machine for a lot of
    times. Any idea?
    Thank you for your help.
    Tom

    Hi,
    I need some help.
    Product=weblogic5.1.0
    Revision=(Release Level)=
    Problem Description=
    I am doing cluster of weblogic server, I have no problem to set up the
    cluster and to run servlet and EJB examples.
    However, on my command line for startcluster I got a lot of message as
    followed:
    Fri Aug 18 11:31:44 EDT 2000:<E> <MulticastSocket> Multicast socket receive
    error: java.lang.RuntimeException: I/O error ope
    ning JAR file from
    file:/D:/weblogic/mycluster/server86/tmp_deployments/ejbjar-17327.jar
    java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java, Compiled Code)
    at java.util.zip.ZipFile.<init>(ZipFile.java, Compiled Code)
    at weblogic.boot.ServerClassLoader.deploy(ServerClassLoader.java,
    Compiled Code)
    at
    weblogic.cluster.AnnotatedServiceOffer.expandClassPath(AnnotatedServiceOffer
    .java, Compiled Code)
    at
    weblogic.cluster.AnnotatedServiceOffer.readObject(AnnotatedServiceOffer.java
    , Compiled Code)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readPublicSerializable(WLOb
    jectInputStreamBase.java, Compiled Co
    de)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readLeftover(WLObjectInputS
    treamBase.java, Compiled Code)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readObjectBody(WLObjectInpu
    tStreamBase.java, Compiled Code)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readObject(WLObjectInputStr
    eamBase.java, Compiled Code)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readObjectWL(WLObjectInputS
    treamBase.java, Compiled Code)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readArrayList(WLObjectInput
    StreamBase.java, Compiled Code)
    at weblogic.cluster.StateDump.readObject(StateDump.java, Compiled
    Code)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readPublicSerializable(WLOb
    jectInputStreamBase.java, Compiled Co
    de)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readLeftover(WLObjectInputS
    treamBase.java, Compiled Code)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readObjectBody(WLObjectInpu
    tStreamBase.java, Compiled Code)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readObject(WLObjectInputStr
    eamBase.java, Compiled Code)
    at
    weblogic.common.internal.WLObjectInputStreamBase.readObjectWL(WLObjectInputS
    treamBase.java, Compiled Code)
    at weblogic.cluster.TMSocket.execute(TMSocket.java, Compiled Code)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
    Code)
    The message freshed about every 20 seconds.
    Another question, I used a iplanet web server as a proxy server with a
    cluster of two weblogic servers pluged in, although I set
    weblogic.properties to round-robin, however, when I run a fibonacci servlet,
    it does not do the round-robin. It always go to one machine for a lot of
    times. Any idea?
    Thank you for your help.
    Tom

Maybe you are looking for

  • So I had an engineer visit and I'm not happy

    Following on from my is the speedtester up the swanny thread Today I had a visit from an OR engineer. He called before he attended which was very good of him. He read the results on the above thread, looked at all the other screenies I've kept and al

  • Trying to use the Tour 9630 with Outlook 2003 Calendar, Memo/Notes & Tasks. Can't Config & Complete....

    I would like to use my Outlook 2003 with my Blackberry Tour 9630 to use the Calendar, Memo & Task features instead of entering everything on the BB. I use my Outlook Express 6 for my email input and output. The Outlook 2003 is not connected to the in

  • Possible for Oracle to consider constraints when using bind variable?

    Consider the following table with a check constraint listing the possible values of the column create table TEST_TABLE( my_column varchar2(10)); insert into TEST_TABLE select 'VALUE1' from dba_objects; alter table TEST_TABLE add constraint TEST_TABLE

  • How to uninstall windows messenger

    Hi I installed microsoft office for mac (home and student version) in my macbook with mountain lion, windows messenger was included but i don't want messenger so i will uninstall it, i know a way to uninstall it is to drag an app from app's folder to

  • Missing GPU Acceleration

    Hey guys, I can't get PremPro CS6 to see my AMD FirePro D300 2048 MB card. I have a new Mac pro running Nvidia CUDA Driver Version: 6.0.46  I've installed CS6 and its all working great apart from the fact it won't recognise my graphics card. Its runn