You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Peter Royal <pr...@managingpartners.com> on 2001/10/15 23:04:45 UTC

RMI not working under Phoenix properly

I'm seeing something *very* strange over here. I just converted our 
application to a bunch of blocks and have it running under phoenix as a 
SAR. Until I get a chance to help hacking on the catalina/bay components to 
have it run as a block, I still need RMI.

When I make an RMI call to my exported block, the first method with the 
requested calling signature is executed, not the requested one. For 
example, in my Remote interface I have:

     void registerClientNotification(RMIClientNotification clientNotification)
       throws RemoteException;

     boolean isUserValid(String username, String password) throws 
RemoteException;

     String getUserResource(String username, String resource) throws 
RemoteException;


Calls to registerClientNotification work 100% of the time, its the only 
method with that signature.

However, whenever I call getUserResource, isUserValid is executed on the 
server. Naturally this is throwing exceptions because the arguments aren't 
correct. If I look at the stack trace on the callee side, it is calling the 
correct method in the generated stub. Something is being lost in transit. 
*ANY* call to a method that takes 2 string arguments is being directed to 
isUserValid on the Phoenix side.

I'm *REALLY* stumped. I searched the list archives and the only RMI-related 
troubles I saw were relating to the ftp server component and exporting 
stubs. I tried changing the code where I bind to the registry to match that 
more, but no luck.

I know Phoenix does some internal magic with proxies, etc. I don't know if 
that may be part of the problem. Any thoughts/ideas would be greatly 
appreciated. Thanks!
-pete

-- 
peter royal -> proyal@managingpartners.com
managing partners, inc. -> http://www.managingpartners.com


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: RMI not working under Phoenix properly

Posted by Peter Donald <do...@apache.org>.
On Wed, 17 Oct 2001 00:32, Peter Royal wrote:
> At 07:42 PM 10/16/2001 +1000, you wrote:
> > > However, whenever I call getUserResource, isUserValid is executed on
> > > the server. Naturally this is throwing exceptions because the arguments
> > > aren't correct. If I look at the stack trace on the callee side, it is
> > > calling the correct method in the generated stub. Something is being
> > > lost in transit. *ANY* call to a method that takes 2 string arguments
> > > is being directed to isUserValid on the Phoenix side.
> >
> >Now thats a hair curler !
>
> ah, false alarm :)
>
> When I ran phoenix with "-Djava.rmi.server.logCalls=true", RMI is doing the
> right thing, my runtime exceptions were just getting lost so I thought it
> was doing something else. Learn something new every day :)
>
> -pete, "feeling dumb"

kool ;)

-- 
Cheers,

Pete

---------------------------------------------------
Murphy's law - "Anything that can go wrong, will." 
(Actually, this is Finagle's law, which in itself 
shows that Finagle was right.)
---------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: RMI not working under Phoenix properly

Posted by Peter Royal <pr...@managingpartners.com>.
At 07:42 PM 10/16/2001 +1000, you wrote:
> > However, whenever I call getUserResource, isUserValid is executed on the
> > server. Naturally this is throwing exceptions because the arguments aren't
> > correct. If I look at the stack trace on the callee side, it is calling the
> > correct method in the generated stub. Something is being lost in transit.
> > *ANY* call to a method that takes 2 string arguments is being directed to
> > isUserValid on the Phoenix side.
>
>
>Now thats a hair curler !

ah, false alarm :)

When I ran phoenix with "-Djava.rmi.server.logCalls=true", RMI is doing the 
right thing, my runtime exceptions were just getting lost so I thought it 
was doing something else. Learn something new every day :)

-pete, "feeling dumb"



-- 
peter royal -> proyal@managingpartners.com
managing partners, inc. -> http://www.managingpartners.com


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: RMI not working under Phoenix properly

Posted by Peter Royal <pr...@managingpartners.com>.
At 07:42 PM 10/16/2001 +1000, you wrote:
> > I know Phoenix does some internal magic with proxies, etc. I don't know if
> > that may be part of the problem. Any thoughts/ideas would be greatly
> > appreciated. Thanks!
>
>I have a sneaking suspicion that it is to do with the proxy generation. (At
>least this would make sense if you were exporting one block from another
>block and RMI used reflection to generate messages). I will try to fix it
>tonight so that you can disable this - however some recent changes have gone
>through that may need alterations - so if not today perhaps tomorrow or the
>next day - If I forget remind me ;)

RMI is using reflection, here's a stack trace from the phoenix side when 
the call there fails:

         at java.lang.reflect.Method.invoke(Native Method)
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
         at sun.rmi.transport.Transport$1.run(Transport.java:152)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
         at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)

