RuntimeException-LateBound/EarlyBound example

Hi
I have tried to run the late bound and early bound examples,but in the process
when iam running the RunLateBoundSingleMachine.bat
RunEarlyBoundSingleMachine.bat,iam getting a runtime exception with the following
message:
Error Message
java.lang.RuntimeException: In order to use the jCOM runtime a valid WebLogic
Server product license must be present. I
f you have a license but the jCOM runtime cannot detect it, please contact [email protected]
Exception in thread "main" java.lang.ExceptionInInitializerError: java.lang.RuntimeException:
In order to use the jCOM r
untime a valid WebLogic Server product license must be present. If you have a
license but the jCOM runtime cannot detec
t it, please contact [email protected]
at com.bea.jcom.LicenseImpl.check(LicenseImpl.java)
at com.bea.jcom.Dispatch.d(Dispatch.java)
at com.bea.jcom.Dispatch.<clinit>(Dispatch.java)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:120)
at com.bea.jcom.Jvm.b(Jvm.java)
at com.bea.jcom.Jvm.<clinit>(Jvm.java)
at JCOMBridge.main(JCOMBridge.java:27)
Could somebody throw some light if we do require a weblogic license for these
examples to run?
Your help is appreciated.
Nandula Balasbramanyam

Hi Damon,
I have the filelist in C:\bea and the directory that is pointing is F:\WebL6.1.Iam
currently running both Jcom bridge and WLS in the same machine.I have written
the same to the support team as well.
Thanks
Nandula
"Damon Hon" <[email protected]> wrote:
hi Nandula,
The jCOM runtime is looking for a valid license.bea file. The beahomelist
file
contains the list of directories where it would look for this license
file.
So if
the directory F:\WebL6.1\ is in your beahomelist file and there a valid
license
is located at F:\WebL6.1\license.bea, jCOM will find it.
Are you running the jCOM Bridge on the same machine as your WLS? Currently
jCOM does not support running the jCOM Bridge on a separate machine.
thanks
damon
"NANDULA BALASUBRAMANYAM" <[email protected]> wrote
in
message news:[email protected]...
Hi Damon,
I do have this file under c:\bea.
Well can you tell me if i have to include something in that file ifthe
example
needs to run
Thanks
Nandula
"Damon Hon" <[email protected]> wrote:
hi Nandula,
is there a beahomelist file in c:\bea?
if not, please move the beahomelist file to that directory.
thanks
damon
"Nandula Balasubramanyam" <[email protected]> wrote
in
message news:[email protected]...
Hi Damon,
I have a valid license for weblogic 6.1 now.My installation directoryis
in F
drive (F:\WebL6.1\wlserver6.1).Yet iam unable to run this example.Theerror iam
getting is the same.How do we solve this problem?
Thanks
Nandula
"Damon Hon" <[email protected]> wrote:
hi Nandula,
WebLogic jCOM requires a valid 6.1 license in order to run.
what is your WLS installation directory?
thanks
damon
"Nandula Balasubramanyam" <[email protected]>
wrote
in
message news:[email protected]...
Hi
I have tried to run the late bound and early bound examples,but
in
the
process
when iam running the RunLateBoundSingleMachine.bat
RunEarlyBoundSingleMachine.bat,iam getting a runtime exception
with
the
following
message:
Error Message
java.lang.RuntimeException: In order to use the jCOM runtime
a valid
WebLogic
Server product license must be present. I
f you have a license but the jCOM runtime cannot detect it, pleasecontact
[email protected].
Exception in thread "main" java.lang.ExceptionInInitializerError:java.lang.RuntimeException:
In order to use the jCOM r
untime a valid WebLogic Server product license must be present.
If
you
have a
license but the jCOM runtime cannot detec
t it, please contact [email protected].
at com.bea.jcom.LicenseImpl.check(LicenseImpl.java)
at com.bea.jcom.Dispatch.d(Dispatch.java)
at com.bea.jcom.Dispatch.<clinit>(Dispatch.java)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:120)
at com.bea.jcom.Jvm.b(Jvm.java)
at com.bea.jcom.Jvm.<clinit>(Jvm.java)
at JCOMBridge.main(JCOMBridge.java:27)
Could somebody throw some light if we do require a weblogic licensefor
these
examples to run?
Your help is appreciated.
Nandula Balasbramanyam