My code to export the object to RMI is simply:

             final Remote stub = RemoteObject.toStub(this);
             Naming.bind(getRmiName(), stub);

That code is in the start() method of the block itself. This block was 
offering a service, I removed the service with no affect.

I'm using a CVS version of phoenix from last friday. I'll update and see if 
that helps.  Thanks for the assistance :)
-pete

-- 
peter royal -> proyal@managingpartners.com
managing partners, inc. -> http://www.managingpartners.com


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: Phoenix/Cornerstone upgradation problem

Posted by Peter Donald <do...@apache.org>.
Okay - just fixed it in CVS ;)

On Wed, 17 Oct 2001 17:32, umashanker wrote:
> Thanks Paul Hammant for your reply,
>
> I got source from CVS.
>
> Its is working fine now, i forgot to change configuration for  "Thread
> Manager"  from "server.xml"  to  "config.xml" file.
>
> ERROR :
> In class "DefaultApplicationContext" getLogger() method throws
> NullPointerException, this occurs when threads configuration in
> "server.xml" is groups.length>0.
>
>
> -------------DefaultApplicationContext.java---------------------
> public void configure( final Configuration configuration )
>         throws ConfigurationException
>     {
>         //Configure thread pools
>         final Configuration[] groups =
>             configuration.getChild( "threads" ).getChildren(
> "thread-group" );
>
>         if( groups.length > 0 )
>         {
>             final String message = REZ.getString(
> "frame.warn.thread-pools" );
>
> >>>>>>>         getLogger().warn( message );  // throws
> >>>>>>> NullPointerException
>
>             System.err.println( message );
>         }
>
>         for( int i = 0; i < groups.length; i++ )
>         {
>             configureThreadPool( groups[ i ] );
>         }
>     }
>
> ---------------------------------------------------------------------------
>-
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: avalon-dev-help@jakarta.apache.org

-- 
Cheers,

Pete

-------------------------------------------------------
"When we remember we are all mad, the mysteries of life 
disappear and life stands explained." -Mark Twain
-------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: Phoenix/Cornerstone upgradation problem

Posted by umashanker <um...@rics.co.jp>.
Thanks Paul Hammant for your reply,

I got source from CVS.

Its is working fine now, i forgot to change configuration for  "Thread
Manager"  from "server.xml"  to  "config.xml" file.

ERROR :
In class "DefaultApplicationContext" getLogger() method throws
NullPointerException, this occurs when threads configuration in "server.xml"
is groups.length>0.


-------------DefaultApplicationContext.java---------------------
public void configure( final Configuration configuration )
        throws ConfigurationException
    {
        //Configure thread pools
        final Configuration[] groups =
            configuration.getChild( "threads" ).getChildren(
"thread-group" );

        if( groups.length > 0 )
        {
            final String message = REZ.getString(
"frame.warn.thread-pools" );
>>>>>>>         getLogger().warn( message );  // throws NullPointerException
            System.err.println( message );
        }

        for( int i = 0; i < groups.length; i++ )
        {
            configureThreadPool( groups[ i ] );
        }
    }

----------------------------------------------------------------------------







---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: Phoenix/Cornerstone upgradation problem

Posted by Paul Hammant <Pa...@yahoo.com>.
Not directly answering your question, but you may be better getting all 
from CVS.

Regards,

- Paul H

>I  have downloaded "phoenix-4.0a1" and latest "jakarta-avalon-cornerstone"
>(date 2001-10-15).
>
>I made changes to my application according to new implementaiton.
>
>These are the changes which i made:
>
>    1. Removed  "extends phoenix.Service interface" in all my Service
>interfaces.
>    2. Removed  "<role> </role>"  in ".xinfo" files
>    3. Added     "</block>" element in ".xinfo" files
>    4. Added "ThreadManager" block to "scheduler" and "connections" blocks
>in "assembly.xml" file .
>
>When i start phoenix server,  i am getting the following error :
>---------------------------------------------------------------
>Tue Oct 16 12:30:44 JST 2001 [INFO   ] (Phoenix): Verifying that the
>specified BlockListeners have valid types.
>Tue Oct 16 12:30:44 JST 2001 [WARN   ] (Phoenix): Failed to start
>application rics-server.
>java.lang.Exception: Failed to initialize application rics-server.
>        at
>org.apache.avalon.phoenix.components.kernel.DefaultKernel.startup(DefaultKer
>nel.java:143)
>        at
>org.apache.avalon.phoenix.components.kernel.DefaultKernel.addApplication(Def
>aultKernel.java:175)
>        at
>org.apache.avalon.phoenix.components.deployer.DefaultSarDeployer.deploy(Defa
>ultSarDeployer.java:121)
>        at
>org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployFile(Def
>aultEmbeddor.java:333)
>        at
>org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployFiles(De
>faultEmbeddor.java:325)
>        at
>org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployDefaultA
>pplications(DefaultEmbeddor.j\
>ava:307)
>        at
>org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.execute(Defaul
>tEmbeddor.java:162)
>
>--------------------------------------------------------------------
>
>i have attached phoenix.log file for reference.
>
>Please tell me if i forgot to change any thing.
>
>Application was working fine with the pervious versions(nightly phoenix and
>cornerstone);
>
>thanks in advance
>
>umashanker.k
>
>
>
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
>




---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Phoenix/Cornerstone upgradation problem

Posted by umashanker <um...@rics.co.jp>.
I  have downloaded "phoenix-4.0a1" and latest "jakarta-avalon-cornerstone"
(date 2001-10-15).

I made changes to my application according to new implementaiton.

These are the changes which i made:

    1. Removed  "extends phoenix.Service interface" in all my Service
interfaces.
    2. Removed  "<role> </role>"  in ".xinfo" files
    3. Added     "</block>" element in ".xinfo" files
    4. Added "ThreadManager" block to "scheduler" and "connections" blocks
in "assembly.xml" file .

When i start phoenix server,  i am getting the following error :
---------------------------------------------------------------
Tue Oct 16 12:30:44 JST 2001 [INFO   ] (Phoenix): Verifying that the
specified BlockListeners have valid types.
Tue Oct 16 12:30:44 JST 2001 [WARN   ] (Phoenix): Failed to start
application rics-server.
java.lang.Exception: Failed to initialize application rics-server.
        at
org.apache.avalon.phoenix.components.kernel.DefaultKernel.startup(DefaultKer
nel.java:143)
        at
org.apache.avalon.phoenix.components.kernel.DefaultKernel.addApplication(Def
aultKernel.java:175)
        at
org.apache.avalon.phoenix.components.deployer.DefaultSarDeployer.deploy(Defa
ultSarDeployer.java:121)
        at
org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployFile(Def
aultEmbeddor.java:333)
        at
org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployFiles(De
faultEmbeddor.java:325)
        at
org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployDefaultA
pplications(DefaultEmbeddor.j\
ava:307)
        at
org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.execute(Defaul
tEmbeddor.java:162)

--------------------------------------------------------------------

i have attached phoenix.log file for reference.

Please tell me if i forgot to change any thing.

Application was working fine with the pervious versions(nightly phoenix and
cornerstone);

thanks in advance

umashanker.k




Re: RMI not working under Phoenix properly

Posted by Peter Donald <do...@apache.org>.
On Tue, 16 Oct 2001 07:04, Peter Royal wrote:
> When I make an RMI call to my exported block, the first method with the
> requested calling signature is executed, not the requested one. For
> example, in my Remote interface I have:
>
>      void registerClientNotification(RMIClientNotification
> clientNotification) throws RemoteException;
>
>      boolean isUserValid(String username, String password) throws
> RemoteException;
>
>      String getUserResource(String username, String resource) throws
> RemoteException;
>
>
> Calls to registerClientNotification work 100% of the time, its the only
> method with that signature.
>
> However, whenever I call getUserResource, isUserValid is executed on the
> server. Naturally this is throwing exceptions because the arguments aren't
> correct. If I look at the stack trace on the callee side, it is calling the
> correct method in the generated stub. Something is being lost in transit.
> *ANY* call to a method that takes 2 string arguments is being directed to
> isUserValid on the Phoenix side.


Now thats a hair curler ! 

;)

> I'm *REALLY* stumped. I searched the list archives and the only RMI-related
> troubles I saw were relating to the ftp server component and exporting
> stubs. I tried changing the code where I bind to the registry to match that
> more, but no luck.
>
> I know Phoenix does some internal magic with proxies, etc. I don't know if
> that may be part of the problem. Any thoughts/ideas would be greatly
> appreciated. Thanks!

I have a sneaking suspicion that it is to do with the proxy generation. (At 
least this would make sense if you were exporting one block from another 
block and RMI used reflection to generate messages). I will try to fix it 
tonight so that you can disable this - however some recent changes have gone 
through that may need alterations - so if not today perhaps tomorrow or the 
next day - If I forget remind me ;)

-- 
Cheers,

Pete

*------------------------------------------------*
| You can't wake a person who is pretending      |
|       to be asleep. -Navajo Proverb.           |
*------------------------------------------------*

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org