Similar Messages

  • Help using jCOM with a WLS6.1 server talking to a COM server instead of an VB/COM client

    Hi all,
    I successfully ran the BEA's EarlyBound example that has a VB Client talking to
    WLS6.1 Server via JIntegra. However, I been unsuccessful in trying to find an
    example that has WLS talking to the jCOM bridge to the Wrapper to a COM Server.
    How can I use the jCOM/jIntegra tools to reverse the EarlyBound example, if possible,
    and have an EJB talk to a "Wrapped" COM Server?

    To use GPO multitimbrally, first you create a new multi instrument and cable it directly into the audio instrument into which you've loaded GPO. Let's say it's audio instrument #1. The crucial next step is to set audio instrument 1's MIDI channel to ALL (done via the parameters section on the LH side of the screen).
    Next, name the multi something like GPO ( LOL ) and click on channels 1 - 8 on that multi-instrument in order to activate them. From this point on, instead of selecting Audio Instrument #1 in your arrange window, you select "GPO" (on whatever channel you want, in this case, 1 - 8).
    Message was edited by: iSchwartz

  • Problems with JCOM examples

    Sorry for my poor English:-)
    I am a beginner in learning Weblogic Platform(Weblogic Platform7.0 with sp2),and
    now I'm studying the JCOM examples.
    Everything goes on well in the examples of "zeroclient" and "latebound",but there's
    a problem in "earlybound".
    I have succeeded in registering the type library and setting JVM (cmdline:"regtlb
    containerManagedTLB.tlb examplesServer"),and I can find "containerManagedTLB"
    in References of Visual Basic.
    In a word,I think all preparation work is completed.
    But there is a fault when it runs at the line "Set mobjHome = objNarrow.narrow(objTemp,
    "examples.ejb20.basic.containerManaged.AccountHome")".
    =============Let's look at the source code:===================
    Dim mobjHome As containerManagedTLB.ExamplesEjb20BasicContainerManagedAccountHome
    Dim objTemp As Object
    Dim objNarrow As New containerManagedTLB.JCOMHelper
    Set objTemp =
    CreateObject("examplesServer:jndi:ejb20-containerManaged-AccountHome") -->code
    run correctly here
    Set mobjHome =
    objNarrow.narrow(objTemp, "examples.ejb20.basic.containerManaged.AccountHome")-->this
    line is wrong
    ===============================================================
    I don't know where is the problem,and it makes me very painful!
    I need your help,thanks a lot!

    Sorry for my poor English:-)
    I am a beginner in learning Weblogic Platform(Weblogic Platform7.0 with sp2),and
    now I'm studying the JCOM examples.
    Everything goes on well in the examples of "zeroclient" and "latebound",but there's
    a problem in "earlybound".
    I have succeeded in registering the type library and setting JVM (cmdline:"regtlb
    containerManagedTLB.tlb examplesServer"),and I can find "containerManagedTLB"
    in References of Visual Basic.
    In a word,I think all preparation work is completed.
    But there is a fault when it runs at the line "Set mobjHome = objNarrow.narrow(objTemp,
    "examples.ejb20.basic.containerManaged.AccountHome")".
    =============Let's look at the source code:===================
    Dim mobjHome As containerManagedTLB.ExamplesEjb20BasicContainerManagedAccountHome
    Dim objTemp As Object
    Dim objNarrow As New containerManagedTLB.JCOMHelper
    Set objTemp =
    CreateObject("examplesServer:jndi:ejb20-containerManaged-AccountHome") -->code
    run correctly here
    Set mobjHome =
    objNarrow.narrow(objTemp, "examples.ejb20.basic.containerManaged.AccountHome")-->this
    line is wrong
    ===============================================================
    I don't know where is the problem,and it makes me very painful!
    I need your help,thanks a lot!

  • What can be done to make these code examples work on web Browsers?

    I have tried numerous versions of ?Hello World? examples over the web to display the text on a web page. All the examples work on my local machine in the application viewer, but they don?t work when from a web browser. I have tried both Firefox and IE.
    Some of them include:
    [http://java.sun.com/docs/books/tutorial/uiswing/examples/start/HelloWorldSwingProject/src/start/HelloWorldSwing.java|http://java.sun.com/docs/books/tutorial/uiswing/examples/start/HelloWorldSwingProject/src/start/HelloWorldSwing.java]
    Firefox error:
    java.lang.reflect.InvocationTargetException
         at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.ClassCastException: start.HelloWorldSwing cannot be cast to java.applet.Applet
         at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
         at java.awt.event.InvocationEvent.dispatch(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Exception: java.lang.reflect.InvocationTargetException [http://en.wikipedia.org/wiki/Swing_%28Java%29|http://en.wikipedia.org/wiki/Swing_%28Java%29]
    Error when viewed on Firefox:
    java.lang.reflect.InvocationTargetException
         at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.ClassCastException: start.SwingExample cannot be cast to java.applet.Applet
         at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
         at java.awt.event.InvocationEvent.dispatch(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Exception: java.lang.reflect.InvocationTargetException An Ideal Code if someone could decipher why it fails from a browser is:
    import javax.swing.*;
    public class SwingHelloWorld extends JFrame {
        public SwingHelloWorld(String name) {
          super(name);
          this.setDefaultCloseOperation(EXIT_ON_CLOSE);
          JLabel label = new JLabel(name);
          // label.setPreferredSize(new Dimension(210, 80));
          this.getContentPane().add(label);
          this.pack();
          this.setVisible(true);
      public static void main(String argv[]) {
            SwingHelloWorld swingHelloWorld = new SwingHelloWorld("This would be great if it worked via a browser!");
    } Error from Firefox:
    java.lang.reflect.InvocationTargetException
         at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.RuntimeException: java.lang.InstantiationException: start.SwingHelloWorld
         at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
         at java.awt.event.InvocationEvent.dispatch(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.lang.InstantiationException: start.SwingHelloWorld
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         ... 9 more
    Exception: java.lang.reflect.InvocationTargetException The latter code is very short and would serve the intended purpose most ideal. It can accept input and allow me to replace the ?System.out.println? function that works so well to display when working with code in the development environment.
    Thanks in advance for any input on this.
    -- L. James
    L. D. James
    Edited by: apollothethird on Mar 8, 2010 5:05 AM

    paulcw wrote:
    As per your suggestion, I changed the &#147;extend&#148; to Applet and changed it to &#147;JApplet&#148;. Making that change will result in code that won?t even compile.Right. You're going to have to change your program to actually work as an applet.
    Either that or use Java Web Start, which is probably the best option.Thanks. The code I presented was my attempt to find examples that represented the advice I thought I was getting (to use JFrame and JLabels). I?m changing the direction of the examples I?m looking for now.
    >
    The current code as published by sun.com actually compiles and displays in the Netbeans programming environment. It looks great. But I?m kind of stuck with the missing link for making it output to the browser.Different things work in different ways. You wrote a standalone application which compiles and runs. Writing an applet is a different thing, and works in a different way. Read the applet tutorials for more information on applet methods and the applet lifecycle.Thanks. I?m reading. I try to execute some of the examples from my reading, but and stuck. So, I?m asking for some clarifications of some of the components I?m stuck with. Having some of my questions answered would help me to understand better the lots of reading and studying that I?m doing.
    I?m taking in all the advice that is given, and I appreciate it a lot.
    >
    Thanks for the hints. Thanks also in advance if you happen to know how to change the extend to Applet or JApplet instead of &#147;JFrame&#148; and it works.This is made clear in the applet tutorials. It's more than just changing the class to extend. Note that Applet/JApplet extends Panel/JPanel, so that changes the way your program is constructed. Basically, you don't have to create your own frame.Also, I don?t want a frame. I?m trying to find a way to make my question clear. I appreciate the time you?re taking to respond to a new user?s scope.
    >
    But again, web start is probably a better choice if you have a running app.
    You should probably abandon the idea that you just have to nudge a program slightly in a new direction to make a wholly new thing. Programming is all about reducing complex problems to a set of concrete solutions.Absolutely. I have some examples that will actually print a string to a browser. However, those examples will print what?s written in the immediate code, with no apparent method (that I can) make into a variable. The ?Hello World? example that I find that has a main class is the ones that are failing. The ones that don?t have a main class will print.
    I have been trying to find a way to pass a variable to this code that will print over the web:
    import javax.swing.JApplet;
    import javax.swing.SwingUtilities;
    import javax.swing.JLabel;
    public class HelloWorld extends JApplet {
        //Called when this applet is loaded into the browser.
        public void init() {
            //Execute a job on the event-dispatching thread; creating this applet's GUI.
            try {
                SwingUtilities.invokeAndWait(new Runnable() {
                    public void run() {
                        JLabel lbl = new JLabel("Hello World");
                        add(lbl);
            } catch (Exception e) {
                System.err.println("createGUI didn't complete successfully");
    }However when I try to add a functioning main class and change the ?Hello World? to a string variable, it fails. I understand it fails because I?m having a missing link about how to turn the class into something that can take input.
    I know I?ll be ridiculed for the example I?m about to print, but I?m printing it to give an example of having a variable for my output.
    Look at the code that fails (just to get an idea of what I?m trying to explain):
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package test1;
    * @author teama
    import javax.swing.JApplet;
    import javax.swing.SwingUtilities;
    import javax.swing.JLabel;
    public class HelloWorld extends JApplet {
        //Called when this applet is loaded into the browser.
        public void init() {
            //Execute a job on the event-dispatching thread; creating this applet's GUI.
            try {
                SwingUtilities.invokeAndWait(new Runnable() {
                    public void run(String myhello) {
                        JLabel lbl = new JLabel(myhello);
                        add(lbl);
            } catch (Exception e) {
                System.err.println("createGUI didn't complete successfully");
            public static void main(String[] args) {
                // This is the output of my calculation
                // HelloWorld.void("Hello World")
                run("My Hello")               
    } -- L. James
    L. D. James

  • Init error while tryign to start WLS 8.1 after installing/building the authorization provider example usign RDBMS

    I am trying to run the Authentication Security provider example (http://dev2dev.bea.com/codelibrary/code/sec_rdbms.jsp)
    in a WLS 8.1 environment. Followed the steps listed in the readme file to get
    this installed. After creating the domain and building the example using ant,
    when I try to restart the WLS, I get a:
    <Nov 24, 2003 10:31:19 AM CST> <Info> <WebLogicServer> <BEA-000377> <Starting
    We
    bLogic Server with Java HotSpot(TM) Client VM Version 1.4.1_03-b02 from Sun Micr
    osystems Inc.>
    <Nov 24, 2003 10:31:19 AM CST> <Info> <Configuration Management> <BEA-150016>
    <T
    his server is being started as the administration server.>
    <Nov 24, 2003 10:31:19 AM CST> <Info> <Management> <BEA-141107> <Version: WebLog
    ic Server 8.1 SP1 Fri Jun 20 23:06:40 PDT 2003 271009
    WebLogic XMLX Module 8.1 SP1 Fri Jun 20 23:06:40 PDT 2003 271009>
    <Nov 24, 2003 10:31:19 AM CST> <Notice> <Management> <BEA-140005> <Loading domai
    n configuration from configuration repository at C:\bea\user_projects\domains\au
    thrdbms\.\config.xml.>
    <Nov 24, 2003 10:31:21 AM CST> <Notice> <Log Management> <BEA-170019> <The serve
    r log file C:\bea\user_projects\domains\authrdbms\myserver\myserver.log is opene
    d. All server side log events will be written to this file.>
    <Nov 24, 2003 10:31:23 AM CST> <Critical> <WebLogicServer> <BEA-000364> <Server
    failed during initialization. Exception:javax.management.RuntimeOperationsExcept
    ion: RuntimeException thrown by the invoke method of the Dynamic MBean
    java.lang.reflect.UndeclaredThrowableException
    at $Proxy0.getAuthenticationProviders(Unknown Source)
    at weblogic.security.internal.RealmValidatorImpl.checkAuthenticationProv
    iders(RealmValidatorImpl.java:69)
    at weblogic.security.internal.RealmValidatorImpl.validate(RealmValidator
    Impl.java:54)
    at weblogic.management.security.RealmImpl.validate(RealmImpl.java:37)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMB
    ean.java:1304)
    at weblogic.management.commo.CommoModelMBean.invoke(CommoModelMBean.java
    :464)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    57)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    25)
    at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBean
    ServerImpl.java:765)
    at weblogic.management.commo.CommoProxy.invoke(CommoProxy.java:284)
    at $Proxy0.validate(Unknown Source)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    zeRealm(SecurityServiceManagerDelegateImpl.java:376)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.loadReal
    m(SecurityServiceManagerDelegateImpl.java:697)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    zeRealms(SecurityServiceManagerDelegateImpl.java:730)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    ze(SecurityServiceManagerDelegateImpl.java:873)
    at weblogic.security.service.SecurityServiceManager.initialize(SecurityS
    erviceManager.java:719)
    at weblogic.t3.srvr.T3Srvr.initializeHere(T3Srvr.java:820)
    at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:664)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:342)
    at weblogic.Server.main(Server.java:32)
    Caused by: javax.management.MBeanException
    at weblogic.management.commo.CommoProxySupporter.invokeI(CommoProxySuppo
    rter.java:220)
    at weblogic.management.commo.CommoProxySupporter.getMBeanDescriptorValue
    (CommoProxySupporter.java:158)
    at weblogic.management.commo.CommoProxy.getInterfaceClass(CommoProxy.jav
    a:436)
    at weblogic.management.commo.CommoProxy.createFreshProxy(CommoProxy.java
    :475)
    at weblogic.management.commo.CommoProxy.getProxyInstance(CommoProxy.java
    :385)
    at weblogic.management.commo.CommoProxy.getCommoProxy(CommoProxy.java:12
    6)
    at weblogic.management.commo.CommoProxy.wrap(CommoProxy.java:499)
    at weblogic.management.commo.CommoProxy.wrap(CommoProxy.java:509)
    at weblogic.management.commo.CommoProxy.invoke(CommoProxy.java:215)
    ... 24 more
    --------------- nested within: ------------------
    javax.management.RuntimeMBeanException: RuntimeException thrown in managed resou
    rce while trying to invoke operation validate
    at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMB
    ean.java:1352)
    at weblogic.management.commo.CommoModelMBean.invoke(CommoModelMBean.java
    :464)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    57)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    25)
    at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBean
    ServerImpl.java:765)
    at weblogic.management.commo.CommoProxy.invoke(CommoProxy.java:284)
    at $Proxy0.validate(Unknown Source)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    zeRealm(SecurityServiceManagerDelegateImpl.java:376)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.loadReal
    m(SecurityServiceManagerDelegateImpl.java:697)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    zeRealms(SecurityServiceManagerDelegateImpl.java:730)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    ze(SecurityServiceManagerDelegateImpl.java:873)
    at weblogic.security.service.SecurityServiceManager.initialize(SecurityS
    erviceManager.java:719)
    at weblogic.t3.srvr.T3Srvr.initializeHere(T3Srvr.java:820)
    at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:664)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:342)
    at weblogic.Server.main(Server.java:32)
    --------------- nested within: ------------------
    javax.management.RuntimeOperationsException: RuntimeException thrown by the invo
    ke method of the Dynamic MBean
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    59)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    25)
    at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBean
    ServerImpl.java:765)
    at weblogic.management.commo.CommoProxy.invoke(CommoProxy.java:284)
    at $Proxy0.validate(Unknown Source)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    zeRealm(SecurityServiceManagerDelegateImpl.java:376)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.loadReal
    m(SecurityServiceManagerDelegateImpl.java:697)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    zeRealms(SecurityServiceManagerDelegateImpl.java:730)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    ze(SecurityServiceManagerDelegateImpl.java:873)
    at weblogic.security.service.SecurityServiceManager.initialize(SecurityS
    erviceManager.java:719)
    at weblogic.t3.srvr.T3Srvr.initializeHere(T3Srvr.java:820)
    at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:664)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:342)
    at weblogic.Server.main(Server.java:32)
    >
    <Nov 24, 2003 10:31:23 AM CST> <Emergency> <WebLogicServer> <BEA-000342> <Unable
    to initialize the server: javax.management.RuntimeOperationsException: RuntimeE
    xception thrown by the invoke method of the Dynamic MBean>
    The WebLogic Server did not start up properly.
    java.lang.reflect.UndeclaredThrowableException
    at $Proxy0.getAuthenticationProviders(Unknown Source)
    at weblogic.security.internal.RealmValidatorImpl.checkAuthenticationProv
    iders(RealmValidatorImpl.java:69)
    at weblogic.security.internal.RealmValidatorImpl.validate(RealmValidator
    Impl.java:54)
    at weblogic.management.security.RealmImpl.validate(RealmImpl.java:37)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMB
    ean.java:1304)
    at weblogic.management.commo.CommoModelMBean.invoke(CommoModelMBean.java
    :464)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    57)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    25)
    at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBean
    ServerImpl.java:765)
    at weblogic.management.commo.CommoProxy.invoke(CommoProxy.java:284)
    at $Proxy0.validate(Unknown Source)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    zeRealm(SecurityServiceManagerDelegateImpl.java:376)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.loadReal
    m(SecurityServiceManagerDelegateImpl.java:697)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    zeRealms(SecurityServiceManagerDelegateImpl.java:730)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    ze(SecurityServiceManagerDelegateImpl.java:873)
    at weblogic.security.service.SecurityServiceManager.initialize(SecurityS
    erviceManager.java:719)
    at weblogic.t3.srvr.T3Srvr.initializeHere(T3Srvr.java:820)
    at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:664)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:342)
    at weblogic.Server.main(Server.java:32)
    Caused by: javax.management.MBeanException
    at weblogic.management.commo.CommoProxySupporter.invokeI(CommoProxySuppo
    rter.java:220)
    at weblogic.management.commo.CommoProxySupporter.getMBeanDescriptorValue
    (CommoProxySupporter.java:158)
    at weblogic.management.commo.CommoProxy.getInterfaceClass(CommoProxy.jav
    a:436)
    at weblogic.management.commo.CommoProxy.createFreshProxy(CommoProxy.java
    :475)
    at weblogic.management.commo.CommoProxy.getProxyInstance(CommoProxy.java
    :385)
    at weblogic.management.commo.CommoProxy.getCommoProxy(CommoProxy.java:12
    6)
    at weblogic.management.commo.CommoProxy.wrap(CommoProxy.java:499)
    at weblogic.management.commo.CommoProxy.wrap(CommoProxy.java:509)
    at weblogic.management.commo.CommoProxy.invoke(CommoProxy.java:215)
    ... 24 more
    --------------- nested within: ------------------
    javax.management.RuntimeMBeanException: RuntimeException thrown in managed resou
    rce while trying to invoke operation validate
    at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMB
    ean.java:1352)
    at weblogic.management.commo.CommoModelMBean.invoke(CommoModelMBean.java
    :464)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    57)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    25)
    at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBean
    ServerImpl.java:765)
    at weblogic.management.commo.CommoProxy.invoke(CommoProxy.java:284)
    at $Proxy0.validate(Unknown Source)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    zeRealm(SecurityServiceManagerDelegateImpl.java:376)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.loadReal
    m(SecurityServiceManagerDelegateImpl.java:697)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    zeRealms(SecurityServiceManagerDelegateImpl.java:730)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    ze(SecurityServiceManagerDelegateImpl.java:873)
    at weblogic.security.service.SecurityServiceManager.initialize(SecurityS
    erviceManager.java:719)
    at weblogic.t3.srvr.T3Srvr.initializeHere(T3Srvr.java:820)
    at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:664)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:342)
    at weblogic.Server.main(Server.java:32)
    --------------- nested within: ------------------
    java.lang.reflect.UndeclaredThrowableException
    at $Proxy0.getAuthenticationProviders(Unknown Source)
    at weblogic.security.internal.RealmValidatorImpl.checkAuthenticationProv
    iders(RealmValidatorImpl.java:69)
    at weblogic.security.internal.RealmValidatorImpl.validate(RealmValidator
    Impl.java:54)
    at weblogic.management.security.RealmImpl.validate(RealmImpl.java:37)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMB
    ean.java:1304)
    at weblogic.management.commo.CommoModelMBean.invoke(CommoModelMBean.java
    :464)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    57)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    25)
    at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBean
    ServerImpl.java:765)
    at weblogic.management.commo.CommoProxy.invoke(CommoProxy.java:284)
    at $Proxy0.validate(Unknown Source)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    zeRealm(SecurityServiceManagerDelegateImpl.java:376)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.loadReal
    m(SecurityServiceManagerDelegateImpl.java:697)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    zeRealms(SecurityServiceManagerDelegateImpl.java:730)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    ze(SecurityServiceManagerDelegateImpl.java:873)
    at weblogic.security.service.SecurityServiceManager.initialize(SecurityS
    erviceManager.java:719)
    at weblogic.t3.srvr.T3Srvr.initializeHere(T3Srvr.java:820)
    at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:664)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:342)
    at weblogic.Server.main(Server.java:32)
    Caused by: javax.management.MBeanException
    at weblogic.management.commo.CommoProxySupporter.invokeI(CommoProxySuppo
    rter.java:220)
    at weblogic.management.commo.CommoProxySupporter.getMBeanDescriptorValue
    (CommoProxySupporter.java:158)
    at weblogic.management.commo.CommoProxy.getInterfaceClass(CommoProxy.jav
    a:436)
    at weblogic.management.commo.CommoProxy.createFreshProxy(CommoProxy.java
    :475)
    at weblogic.management.commo.CommoProxy.getProxyInstance(CommoProxy.java
    :385)
    at weblogic.management.commo.CommoProxy.getCommoProxy(CommoProxy.java:12
    6)
    at weblogic.management.commo.CommoProxy.wrap(CommoProxy.java:499)
    at weblogic.management.commo.CommoProxy.wrap(CommoProxy.java:509)
    at weblogic.management.commo.CommoProxy.invoke(CommoProxy.java:215)
    ... 24 more
    --------------- nested within: ------------------
    javax.management.RuntimeMBeanException: RuntimeException thrown in managed resou
    rce while trying to invoke operation validate
    at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMB
    ean.java:1352)
    at weblogic.management.commo.CommoModelMBean.invoke(CommoModelMBean.java
    :464)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    57)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    25)
    at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBean
    ServerImpl.java:765)
    at weblogic.management.commo.CommoProxy.invoke(CommoProxy.java:284)
    at $Proxy0.validate(Unknown Source)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    zeRealm(SecurityServiceManagerDelegateImpl.java:376)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.loadReal
    m(SecurityServiceManagerDelegateImpl.java:697)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    zeRealms(SecurityServiceManagerDelegateImpl.java:730)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    ze(SecurityServiceManagerDelegateImpl.java:873)
    at weblogic.security.service.SecurityServiceManager.initialize(SecurityS
    erviceManager.java:719)
    at weblogic.t3.srvr.T3Srvr.initializeHere(T3Srvr.java:820)
    at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:664)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:342)
    at weblogic.Server.main(Server.java:32)
    --------------- nested within: ------------------
    javax.management.RuntimeOperationsException: RuntimeException thrown by the invo
    ke method of the Dynamic MBean
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    59)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    25)
    at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBean
    ServerImpl.java:765)
    at weblogic.management.commo.CommoProxy.invoke(CommoProxy.java:284)
    at $Proxy0.validate(Unknown Source)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    zeRealm(SecurityServiceManagerDelegateImpl.java:376)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.loadReal
    m(SecurityServiceManagerDelegateImpl.java:697)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    zeRealms(SecurityServiceManagerDelegateImpl.java:730)
    at weblogic.security.service.SecurityServiceManagerDelegateImpl.initiali
    ze(SecurityServiceManagerDelegateImpl.java:873)
    at weblogic.security.service.SecurityServiceManager.initialize(SecurityS
    erviceManager.java:719)
    at weblogic.t3.srvr.T3Srvr.initializeHere(T3Srvr.java:820)
    at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:664)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:342)
    at weblogic.Server.main(Server.java:32)
    Reason: javax.management.RuntimeOperationsException: RuntimeException thrown by
    the invoke method of the Dynamic MBean
    Been strugling with this over the weekend. Can anyone help? thanks, Swetal

    "Swetal Vaidya" <[email protected]> wrote in message
    news:[email protected]...
    >
    I am trying to run the Authentication Security provider example(http://dev2dev.bea.com/codelibrary/code/sec_rdbms.jsp)
    in a WLS 8.1 environment. Followed the steps listed in the readme file toget
    this installed. After creating the domain and building the example usingant,
    when I try to restart the WLS, I get a:
    <Nov 24, 2003 10:31:19 AM CST> <Info> <WebLogicServer> <BEA-000377><Starting
    We
    bLogic Server with Java HotSpot(TM) Client VM Version 1.4.1_03-b02 fromSun Micr
    osystems Inc.>
    <Nov 24, 2003 10:31:19 AM CST> <Info> <Configuration Management><BEA-150016>
    <T
    his server is being started as the administration server.>
    <Nov 24, 2003 10:31:19 AM CST> <Info> <Management> <BEA-141107> <Version:WebLog
    ic Server 8.1 SP1 Fri Jun 20 23:06:40 PDT 2003 271009
    WebLogic XMLX Module 8.1 SP1 Fri Jun 20 23:06:40 PDT 2003 271009>
    <Nov 24, 2003 10:31:19 AM CST> <Notice> <Management> <BEA-140005> <Loadingdomai
    n configuration from configuration repository atC:\bea\user_projects\domains\au
    thrdbms\.\config.xml.>
    <Nov 24, 2003 10:31:21 AM CST> <Notice> <Log Management> <BEA-170019> <Theserve
    r log file C:\bea\user_projects\domains\authrdbms\myserver\myserver.log isopene
    d. All server side log events will be written to this file.>
    <Nov 24, 2003 10:31:23 AM CST> <Critical> <WebLogicServer> <BEA-000364><Server
    failed during initialization.Exception:javax.management.RuntimeOperationsExcept
    ion: RuntimeException thrown by the invoke method of the Dynamic MBean
    java.lang.reflect.UndeclaredThrowableException
    at $Proxy0.getAuthenticationProviders(Unknown Source)
    atweblogic.security.internal.RealmValidatorImpl.checkAuthenticationProv
    iders(RealmValidatorImpl.java:69)
    atweblogic.security.internal.RealmValidatorImpl.validate(RealmValidator
    Impl.java:54)
    atweblogic.management.security.RealmImpl.validate(RealmImpl.java:37)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)It looks like some sort of exception is being thrown when getting the
    authentication
    providers. I would check the config.xml for the authentication providers
    definitions.
    See if you see anything that doesn't look right.

  • SSL/TLS with Anonymous Diffie-Hellman example anywhere?

    I'm trying to connect to a server using ssl or tls using TLS_DH_anon_WITH_AES_128_CBC_SHA as my cipher suite, and I'm running into problems (exceptions). Is there an example anywhere showing how this can be done? I have been Googling, and I cannot find something useful.
    My code is:
                   try {
                        Security.addProvider(new SunJCE());
                        SSLContext ctx = SSLContext.getInstance("TLS");
                        ctx.init(null, null, null);
                        SSLSocketFactory sslFact = ctx.getSocketFactory();
                        SSLSocket socket = (SSLSocket) sslFact.createSocket(getURL()
                                  .getHost(), getURL().getPort());
                        socket.setEnabledCipherSuites(enabledCipherSuites);
                        socket.startHandshake();
                   } catch (Exception e) {
                        e.printStackTrace();
                   }and my errors are:
    javax.net.ssl.SSLException: java.lang.RuntimeException: Could not generate secret
         ... (some stuff omitted)
    Caused by: java.lang.RuntimeException: Could not generate secret
         ... (some stuff omitted)
    Caused by: java.security.NoSuchAlgorithmException: DiffieHellman KeyFactory not availableAny suggestions, please?

    Hmmmm ... not a lot of info in the following document from the Safari Development Center, and it's a bit dated too, but just in case it's of any use as a starting point:
    [What encryption, authentication, and proxy technologies does Safari support?|http://developer.apple.com/safari/library/qa/qa2009/qa1537.html]

  • Processing Pattern Example not working?

    I am trying to run the Processing Pattern example for the first time. I'm using the .cmd files provided with the example.
    The server starts up without error and its logs show loading some Processing Pattern TaskProcessor classes:
    2010-09-28 14:30:47.616/4.839 Oracle Coherence GE 3.5.2/463 <Info> (thread=Thread-4, member=1): Starting dispatcher Task Dispatcher Class:com.oracle.coherence.patterns.processing.dispatchers.AbstractDispatcher
    2010-09-28 14:30:47.632/4.855 Oracle Coherence GE 3.5.2/463 <Info> (thread=SimpleEventDispatcher:Thread-2, member=1): DefaultTask Processor Definition Manager starting Class:com.oracle.coherence.patterns.processing.internal.task.DefaultTaskProcessorDefinitionManager
    2010-09-28 14:30:47.632/4.855 Oracle Coherence GE 3.5.2/463 <Info> (thread=Thread-4, member=1): Starting dispatcher Local Dispatcher Class:com.oracle.coherence.patterns.processing.dispatchers.AbstractDispatcher
    2010-09-28 14:30:47.632/4.855 Oracle Coherence GE 3.5.2/463 <Info> (thread=ReplicatedCache:ReplicatedServiceForProcessingPattern:EventDispatcher, member=1): Registering TaskProcessorDefinition TPD:{Identifier{GridTaskProcessor},Grid Task Processor,GRID} Class:com.oracle.coherence.patterns.processing.dispatchers.task.DefaultTaskDispatcher$1
    2010-09-28 14:30:47.663/4.886 Oracle Coherence GE 3.5.2/463 <Info> (thread=DistributedCache:DistributedServiceForProcessingPattern:EventDispatcher, member=1): TaskProcessorMediator inserted TPSK:{Identifier{GridTaskProcessor},1} Class:com.oracle.coherence.patterns.processing.dispatchers.task.DefaultTaskDispatcher$2
    2010-09-28 14:30:47.663/4.886 Oracle Coherence GE 3.5.2/463 <Info> (thread=DistributedCache:DistributedServiceForProcessingPattern:EventDispatcher, member=1): TaskProcessorMediator inserted TPSK:{Identifier{SingleTaskProcessor},0} Class:com.oracle.coherence.patterns.processing.dispatchers.task.DefaultTaskDispatcher$2
    2010-09-28 14:30:47.679/4.902 Oracle Coherence GE 3.5.2/463 <Info> (thread=ReplicatedCache:ReplicatedServiceForProcessingPattern:EventDispatcher, member=1): Registering TaskProcessorDefinition TPD:{Identifier{SingleTaskProcessor},Single Task Processor,SINGLE} Class:com.oracle.coherence.patterns.processing.dispatchers.task.DefaultTaskDispatcher$1
    However, when I attempt to run the example I'm getting a runtime error:
    "C:\Java\jdk1.5.0_14"\bin\java -Dtangosol.coherence.clusterport=COH_OPTSCLUSTER_PORT -Dtangosol.coherence.cacheconfig=coherence-processingpattern-cac
    he-config.xml -Dtangosol.pof.config=file:/C:\temp\coherence-incubator-examples-1.1.1.14471\resource\processingpattern\examples-pof-config.xml -Dtangos
    ol.coherence.log=C:\temp\coherence-incubator-examples-1.1.1.14471\bin\..\log\PiCalculationSample-9001.log -Dtangosol.coherence.cacheconfig=C:\temp\coh
    erence-incubator-examples-1.1.1.14471\resource\processingpattern\processing-cache-config.xml -Dtangosol.coherence.distributed.localstorage=false -cp C
    :\temp\coherence-incubator-examples-1.1.1.14471\bin\..\lib\coherence-common-1.6.1.14470.jar;C:\temp\coherence-incubator-examples-1.1.1.14471\bin\..\li
    b\coherence-commandpattern-2.6.1.14471.jar;C:\temp\coherence-incubator-examples-1.1.1.14471\bin\..\lib\coherence-functorpattern-1.3.1.14471.jar;C:\tem
    p\coherence-incubator-examples-1.1.1.14471\bin\..\lib\coherence-messagingpattern-2.6.1.14471.jar;C:\temp\coherence-incubator-examples-1.1.1.14471\bin\
    ..\lib\coherence-pushreplicationpattern-2.6.1.14471.jar;C:\temp\coherence-incubator-examples-1.1.1.14471\bin\..\lib\coherence-processingpattern-1.2.1.
    14471.jar;"C:\tools\Coherence-3.5.2"\lib\coherence.jar;C:\temp\coherence-incubator-examples-1.1.1.14471\bin\..\classes -Xms256m -Xmx256m com.oracle.c
    oherence.examples.incubator.processingpattern.task.PiCalculationSample
    Testing PI calculation
    Using the Incubator Extensible Environment for Coherence Cache Configuration
    Copyright (c) 2010, Oracle Corporation. All Rights Reserved.
    java.lang.RuntimeException: Storage is not configured
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$BinaryMap.onMissingStorage(DistributedCache.CDB:9
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$BinaryMap.addMapListener(DistributedCache.CDB:59)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$ViewMap.addMapListener(DistributedCache.CDB:1)
    at com.tangosol.coherence.component.util.SafeNamedCache.addMapListener(SafeNamedCache.CDB:12)
    at com.tangosol.coherence.component.util.SafeNamedCache.addMapListener(SafeNamedCache.CDB:47)
    at com.oracle.coherence.patterns.processing.internal.DefaultProcessingSession.<init>(DefaultProcessingSession.java:218)
    at com.oracle.coherence.examples.incubator.processingpattern.task.PiCalculationSample.executeSample(PiCalculationSample.java:75)
    at com.oracle.coherence.examples.incubator.processingpattern.task.PiCalculationSample.main(PiCalculationSample.java:56)
    The server log shows an error also after I attempt to run the example:
    *2010-09-28 14:32:54.322/131.545 Oracle Coherence GE 3.5.2/463 <D5> (thread=DistributedCache:DistributedServiceForProcessingPattern, member=1): Service DistributedServiceForProcessingPattern joined the cluster with senior service member 1*
    *2010-09-28 14:32:57.740/134.963 Oracle Coherence GE 3.5.2/463 <Info> (thread=ClientLeaseCoordinator:Thread-5, member=1): Restarting NamedCache: coherence.patterns.processing.taskprocessormediator*
    *2010-09-28 14:32:58.614/135.837 Oracle Coherence GE 3.5.2/463 <Info> (thread=PacketListenerN, member=1): Scheduled senior member heartbeat is overdue; rejoining multicast group.*
    *2010-09-28 14:33:06.232/143.455 Oracle Coherence GE 3.5.2/463 <Info> (thread=PacketListenerN, member=1): Scheduled senior member heartbeat is overdue; rejoining multicast group.*
    *2010-09-28 14:33:13.850/151.073 Oracle Coherence GE 3.5.2/463 <Info> (thread=PacketListenerN, member=1): Scheduled senior member heartbeat is overdue; rejoining multicast group.*
    *2010-09-28 14:33:21.452/158.675 Oracle Coherence GE 3.5.2/463 <Info> (thread=PacketListenerN, member=1): Scheduled senior member heartbeat is overdue; rejoining multicast group.*
    *2010-09-28 14:33:29.054/166.277 Oracle Coherence GE 3.5.2/463 <Info> (thread=PacketListenerN, member=1): Scheduled senior member heartbeat is overdue; rejoining multicast group.*
    *2010-09-28 14:33:36.656/173.879 Oracle Coherence GE 3.5.2/463 <Info> (thread=PacketListenerN, member=1): Scheduled senior member heartbeat is overdue; rejoining multicast group.*
    *2010-09-28 14:33:44.258/181.481 Oracle Coherence GE 3.5.2/463 <Info> (thread=PacketListenerN, member=1): Scheduled senior member heartbeat is overdue; rejoining multicast group.*
    *2010-09-28 14:33:51.766/188.989 Oracle Coherence GE 3.5.2/463 <Error> (thread=PacketListenerN, member=1): Stopping cluster due to unhandled exception: com.tangosol.net.messaging.ConnectionException: Unable to refresh sockets: [UnicastUdpSocket{State=STATE_OPEN, address:port=10.100.153.51:8088}, MulticastUdpSocket{State=STATE_OPEN, address:port=224.3.5.2:8087, InterfaceAddress=10.100.153.51, TimeToLive=4}, TcpSocketAccepter{State=STATE_OPEN, ServerSocket=10.100.153.51:8088}]; last failed socket: MulticastUdpSocket{State=STATE_OPEN, address:port=224.3.5.2:8087, InterfaceAddress=10.100.153.51, TimeToLive=4}*
    *     at com.tangosol.coherence.component.net.Cluster$SocketManager.refreshSockets(Cluster.CDB:91)*
    *     at com.tangosol.coherence.component.net.Cluster$SocketManager$MulticastUdpSocket.onInterruptedIOException(Cluster.CDB:9)*
    *     at com.tangosol.coherence.component.net.socket.UdpSocket.receive(UdpSocket.CDB:33)*
    *     at com.tangosol.coherence.component.net.UdpPacket.receive(UdpPacket.CDB:4)*
    *     at com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketListener.onNotify(PacketListener.CDB:19)*
    *     at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)*
    *     at java.lang.Thread.run(Thread.java:595)*
    Caused by: java.net.SocketTimeoutException: Receive timed out
    *     at java.net.PlainDatagramSocketImpl.receive0(Native Method)*
    *     at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:136)*
    *     at java.net.DatagramSocket.receive(DatagramSocket.java:712)*
    *     at com.tangosol.coherence.component.net.socket.UdpSocket.receive(UdpSocket.CDB:20)*
    *     at com.tangosol.coherence.component.net.UdpPacket.receive(UdpPacket.CDB:4)*
    *     at com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketListener.onNotify(PacketListener.CDB:19)*
    *     at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)*
    *     at java.lang.Thread.run(Thread.java:595)*
    Has anyone had similar experiences? Any advice to help me understand and get this going would be appreciated.
    Thanks !!

    I have same problem.
    Midi trigger patern correctly. When trying idividual souds, it works but running sequencer do not trigger sound.
    HW MacBook Pro (model 2008)
    Soudcard: MOTU 828, M-Audio ozonic, internal speaker
    Midi: Korg nanoPad, Roland Fantom, m-audio Ozonic,
    I invesigate and i found out this:
    1)
    When open MainStage and automaticaly load Concert, pres midi key - no sound
    Then I close just concert not MainStage, open recent concert (same), press midi key - seq playing, soud works
    2)
    Switch of automatic loading last opened Concert, quit and start MainStage, open Concert manualy and no sound.
    Close concert, open again, soud works
    3)
    Switch automatic concert loading on, open MainStage - no sound
    Open preferences, audio / change buffer size, hit applay - sound works
    4)
    Setup previous buffer size, change routing to buffer
    Restart MainStage, no sound, change routing back to output - no sound
    Change audio driver to System Setting - sound works - system setting goes to same soundcard
    Restart MainStage - no sound
    Change system sound output to Internal Speaker - no sound
    Change system sound output to soundcard - sound works
    5)
    Preferences - change audio to System settings, switch off I/O Safety Buffer - below Buffer Size setting
    Restart Mainstage - SOUND WORKS
    Restart MainStage again - SOUD WORKS

  • Errors compiling the rmi-iiop example.

    Hello,
    I have WebLogic Server 5.1, jdk1.3, Inprise's Visibroker for Java 4.0
    and Visibroker for C++ 4.0 all on Windows NT.
    I am following the steps on the index.html page in the
    examples/rmi_iiop/hello directory in my weblogic directory. The errors
    occur at step 5 of the section "Build the client".
    The errors are output by the java compiler. They are:
    examples\rmi_iiop\hello\_HelloWorld_Stub.java:17:
    examples.rmi_iiop.hello._HelloWorld_Stub should be declared abstract; it
    does not define bind() in examples.rmiiiop.hello._HelloWorld_Stub
    public class HelloWorldStub extends javax.rmi.CORBA.Stub implements
    HelloWorld {
    ^
    examples\rmi_iiop\hello\HelloImpl.java:12:
    examples.rmi_iiop.hello.HelloImpl should be declared abstract; it does
    not define isa(java.lang.String) in examples.rmi_iiop.hello.HelloImpl
    public class HelloImpl implements HelloWorld {
    Are there issues with jdk1.3? Or have I misapplied some steps?
    Any help would be greatly appreciated.
    David Hallam
    [email protected]

    The problem you are having is that the compiler is picking up another copy of HelloWorld... see if you can run the compiler with verbose turned on and find where it is getting the interface from... or try using javap...So, here is the output when I compile in verbose mode:
    D:\weblogic>javac -verbose -d %WL_HOME%\myserver\corbaclient
    examples\rmi_iiop\h
    ello\*.java
    [parsing started examples\rmi_iiop\hello\_HelloWorldStub.java]
    [parsing completed 160ms]
    [parsing started examples\rmi_iiop\hello\HelloClient.java]
    [parsing completed 30ms]
    [parsing started examples\rmi_iiop\hello\HelloImpl.java]
    [parsing completed 0ms]
    [parsing started examples\rmi_iiop\hello\HelloWorld.java]
    [parsing completed 10ms]
    [parsing started examples\rmi_iiop\hello\HelloWorldHelper.java]
    [parsing completed 0ms]
    [parsing started examples\rmi_iiop\hello\HelloWorldHolder.java]
    [parsing completed 0ms]
    [parsing started examples\rmi_iiop\hello\HelloWorldOperations.java]
    [parsing completed 0ms]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/ObjectImpl.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Object.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Object.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/IDLEntity.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/Serializable.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/Delegate.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/String.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/ObjectInputStream.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/ObjectOutputStream.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NameComponent.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContextHelper.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContext.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/ORB.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/rmi/RemoteException.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Exception.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Any.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/TypeCode.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/InputStream.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/OutputStream.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/Streamable.class)]
    [checking examples.rmi_iiop.hello._HelloWorldStub]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/ApplicationException.cl
    ass)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Throwable.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/MARSHAL.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/SystemException.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/RuntimeException.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/RemarshalException.clas
    s)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/InputStream.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/IOException.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/OutputStream.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Error.class)]
    [wrote
    D:\weblogic\myserver\corbaclient\examples\rmi_iiop\hello\_HelloWorldStub.
    class]
    [checking examples.rmi_iiop.hello.HelloWorld]
    [wrote
    D:\weblogic\myserver\corbaclient\examples\rmi_iiop\hello\HelloWorld.class
    [checking examples.rmi_iiop.hello.HelloWorldOperations]
    [wrote
    D:\weblogic\myserver\corbaclient\examples\rmi_iiop\hello\HelloWorldOperat
    ions.class]
    [checking examples.rmi_iiop.hello.HelloClient]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/System.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/PrintStream.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/FilterOutputStream.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContextOperations.clas
    s)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/BAD_PARAM.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContextPackage/NotFoun
    d.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/UserException.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContextPackage/CannotP
    roceed.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContextPackage/Invalid
    Name.class)]
    [wrote
    D:\weblogic\myserver\corbaclient\examples\rmi_iiop\hello\HelloClient.clas
    s]
    [checking examples.rmi_iiop.hello.HelloImpl]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Policy.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/SetOverrideType.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/DomainManager.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Context.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/NVList.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/NamedValue.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/ExceptionList.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/ContextList.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Request.class)]
    examples\rmi_iiop\hello\HelloImpl.java:12:
    examples.rmi_iiop.hello.HelloImpl sho
    uld be declared abstract; it does not define isa(java.lang.String) in
    examples
    .rmi_iiop.hello.HelloImpl
    public class HelloImpl implements HelloWorld {
    ^
    [loading D:\jdk1.3\jre\lib\rt.jar(javax/naming/Context.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(javax/naming/InitialContext.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(javax/naming/Name.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Comparable.class)]
    [checking examples.rmi_iiop.hello.HelloWorldHelper]
    [checking examples.rmi_iiop.hello.HelloWorldHolder]
    [total 1301ms]
    1 error

  • Java ThreadPool Example

    Some people asked at this forum: "How to write Java Threadpool?" Here is an example, which I have tested on the computer with two CPU. This example also runs well with J#.
    TPTest.java
    package demo.test;
    import java.io.File;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.PrintStream;
    import java.util.Calendar;
    import thread.util.ThreadPool;
    class ShutdownHook extends Thread {
        public void run() {
            try {
                MyRunnable.fout.flush();
                Thread.sleep(1000);
                MyRunnable.fout.close();
            catch (Exception e) {
                e.printStackTrace();
    class MyRunnable implements Runnable {
        public static File file;
        public static FileWriter fout;
         public static PrintStream out;
        static {
            try {
                file = new File(".\\ThreadPool.log");
                fout = new FileWriter(file);
                   out = System.out;
                //Uncomment the next line in J#
                //Runtime.getRuntime().runFinalizersOnExit(true);
                //Comment the next line in J#
                Runtime.getRuntime().addShutdownHook(new ShutdownHook());
            catch (IOException e) {
                e.printStackTrace();
        static int n = 0;
        int i;
        public MyRunnable(int i) {
            this.i = i;
        public void run() {
            try {
                synchronized(fout) {
                    n++;
                    fout.write("Sample No." + n + "\t" + Calendar.getInstance().getTime().getMinutes() + ":" +
                    Calendar.getInstance().getTime().getSeconds() + ":" +
                    Calendar.getInstance().get(Calendar.MILLISECOND) +  
                    ":" + "Executed: " + this + Thread.currentThread() + "\r\n");
                        out.println("Sample No." + n + "\t" + Calendar.getInstance().getTime().getMinutes() + ":" +
                    Calendar.getInstance().getTime().getSeconds() + ":" +
                    Calendar.getInstance().get(Calendar.MILLISECOND) +  
                    ":" + "Executed: " + this + Thread.currentThread());
            catch (IOException e) {
                e.printStackTrace();
            synchronized(this) {
                notify();
        public String toString() {
            return "Task No." + i;
    public class TPTest {
        public static void main(String[] args) {
            ThreadPool thp = new ThreadPool(100);
            int count = 10000;
            for (int i = 0; i < count; i++) {
                if(i == count - 1)
                    // Wait for the last Invoke
                    ThreadPool.invokeAndWait(thp, new MyRunnable(i));
                else
                    ThreadPool.invokeLater(thp, new MyRunnable(i));
            try {
                MyRunnable.fout.flush();
                MyRunnable.fout.close();
            }catch(Exception e) {
            System.exit(0);
    Queue.java
    package thread.util;
    import java.util.Enumeration;
    class NoSuchElementException extends RuntimeException {
        public NoSuchElementException() {
            super();
        public NoSuchElementException(String s) {
            super(s);
    class QueueElement {
        QueueElement next = null;
        QueueElement prev = null;
        Object obj = null;
        QueueElement(Object obj) {
            this.obj = obj;
        public String toString() {
            return "QueueElement[obj="
                + obj
                + (prev == null ? " null" : " prev")
                + (next == null ? " null" : " next")
                + "]";
    final class LIFOQueueEnumerator implements Enumeration {
        Queue queue;
        QueueElement cursor;
        LIFOQueueEnumerator(Queue q) {
            queue = q;
            cursor = q.head;
        public boolean hasMoreElements() {
            return (cursor != null);
        public Object nextElement() {
            synchronized (queue) {
                if (cursor != null) {
                    QueueElement result = cursor;
                    cursor = cursor.next;
                    return result.obj;
            throw new NoSuchElementException("NoSuchElement");
    final class FIFOQueueEnumerator implements Enumeration {
        Queue queue;
        QueueElement cursor;
        FIFOQueueEnumerator(Queue q) {
            queue = q;
            cursor = q.tail;
        public boolean hasMoreElements() {
            return (cursor != null);
        public Object nextElement() {
            synchronized (queue) {
                if (cursor != null) {
                    QueueElement result = cursor;
                    cursor = cursor.prev;
                    return result.obj;
            throw new NoSuchElementException("FIFOQueueEnumerator");
    public class Queue {
        int length = 0;
        QueueElement head = null;
        QueueElement tail = null;
        public Queue() {
        public synchronized void enqueue(Object obj) {
            QueueElement newElt = new QueueElement(obj);
            if (head == null) {
                head = newElt;
                tail = newElt;
                length = 1;
            else {
                newElt.next = head;
                head.prev = newElt;
                head = newElt;
                length++;
        public synchronized Object dequeue() {
            QueueElement elt = tail;
            tail = elt.prev;
            if (tail == null) {
                head = null;
            else {
                tail.next = null;
            length--;
            return elt.obj;
        public synchronized boolean isEmpty() {
            return (tail == null);
        public final synchronized Enumeration elements() {
            return new LIFOQueueEnumerator(this);
        public final synchronized Enumeration reverseElements() {
            return new FIFOQueueEnumerator(this);
        public synchronized void dump(String msg) {
            System.err.println(">> " + msg);
            System.err.println(
                    + length
                    + " elt(s); head = "
                    + (head == null ? "null" : (head.obj) + "")
                    + " tail = "
                    + (tail == null ? "null" : (tail.obj) + ""));
            QueueElement cursor = head;
            QueueElement last = null;
            while (cursor != null) {
                System.err.println("  " + cursor);
                last = cursor;
                cursor = cursor.next;
            if (last != tail) {
                System.err.println("  tail != last: " + tail + ", " + last);
            System.err.println("]");
    QueueException.java
    package thread.util;
    public class QueueException extends RuntimeException {
    ThreadPool.java
    package thread.util;
    * A thread pool with a bounded task queue and fixed number of worker threads.
    public class ThreadPool {
        public static ThreadPool currentThreadPool = null;
        public Queue queue;
        public ThreadPool(int threads) {
            queue = new Queue();
            /* create the worker threads */
            for (int i = 0; i < threads; ++i) {
                Thread t = new Thread(new WorkerThread(), "WorkerThread: " + (i + 1));
                t.setDaemon(true);
                t.start();
         * Queues a task to be executed by this ThreadPool. If the task queue is
         * full, the task will run in the calling thread. (Could easily be modified
         * to throw an exception instead.)
        public void doTask(Runnable task) {
            synchronized (queue) {
                queue.enqueue(task);
                queue.notify();
         * Tests if the task queue is empty.  Useful if you want to wait for all
         * queued tasks to complete before terminating your program.
        public boolean queueEmpty() {
            synchronized (queue) {
                return queue.isEmpty();
        private class WorkerThread implements Runnable {
            public void run() {
                Runnable task;
                while (true) {
                    task = null;
                    synchronized (queue) {
                        try {
                            if (queue.isEmpty()) {
                                queue.wait();
                            else {
                                task = (Runnable)queue.dequeue();
                        catch (InterruptedException e) {
                            break;
                    if (task != null) {
                        task.run();
        } /* end inner class WorkerThread */
        public static void invokeLater(ThreadPool thp, Runnable task) {
            thp.doTask(task);
        public static void invokeAndWait(ThreadPool thp, Runnable task) {
            TaskWrapper tw = new TaskWrapper(task);
            synchronized(tw.task) {
                try {
                    thp.doTask(tw);
                    tw.task.wait();
                catch (InterruptedException e) {
                tw = null;
        public static void invokeLater(Runnable task) {
            if(ThreadPool.currentThreadPool == null) {
                ThreadPool.currentThreadPool = new ThreadPool(20);
            ThreadPool.currentThreadPool.doTask(task);
        public static void invokeAndWait(Runnable task) {
            if(ThreadPool.currentThreadPool == null) {
                ThreadPool.currentThreadPool = new ThreadPool(20);
            TaskWrapper tw = new TaskWrapper(task);
            synchronized(tw.task) {
                try {
                    ThreadPool.currentThreadPool.doTask(tw);
                    tw.task.wait();
                catch (InterruptedException e) {
                tw = null;
    } /* end class ThreadPool */
    class TaskWrapper implements Runnable {
        public Runnable task;
        public TaskWrapper(Runnable task) {
            this.task = task;
        public void run() {
            synchronized(task) {
                task.run();
                task.notify();

    Thanks for the example. I was wondering how to do this.
    I am running it right now on Fedora Linux.
    When I run the demo TPTest.java
    as written
    ThreadPool thp = new ThreadPool(100);
    int count = 10000;
    I get and error at the very end of the run like this :
    Sample No.10000     32:36:289:Executed: Task No.652Thread[WorkerThread: 10,5,main]
    java.io.IOException: Stream closed
         at sun.nio.cs.StreamEncoder.ensureOpen(StreamEncoder.java:38)
         at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:151)
         at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:213)
         at demo.test.ShutdownHook.run(TPTest.java:14)
    Is this correct behaviour?
    General this the only error I see. If I start changing the count and Threadpool size to
    other combinations, I occasionally get other errors similar to this one as well.
    java.io.IOException: Stream closed
         at sun.nio.cs.StreamEncoder.ensureOpen(StreamEncoder.java:38)
         at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:129)
         at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:146)
         at java.io.OutputStreamWriter.write(OutputStreamWriter.java:204)
         at java.io.Writer.write(Writer.java:126)
         at demo.test.MyRunnable.run(TPTest.java:53)
         at thread.util.ThreadPool$WorkerThread.run(ThreadPool.java:58)
         at java.lang.Thread.run(Thread.java:534)
    Is there a way to increase thread size with java on Fedora Linux (Core 3)?
    Would like to know. This example was interesting to me because I am trying to push
    the limit for load testing purposes.
    Thanks again for the example. Let me know if you have any updates to this one.

  • Why not to use static methods - with example

    Hi Everyone,
    I'd like to continue the below thread about "why not to use static methods"
    Why not to use static methods
    with a concrete example.
    In my small application I need to be able to send keystrokes. (java.awt.Robot class is used for this)
    I created the following class for these "operations" with static methods:
    public class KeyboardInput {
         private static Robot r;
         static {
              try {
                   r = new Robot();
              } catch (AWTException e) {
                   throw new RuntimeException(e + "Robot couldn't be initialized.");
         public static void wait(int millis){
              r.delay(millis);
         public static void copy() {
              r.keyPress(KeyEvent.VK_CONTROL);
              r.keyPress(KeyEvent.VK_C);
              r.keyRelease(KeyEvent.VK_C);
              r.keyRelease(KeyEvent.VK_CONTROL);
         public static void altTab() {
              r.keyPress(KeyEvent.VK_ALT);
              r.keyPress(KeyEvent.VK_TAB);
              r.keyRelease(KeyEvent.VK_TAB);
              r.keyRelease(KeyEvent.VK_ALT);
                   // more methods like  paste(), tab(), shiftTab(), rightArrow()
    }Do you thinks it is a good solution? How could it be improved? I've seen something about Singleton vs. static methods somewhere. Would it be better to use Singleton?
    Thanks for any comments in advance,
    lemonboston

    maheshguruswamy wrote:
    lemonboston wrote:
    maheshguruswamy wrote:
    I think a singleton might be a better approach for you. Just kill the public constructor and provide a getInstance method to provide lazy initialization.Thanks maheshguruswamy for advising on the steps to create a singleton from this class.
    Could you maybe advise also about why do you say that it would be better to use singleton? What's behind it? Thanks!In short, it seems to me that a single instance of your class will be able to coordinate actions across your entire application. So a singleton should be enough.But that doesn't answer why he should prefer a singleton instead over a bunch of static methods. Functionally the two are almost identical. In both cases there's only one "thing" on which to call methods--either a single instance of the class, or the class itself.
    To answer the question, the main reason to use a Singleton over a classful of static methods is the same reason the drives a lot of non-static vs. static decisions: Polymorphism.
    If you use a Singleton (and and interface), you can do something like this:
    KeyboardInput kbi = get_some_instance_of_some_class_that_implements_KeyboardInput_somehow_maybe_from_a_factory();And then whatever is calling KBI's public methods only has to know that it has an implementor of that interface, without caring which concrete class it is, and you can substitute whatever implementation is appropriate in a given context. If you don't need to do that, then the static method approach is probably sufficient.
    There are other reasons that may suggest a Singleton--serialization, persistence, use as a JavaBean pop to mind--but they're less common and less compelling in my experience.
    And finally, if this thing maintains any state between method calls, although you can handle that with static member variables, it's more in keeping with the OO paradigm to make them non-static fields of an instance of that class.

  • Exception running J2EE Kodo car example

    on Windows2000, Jboss3.2, running the Kodo J2EE tutorial example When I
    add a car to the database (default Hypersonic datasource) I obtain this
    exception:
    HTTP ERROR: 500 RuntimeException; nested exception is:
    com.solarmetric.kodo.runtime.FatalDataStoreException:
    java.sql.SQLException: You cannot commit during a managed transaction!
    [code=0;state=null] NestedThrowables: java.sql.SQLException: You cannot
    commit during a managed transaction!
    RequestURI=/sample/Save.jsp
    Can you help me?

    If you are using managed XA transactions, you need to specify a second
    connection factory Kodo can use for things like allocating sequence
    numbers and other database operations that should not be dependent on the
    current global transaction. See the documentation on the various
    ConnectionFactory2 settings, and our documentation on XA transactions.

  • Re: Errors compiling the rmi-iiop example.

    As I said, apparently, you are trying to compile the IDL client in java using the RMI client classes. THere are two problems with this:
    1-- you must compile the rmi class definitions into a directory that can be easily excluded from the class path at the time you compile the idl definitions.
    2-- the idl definitions and the resulting classes are useless wrt the rmi definitions and wls, so the resulting classes must be compiled into directories other than those used by wls and the rmi clients.
    Another way to look at this is as follows:
    To compile the rmi definitions, you do:
    set ORIGINALCLASSPATH=CLASSPATH
    set CLASSPATH=../fooclasses;$CLASSPATH
    javac -d ../fooclasses rmi/FooImpl.java
    Then,
    -- you compile the jrmp classes as:
    rmic -d ../jrmpclasses rmi.FooImpl
    -- you compile the weblogic classes as:
    java weblogic.rmic -d ../wlsclasses rmi.FooImpl
    that is, you are allowed to compile from the same implementation class so long as it is compliant
    -- you compile the rmi-iiop classes as:
    java weblogic.rmic -iiop -d ../rmiiiopclasses rmi.FooImpl
    that is, as with jrmp and wls, the rmi-iiop classes share the same base type definitions and implementation.
    However, the idl classes are another matter. To compile the idl classes, you must generate the idl, generate the java files and generate the idl class files into another, separate directory, one which does not include any of ../fooclasses, ../jrmpclasses, ../wlsclasses or ../rmiiiopclasses
    directories.
    That is,
    java weblogic.rmic -idlDirtecory ../idl ...
    set CLASSPATH=ORIGINALCLASSPATH
    set CLASSPATH=../idlclasses;CLASSPATH
    cd ../idl
    idl2java rmi/Foo.idl
    javac -d ../idl rmi/*.java
    Hope this helps...
    "Hallam, David [CAR:5e10:EXCH]" wrote:
    The problem you are having is that the compiler is picking up another copy of HelloWorld... see if you can run the compiler with verbose turned on and find where it is getting the interface from... or try using javap...So, here is the output when I compile in verbose mode:
    D:\weblogic>javac -verbose -d %WL_HOME%\myserver\corbaclient
    examples\rmi_iiop\h
    ello\*.java
    [parsing started examples\rmi_iiop\hello\_HelloWorldStub.java]
    [parsing completed 160ms]
    [parsing started examples\rmi_iiop\hello\HelloClient.java]
    [parsing completed 30ms]
    [parsing started examples\rmi_iiop\hello\HelloImpl.java]
    [parsing completed 0ms]
    [parsing started examples\rmi_iiop\hello\HelloWorld.java]
    [parsing completed 10ms]
    [parsing started examples\rmi_iiop\hello\HelloWorldHelper.java]
    [parsing completed 0ms]
    [parsing started examples\rmi_iiop\hello\HelloWorldHolder.java]
    [parsing completed 0ms]
    [parsing started examples\rmi_iiop\hello\HelloWorldOperations.java]
    [parsing completed 0ms]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/ObjectImpl.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Object.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Object.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/IDLEntity.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/Serializable.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/Delegate.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/String.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/ObjectInputStream.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/ObjectOutputStream.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NameComponent.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContextHelper.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContext.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/ORB.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/rmi/RemoteException.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Exception.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Any.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/TypeCode.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/InputStream.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/OutputStream.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/Streamable.class)]
    [checking examples.rmi_iiop.hello._HelloWorldStub]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/ApplicationException.cl
    ass)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Throwable.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/MARSHAL.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/SystemException.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/RuntimeException.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/RemarshalException.clas
    s)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/InputStream.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/IOException.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/OutputStream.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Error.class)]
    [wrote
    D:\weblogic\myserver\corbaclient\examples\rmi_iiop\hello\_HelloWorldStub.
    class]
    [checking examples.rmi_iiop.hello.HelloWorld]
    [wrote
    D:\weblogic\myserver\corbaclient\examples\rmi_iiop\hello\HelloWorld.class
    [checking examples.rmi_iiop.hello.HelloWorldOperations]
    [wrote
    D:\weblogic\myserver\corbaclient\examples\rmi_iiop\hello\HelloWorldOperat
    ions.class]
    [checking examples.rmi_iiop.hello.HelloClient]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/System.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/PrintStream.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/FilterOutputStream.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContextOperations.clas
    s)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/BAD_PARAM.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContextPackage/NotFoun
    d.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/UserException.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContextPackage/CannotP
    roceed.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContextPackage/Invalid
    Name.class)]
    [wrote
    D:\weblogic\myserver\corbaclient\examples\rmi_iiop\hello\HelloClient.clas
    s]
    [checking examples.rmi_iiop.hello.HelloImpl]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Policy.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/SetOverrideType.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/DomainManager.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Context.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/NVList.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/NamedValue.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/ExceptionList.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/ContextList.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Request.class)]
    examples\rmi_iiop\hello\HelloImpl.java:12:
    examples.rmi_iiop.hello.HelloImpl sho
    uld be declared abstract; it does not define isa(java.lang.String) in
    examples
    .rmi_iiop.hello.HelloImpl
    public class HelloImpl implements HelloWorld {
    ^
    [loading D:\jdk1.3\jre\lib\rt.jar(javax/naming/Context.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(javax/naming/InitialContext.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(javax/naming/Name.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Comparable.class)]
    [checking examples.rmi_iiop.hello.HelloWorldHelper]
    [checking examples.rmi_iiop.hello.HelloWorldHolder]
    [total 1301ms]
    1 error[att1.html]

    test
    "Hallam, David [CAR:5e10:EXCH]" wrote:
    Eduardo,
    These directions worked perfectly, thank-you. One point though, this is
    COMPLETELY different to the directions on the index.html page in the
    examples directory.
    Regards,
    David Hallam.
    Eduardo Ceballos wrote:
    As I said, apparently, you are trying to compile the IDL client in
    java using the RMI client classes. THere are two problems with this:
    1-- you must compile the rmi class definitions into a directory that
    can be easily excluded from the class path at the time you compile the
    idl definitions.
    2-- the idl definitions and the resulting classes are useless wrt the
    rmi definitions and wls, so the resulting classes must be compiled
    into directories other than those used by wls and the rmi clients.
    Another way to look at this is as follows:
    To compile the rmi definitions, you do:
    set ORIGINALCLASSPATH=CLASSPATH
    set CLASSPATH=../fooclasses;$CLASSPATH
    javac -d ../fooclasses rmi/FooImpl.java
    Then,
    -- you compile the jrmp classes as:
    rmic -d ../jrmpclasses rmi.FooImpl
    -- you compile the weblogic classes as:
    java weblogic.rmic -d ../wlsclasses rmi.FooImpl
    that is, you are allowed to compile from the same implementation class
    so long as it is compliant
    -- you compile the rmi-iiop classes as:
    java weblogic.rmic -iiop -d ../rmiiiopclasses rmi.FooImpl
    that is, as with jrmp and wls, the rmi-iiop classes share the same
    base type definitions and implementation.
    However, the idl classes are another matter. To compile the idl
    classes, you must generate the idl, generate the java files and
    generate the idl class files into another, separate directory, one
    which does not include any of ../fooclasses, ../jrmpclasses,
    ../wlsclasses or ../rmiiiopclasses directories.
    That is,
    java weblogic.rmic -idlDirtecory ../idl ...
    set CLASSPATH=ORIGINALCLASSPATH
    set CLASSPATH=../idlclasses;CLASSPATH
    cd ../idl
    idl2java rmi/Foo.idl
    javac -d ../idl rmi/*.java
    Hope this helps...
    "Hallam, David [CAR:5e10:EXCH]" wrote:
    The problem you are having is that the compiler is picking upanother copy of HelloWorld... see if you can run the compiler with
    verbose turned on and find where it is getting the interface from...
    or try using javap...
    So, here is the output when I compile in verbose mode:
    D:\weblogic>javac -verbose -d %WL_HOME%\myserver\corbaclient
    examples\rmi_iiop\h
    ello\*.java
    [parsing started examples\rmi_iiop\hello\_HelloWorldStub.java]
    [parsing completed 160ms]
    [parsing started examples\rmi_iiop\hello\HelloClient.java]
    [parsing completed 30ms]
    [parsing started examples\rmi_iiop\hello\HelloImpl.java]
    [parsing completed 0ms]
    [parsing started examples\rmi_iiop\hello\HelloWorld.java]
    [parsing completed 10ms]
    [parsing started examples\rmi_iiop\hello\HelloWorldHelper.java]
    [parsing completed 0ms]
    [parsing started examples\rmi_iiop\hello\HelloWorldHolder.java]
    [parsing completed 0ms]
    [parsing started examples\rmi_iiop\hello\HelloWorldOperations.java]
    [parsing completed 0ms]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/ObjectImpl.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Object.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Object.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/IDLEntity.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/Serializable.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/Delegate.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/String.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/ObjectInputStream.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/ObjectOutputStream.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NameComponent.class)]
    [loading
    D:\jdk1.
    \jre\lib\rt.jar(org/omg/CosNaming/NamingContextHelper.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CosNaming/NamingContext.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/ORB.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/rmi/RemoteException.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Exception.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Any.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/TypeCode.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/InputStream.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/OutputStream.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/portable/Streamable.class)]
    [checking examples.rmi_iiop.hello._HelloWorldStub]
    [loading
    D:\jdk1.
    \jre\lib\rt.jar(org/omg/CORBA/portable/ApplicationException.cl
    ass)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Throwable.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/MARSHAL.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/SystemException.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/RuntimeException.class)]
    [loading
    D:\jdk1.
    \jre\lib\rt.jar(org/omg/CORBA/portable/RemarshalException.clas
    s)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/InputStream.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/IOException.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/OutputStream.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Error.class)]
    [wrote
    D:\web
    ogic\myserver\corbaclient\examples\rmi_iiop\hello\_HelloWorldStub.
    class]
    [checking examples.rmi_iiop.hello.HelloWorld]
    [wrote
    D:\web
    ogic\myserver\corbaclient\examples\rmi_iiop\hello\HelloWorld.class
    [checking examples.rmi_iiop.hello.HelloWorldOperations]
    [wrote
    D:\web
    ogic\myserver\corbaclient\examples\rmi_iiop\hello\HelloWorldOperat
    ions.class]
    [checking examples.rmi_iiop.hello.HelloClient]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/System.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/PrintStream.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/io/FilterOutputStream.class)]
    [loading
    D:\jdk1.
    \jre\lib\rt.jar(org/omg/CosNaming/NamingContextOperations.clas
    s)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/BAD_PARAM.class)]
    [loading
    D:\jdk1.
    \jre\lib\rt.jar(org/omg/CosNaming/NamingContextPackage/NotFoun
    d.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/UserException.class)]
    [loading
    D:\jdk1.
    \jre\lib\rt.jar(org/omg/CosNaming/NamingContextPackage/CannotP
    roceed.class)]
    [loading
    D:\jdk1.
    \jre\lib\rt.jar(org/omg/CosNaming/NamingContextPackage/Invalid
    Name.class)]
    [wrote
    D:\web
    ogic\myserver\corbaclient\examples\rmi_iiop\hello\HelloClient.clas
    s]
    [checking examples.rmi_iiop.hello.HelloImpl]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Policy.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/SetOverrideType.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/DomainManager.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Context.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/NVList.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/NamedValue.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/ExceptionList.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/ContextList.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(org/omg/CORBA/Request.class)]
    examples\rmi_iiop\hello\HelloImpl.java:12:
    examples.rmi_iiop.hello.HelloImpl sho
    uld be declared abstract; it does not define isa(java.lang.String)
    in
    examples
    .rmi_iiop.hello.HelloImpl
    public class HelloImpl implements HelloWorld {
    ^
    [loading D:\jdk1.3\jre\lib\rt.jar(javax/naming/Context.class)]
    [loading
    D:\jdk1.3\jre\lib\rt.jar(javax/naming/InitialContext.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(javax/naming/Name.class)]
    [loading D:\jdk1.3\jre\lib\rt.jar(java/lang/Comparable.class)]
    [checking examples.rmi_iiop.hello.HelloWorldHelper]
    [checking examples.rmi_iiop.hello.HelloWorldHolder]
    [total 1301ms]
    1 error
    Developer Relations Engineer
    BEA Support

  • 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

  • Non-blocking SSLEngine example

    Since the example of using SSLEngine with non-blocking IO that comes with Java is quite limited, I have decided to release my own for anyone who wants to see how I solved the various problems that you must face. The example is designed to be a generic non-blocking server that supports SSL.
    This is only meant to be an example, as I wrote this mostly in order to learn how to use the SSLEngine, and therefore has certain limitations, and is not thouroughly tested.
    You can download the file at: http://members.aol.com/ben77/nio_server2.tar.gz
    Here is also the code for SecureIO, which is roughly analagous to the Java example's ChannelIOSecure:
    package nio_server2.internalio;
    import java.io.IOException;
    import java.nio.ByteBuffer;
    import java.nio.channels.*;
    import java.util.concurrent.*;
    import javax.net.ssl.*;
    import static javax.net.ssl.SSLEngineResult.HandshakeStatus.*;
    * Does IO based on a <code>SocketChannel</code> with all data encrypted using
    * SSL.
    * @author ben
    public class SecureIO extends InsecureIO {
          * SSLTasker is responsible for dealing with all long running tasks required
          * by the SSLEngine
          * @author ben
         private class SSLTasker implements Runnable {
               * @inheritDoc
              public void run() {
                   Runnable r;
                   while ((r = engine.getDelegatedTask()) != null) {
                        r.run();
                   if (inNet.position() > 0) {
                        regnow(); // we may already have read what is needed
                   try {
                        System.out.println(":" + engine.getHandshakeStatus());
                        switch (engine.getHandshakeStatus()) {
                             case NOT_HANDSHAKING:
                                  break;
                             case FINISHED:
                                  System.err.println("Detected FINISHED in tasker");
                                  Thread.dumpStack();
                                  break;
                             case NEED_TASK:
                                  System.err.println("Detected NEED_TASK in tasker");
                                  assert false;
                                  break;
                             case NEED_WRAP:
                                  rereg(SelectionKey.OP_WRITE);
                                  break;
                             case NEED_UNWRAP:
                                  rereg(SelectionKey.OP_READ);
                                  break;
                   } catch (IOException e) {
                        e.printStackTrace();
                        try {
                             shutdown();
                        } catch (IOException ex) {
                             ex.printStackTrace();
                   hsStatus = engine.getHandshakeStatus();
                   isTasking = false;
         private SSLEngine engine;
         private ByteBuffer inNet; // always cleared btwn calls
         private ByteBuffer outNet; // when hasRemaining, has data to write.
         private static final ByteBuffer BLANK = ByteBuffer.allocate(0);
         private boolean initialHandshakeDone = false;
         private volatile boolean isTasking = false;
         private boolean handshaking = true;
         private SSLEngineResult.HandshakeStatus hsStatus = NEED_UNWRAP;
         private boolean shutdownStarted;
         private static Executor executor = getDefaultExecutor();
         private SSLTasker tasker = new SSLTasker();
         private ByteBuffer temp;
          * @return the default <code>Executor</code>
         public static Executor getDefaultExecutor() {
              return new ThreadPoolExecutor(3, Integer.MAX_VALUE, 60L,
                        TimeUnit.SECONDS, new SynchronousQueue<Runnable>(),
                        new DaemonThreadFactory());
         private static class DaemonThreadFactory implements ThreadFactory {
              private static ThreadFactory defaultFactory = Executors
                        .defaultThreadFactory();
               * Creates a thread using the default factory, but sets it to be daemon
               * before returning it
               * @param r
               *            the runnable to run
               * @return the new thread
              public Thread newThread(Runnable r) {
                   Thread t = defaultFactory.newThread(r);
                   t.setDaemon(true);
                   return t;
          * @return the executor currently being used for all long-running tasks
         public static Executor getExecutor() {
              return executor;
          * Changes the executor being used for all long-running tasks. Currently
          * running tasks will still use the old executor
          * @param executor
          *            the new Executor to use
         public static void setExecutor(Executor executor) {
              SecureIO.executor = executor;
          * Creates a new <code>SecureIO</code>
          * @param channel
          *            the channel to do IO on.
          * @param sslCtx
          *            the <code>SSLContext</code> to use
         public SecureIO(SocketChannel channel, SSLContext sslCtx) {
              super(channel);
              engine = sslCtx.createSSLEngine();
              engine.setUseClientMode(false);
              int size = engine.getSession().getPacketBufferSize();
              inNet = ByteBuffer.allocate(size);
              outNet = ByteBuffer.allocate(size);
              outNet.limit(0);
              temp = ByteBuffer.allocate(engine.getSession()
                        .getApplicationBufferSize());
         private void doTasks() throws IOException {
              rereg(0); // don't do anything until the task is done.
              isTasking = true;
              SecureIO.executor.execute(tasker);
          * Does all handshaking required by SSL.
          * @param dst
          *            the destination from an application data read
          * @return true if all needed SSL handshaking is currently complete.
          * @throws IOException
          *             if there are errors in handshaking.
         @Override
         public boolean doHandshake(ByteBuffer dst) throws IOException {
              if (!handshaking) {
                   return true;
              if (dst.remaining() < minBufferSize()) {
                   throw new IllegalArgumentException("Buffer has only "
                             + dst.remaining() + " left + minBufferSize is "
                             + minBufferSize());
              if (outNet.hasRemaining()) {
                   if (!flush()) {
                        return false;
                   switch (hsStatus) {
                        case FINISHED:
                             handshaking = false;
                             initialHandshakeDone = true;
                             rereg(SelectionKey.OP_READ | SelectionKey.OP_WRITE);
                             return true;
                        case NEED_UNWRAP:
                             rereg(SelectionKey.OP_READ);
                             break;
                        case NEED_TASK:
                             doTasks();
                             return false;
                        case NOT_HANDSHAKING:
                             throw new RuntimeException(
                                       "NOT_HANDSHAKING encountered when handshaking");
              SSLEngineResult res;
              System.out.println(hsStatus + "1" + handshaking);
              switch (hsStatus) {
                   case NEED_UNWRAP:
                        int i;
                        do {
                             rereg(SelectionKey.OP_READ);
                             i = super.read(inNet);
                             if (i < 0) {
                                  engine.closeInbound();
                                  handshaking = false;
                                  shutdown();
                                  return true;
                             if (i == 0 && inNet.position() == 0) {
                                  return false;
                             inloop: do {
                                  inNet.flip();
                                  temp.clear();
                                  res = engine.unwrap(inNet, temp);
                                  inNet.compact();
                                  temp.flip();
                                  if (temp.hasRemaining()) {
                                       dst.put(temp);
                                  switch (res.getStatus()) {
                                       case OK:
                                            hsStatus = res.getHandshakeStatus();
                                            if (hsStatus == NEED_TASK) {
                                                 doTasks();
                                            // if (hsStatus == FINISHED) {
                                            // // if (!initialHandshakeDone) {
                                            // // throw new RuntimeException(hsStatus
                                            // // + " encountered when handshaking");
                                            // initialHandshakeDone = true;
                                            // handshaking=false;
                                            // key.interestOps(SelectionKey.OP_READ
                                            // | SelectionKey.OP_WRITE);
                                            // TODO check others?
                                            break;
                                       case BUFFER_UNDERFLOW:
                                            break inloop;
                                       case BUFFER_OVERFLOW:
                                       case CLOSED:
                                            throw new RuntimeException(res.getStatus()
                                                      + " encountered when handshaking");
                             } while (hsStatus == NEED_UNWRAP
                                       && dst.remaining() >= minBufferSize());
                        } while (hsStatus == NEED_UNWRAP
                                  && dst.remaining() >= minBufferSize());
                        if (inNet.position() > 0) {
                             System.err.println(inNet);
                        if (hsStatus != NEED_WRAP) {
                             break;
                        } // else fall through
                        rereg(SelectionKey.OP_WRITE);
                   case NEED_WRAP:
                        do {
                             outNet.clear();
                             res = engine.wrap(BLANK, outNet);
                             switch (res.getStatus()) {
                                  case OK:
                                       outNet.flip();
                                       hsStatus = res.getHandshakeStatus();
                                       if (hsStatus == NEED_TASK) {
                                            doTasks();
                                            return false;
                                       // TODO check others?
                                       break;
                                  case BUFFER_OVERFLOW:
                                       outNet.limit(0);
                                       int size = engine.getSession()
                                                 .getPacketBufferSize();
                                       if (outNet.capacity() < size) {
                                            outNet = ByteBuffer.allocate(size);
                                       } else { // shouldn't happen
                                            throw new RuntimeException(res.getStatus()
                                                      + " encountered when handshaking");
                                  case BUFFER_UNDERFLOW: // engine shouldn't care
                                  case CLOSED:
                                       throw new RuntimeException(res.getStatus()
                                                 + " encountered when handshaking");
                        } while (flush() && hsStatus == NEED_WRAP);
                        break;
                   case NEED_TASK:
                        doTasks();
                        return false;
                   case FINISHED:
                        break; // checked below
                   case NOT_HANDSHAKING:
                        System.err.println(hsStatus + " encountered when handshaking");
                        handshaking = false;
                        initialHandshakeDone = true;
                        rereg(SelectionKey.OP_READ | SelectionKey.OP_WRITE);
              if (hsStatus == FINISHED) {
                   // if (!initialHandshakeDone) {
                   // throw new RuntimeException(hsStatus
                   // + " encountered when handshaking");
                   initialHandshakeDone = true;
                   handshaking = false;
                   rereg(SelectionKey.OP_READ | SelectionKey.OP_WRITE);
              System.out.println(hsStatus + "2" + handshaking);
              return !handshaking;
          * Attempts to flush all buffered data to the channel.
          * @return true if all buffered data has been written.
          * @throws IOException
          *             if there are errors writing the data
         @Override
         public boolean flush() throws IOException {
              if (!outNet.hasRemaining()) {
                   return true;
              super.write(outNet);
              return !outNet.hasRemaining();
          * @return the largest amount of application data that could be read from
          *         the channel at once.
         @Override
         public int minBufferSize() {
              return engine.getSession().getApplicationBufferSize();
          * Begins or proceeds with sending an SSL shutdown message to the client.
          * @return true if all needed IO is complete
          * @throws IOException
          *             if there are errors sending the message.
         @Override
         public boolean shutdown() throws IOException {
              if (!shutdownStarted) {
                   shutdownStarted = true;
                   engine.closeOutbound();
              if (outNet.hasRemaining() && !flush()) {
                   return false;
              SSLEngineResult result;
              do {
                   outNet.clear();
                   result = engine.wrap(BLANK, outNet);
                   if (result.getStatus() != SSLEngineResult.Status.CLOSED) {
                        throw new IOException("Unexpected result in shutdown:"
                                  + result.getStatus());
                   outNet.flip();
                   if (outNet.hasRemaining() && !flush()) {
                        return false;
              } while (result.getHandshakeStatus() == NEED_WRAP);
              return !outNet.hasRemaining();
          * Reads all possible data into the <code>ByteBuffer</code>.
          * @param dst
          *            the buffer to read into.
          * @return the number of bytes read, or -1 if the channel or
          *         <code>SSLEngine</code> is closed
          * @throws IllegalStateException
          *             if the initial handshake isn't complete *
          * @throws IOException
          *             if there are errors.
          * @throws IllegalStateException
          *             if the initial handshake isn't complete
          * @throws IllegalArgumentException
          *             if the remaining space in dst is less than
          *             {@link SecureIO#minBufferSize()}
         @Override
         public int read(ByteBuffer dst) throws IOException {
              if (!initialHandshakeDone) {
                   throw new IllegalStateException("Initial handshake incomplete");
              if (dst.remaining() < minBufferSize()) {
                   throw new IllegalArgumentException("Buffer has only "
                             + dst.remaining() + " left + minBufferSize is "
                             + minBufferSize());
              int sPos = dst.position();
              int i;
              while ((i = super.read(inNet)) != 0
                        && dst.remaining() >= minBufferSize()) {
                   if (i < 0) {
                        engine.closeInbound();
                        shutdown();
                        return -1;
                   do {
                        inNet.flip();
                        temp.clear();
                        SSLEngineResult result = engine.unwrap(inNet, temp);
                        inNet.compact();
                        temp.flip();
                        if (temp.hasRemaining()) {
                             dst.put(temp);
                        switch (result.getStatus()) {
                             case BUFFER_UNDERFLOW:
                                  continue;
                             case BUFFER_OVERFLOW:
                                  throw new Error();
                             case CLOSED:
                                  return -1;
                             // throw new IOException("SSLEngine closed");
                             case OK:
                                  checkHandshake();
                                  break;
                   } while (inNet.position() > 0);
              return dst.position() - sPos;
          * Encrypts data and writes it to the channel.
          * @param src
          *            the data to write
          * @return the number of bytes written
          * @throws IOException
          *             if there are errors.
          * @throws IllegalStateException
          *             if the initial handshake isn't complete
         @Override
         public int write(ByteBuffer src) throws IOException {
              if (!initialHandshakeDone) {
                   throw new IllegalStateException("Initial handshake incomplete");
              if (!flush()) {
                   return 0;
              int written = 0;
              outer: while (src.hasRemaining()) {
                   outNet.clear(); // we flushed it
                   SSLEngineResult result = engine.wrap(src, outNet);
                   outNet.flip();
                   switch (result.getStatus()) {
                        case BUFFER_UNDERFLOW:
                             break outer; // not enough left to send (prob won't
                        // happen - padding)
                        case BUFFER_OVERFLOW:
                             if (!flush()) {
                                  break outer; // can't remake while still have
                                  // stuff to write
                             int size = engine.getSession().getPacketBufferSize();
                             if (outNet.capacity() < size) {
                                  outNet = ByteBuffer.allocate(size);
                             } else { // shouldn't happen
                                  throw new RuntimeException(hsStatus
                                            + " encountered when handshaking");
                             continue; // try again
                        case CLOSED:
                             throw new IOException("SSLEngine closed");
                        case OK:
                             checkHandshake();
                             break;
                   if (!flush()) {
                        break;
              return written;
         private boolean hasRemaining(ByteBuffer[] src) {
              for (ByteBuffer b : src) {
                   if (b.hasRemaining()) {
                        return true;
              return false;
          * Encrypts data and writes it to the channel.
          * @param src
          *            the data to write
          * @return the number of bytes written
          * @throws IOException
          *             if there are errors.
          * @throws IllegalStateException
          *             if the initial handshake isn't complete
         @Override
         public long write(ByteBuffer[] src) throws IOException {
              if (!initialHandshakeDone) {
                   throw new IllegalStateException("Initial handshake incomplete");
              if (!flush()) {
                   return 0;
              int written = 0;
              outer: while (hasRemaining(src)) {
                   outNet.clear(); // we flushed it
                   SSLEngineResult result = engine.wrap(src, outNet);
                   outNet.flip();
                   switch (result.getStatus()) {
                        case BUFFER_UNDERFLOW:
                             break outer; // not enough left to send (prob won't
                        // happen - padding)
                        case BUFFER_OVERFLOW:
                             if (!flush()) {
                                  break outer; // can't remake while still have
                                  // stuff to write
                             int size = engine.getSession().getPacketBufferSize();
                             if (outNet.capacity() < size) {
                                  outNet = ByteBuffer.allocate(size);
                             } else { // shouldn't happen
                                  throw new RuntimeException(hsStatus
                                            + " encountered when handshaking");
                             continue; // try again
                        case CLOSED:
                             throw new IOException("SSLEngine closed");
                        case OK:
                             checkHandshake();
                             break;
                   if (!flush()) {
                        break;
              return written;
         private void checkHandshake() throws IOException {
              // Thread.dumpStack();
              // System.out.println(engine.getHandshakeStatus());
              outer: while (true) {
                   switch (engine.getHandshakeStatus()) {
                        case NOT_HANDSHAKING:
                             initialHandshakeDone = true;
                             handshaking = false;
                             rereg(SelectionKey.OP_READ | SelectionKey.OP_WRITE);
                             return;
                        case FINISHED:
                             // this shouldn't happen, I don't think. If it does, say
                             // where.
                             System.err.println("Detected FINISHED in checkHandshake");
                             Thread.dumpStack();
                             break outer;
                        case NEED_TASK:
                             if (isTasking) {
                                  while (isTasking) { // TODO: deal with by reg?
                                       Thread.yield();
                                       try {
                                            Thread.sleep(1);
                                       } catch (InterruptedException ex) {
                                            // TODO Auto-generated catch block
                                            ex.printStackTrace();
                                  break;
                             doTasks();
                             break;
                        case NEED_WRAP:
                             rereg(SelectionKey.OP_WRITE);
                             break outer;
                        case NEED_UNWRAP:
                             rereg(SelectionKey.OP_READ);
                             break outer;
              handshaking = true;
              hsStatus = engine.getHandshakeStatus();
          * @return true if the channel is open and no shutdown message has been
          *         recieved.
         @Override
         public boolean isOpen() {
              return super.isOpen() && !engine.isInboundDone();
    }

    That's the reason for checkHandshake(), it is called on every read and write and detects a new handshake and configures the setup properly. As far as the server requesting a new handshake, I did not put that in. It would be simple enough though, you would just need to call SSLEngine.beginHandshake() + then call checkHandshake().
    Also, my echo server example had a bug, I forgot to call bu.flip() before queueWrite(), so I fixed that, as well as adding an onConnect method that is called when a connection has been established. The new version should be up at the origional address shortly.

Maybe you are looking for