You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Jacek Laskowski <el...@gmail.com> on 2006/02/20 11:32:59 UTC

[M2] Failing *one* test in the kernel module

Hi,

Over the weekend I tried to convert a module to execute M2 from within
M1, i.e. usig the concept of exec'ing M2 in maven.xml. It works fine,
but there's one caveat (well, there might be more than one, but that's
the most irritating).

In revision 379071 I've just committed, you can execute M2 commands
over a single module. This is done using the M2 concept of profiles
where you can tweak how the commands are executed, etc. This is
defined in the main pom.xml in the root of Geronimo's sources.
Whenever you run any M2 command from within the root of the sources
with the module property set, the singlemodule profile is activated
and only the module pointed out by the property is taken into account.
Without the property all modules are processed. As an example run:

  mvn -Dmodule=kernel test

That's the command that took my whole weekend away and I'm still stuck
with no idea how to work it out :( It seems that I chose one of the
worst modules to convert (as it was with the class I used in my tests
right after Dave wiped it out ;)).

Before I leave it out and move on to another module, I'll describe
what I found out so far wrt the failing
org.apache.geronimo.gbean.GBeanNameTest test of the kernel module.

Here's the snippet of the test report:

$ more modules/kernel/target/surefire-reports/org.apache.geronimo.gbean.GBeanNameTest.txt
...
java.net.MalformedURLException: no protocol: and
        at java.net.URL.<init>(URL.java:537)
        at java.net.URL.<init>(URL.java:434)
        at java.net.URL.<init>(URL.java:383)
        at sun.rmi.server.LoaderHandler.pathToURLs(LoaderHandler.java:747)
        at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:147)
        at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:631)
        at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:257)
        at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:200)
        at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1513)
        at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
        at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
        at org.apache.geronimo.gbean.GBeanNameTest.testSerialization(GBeanNameTest.java:168)

Chances are it won't happen on operating systems (MacOS, *nix) that
their user home directories, thus Maven repo, have on paths without
spaces. That's where the 'and' comes from - on Windows it's
c:/Documents and Settings/account/.m2.

The question is why it fails on M2, but M1 works fine. It is because
the test machinery changed a little in M2 and now surefire is used. I
think it's a brand new test solution in Maven2, but it might be that
it's based on M1 test plugin somehow. Anyway, the following commands
let you step over and see yourself what's going on behind the scenes.

For Maven2 (run it off the top directory):

MAVEN_OPTS="-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,address=8000" mvn -o
-Dmodule=kernel clean test

For Maven1 (run it off the module/kernel directory):

MAVEN_OPTS="-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,address=8000" maven -o clean
test:test

According to http://java.sun.com/j2se/1.4.2/docs/api/java/rmi/MarshalledObject.html,
during the serialization (MarshalledObject.get) an object is annotated
with information that's necessary for deserialization. Upon closer
look, during debugging session, I've noticed that
java.rmi.server.RMIClassLoader is provided with the value of null for
codebase parameter in Maven1 while codebase is set to the entire test
classpath in M2. Since it contains entires separated with spaces, any
directory with spaces is divided inappropriately leading to the above
exception.

Is there anyone who could lend me a hand and sort it out? Should I
find for help in the user@maven mailing list? Brett, Jason, Vincent -
could you help with it?

Jacek (utterly frustrated by not achieving at least a partial success
with M2 after the *whole* weekend)

--
Jacek Laskowski
http://www.laskowski.org.pl

Re: [M2] Failing *one* test in the kernel module

Posted by Jacek Laskowski <el...@gmail.com>.
2006/2/20, Gianny Damour <gi...@optusnet.com.au>:

> I am rewritten the test to perform a standard serialization w/o the
> annotation mechanism.

Whoohooo! It works now. You're the man!

$ mvn -Dmodule=kernel clean test
....
[INFO] ----------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ----------------------------------------------------------------------------
[INFO] Geronimo ............................................... SUCCESS [1.102s]
[INFO] Geronimo :: Kernel .....................................
SUCCESS [11.877s]
[INFO] ----------------------------------------------------------------------------
[INFO] ----------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ----------------------------------------------------------------------------

The lesson learnt - the next time I'll see such annoying error I'll
rewrite the test instead of wasting time fixing the build. Thanks
again!

> Gianny

Jacek

--
Jacek Laskowski
http://www.laskowski.org.pl

Re: [M2] Failing *one* test in the kernel module

Posted by Gianny Damour <gi...@optusnet.com.au>.
Jacek Laskowski wrote:

>2006/2/20, Gianny Damour <gi...@optusnet.com.au>:
>
>  
>
>>Sorry for that - clearProperty has only been introduced in 1.5. (I need
>>to downgrade to 1.4 while working with G.)
>>    
>>
>
>Absolutely! ;) CORBA stuff prevents us from a quick and easy upgrade to 1.5.
>
>  
>
>>This is now fixed.
>>    
>>
>
>Still no joy. It works with M1, but M2 keeps failing with
>'java.net.MalformedURLException: no protocol: and'.
>
>Give it a try with 'mvn -Dmodule=kernel clean test'.
>  
>
Sorry once again - I was confident that the reset of the codebase 
property was working after a couple of tests from Eclipse where I 
changed this property to non valid URLs. Anyway, the issue is that the 
CL which has loaded the class GBeanName is a URLClassLoader. When an 
instance of this class is serialized, its class codebase is set to the 
external form of the URLs defined by the URLClassLoader.

I am rewritten the test to perform a standard serialization w/o the 
annotation mechanism.

Thanks,
Gianny


Re: [M2] Failing *one* test in the kernel module

Posted by Jacek Laskowski <el...@gmail.com>.
2006/2/20, Gianny Damour <gi...@optusnet.com.au>:

> Sorry for that - clearProperty has only been introduced in 1.5. (I need
> to downgrade to 1.4 while working with G.)

Absolutely! ;) CORBA stuff prevents us from a quick and easy upgrade to 1.5.

> This is now fixed.

Still no joy. It works with M1, but M2 keeps failing with
'java.net.MalformedURLException: no protocol: and'.

Give it a try with 'mvn -Dmodule=kernel clean test'.

> Gianny

Jacek

--
Jacek Laskowski
http://www.laskowski.org.pl

Re: [M2] Failing *one* test in the kernel module

Posted by Gianny Damour <gi...@optusnet.com.au>.
Jacek Laskowski wrote:

>2006/2/20, Gianny Damour <gi...@optusnet.com.au>:
>
>  
>
>>As a work-around, I have committed the reset of the RMI code base
>>property prior to use MarshalledObject.
>>    
>>
>
>Hi Gianny,
>
>Thanks for the help! It doesn't work for me, though :(
>
>jlaskowski@JLASKOWSKI /cygdrive/c/oss/geronimo
>$ svn up
>U    modules/kernel/src/test/org/apache/geronimo/gbean/GBeanNameTest.java
>Updated to revision 379110.
>
>jlaskowski@JLASKOWSKI /cygdrive/c/oss/geronimo/modules/kernel
>$ maven -o clean test:test
>...
>test:compile:
>    [javac] Compiling 21 source files to
>C:\oss\geronimo\modules\kernel\target\test-classes
>    [javac] C:\oss\geronimo\modules\kernel\src\test\org\apache\geronimo\gbean\GBeanNameTest.java:171:
>cannot resolve symbol
>    [javac] symbol  : method clearProperty (java.lang.String)
>    [javac] location: class java.lang.System
>    [javac]             System.clearProperty(codeBaseProperty);
>  
>
Sorry for that - clearProperty has only been introduced in 1.5. (I need 
to downgrade to 1.4 while working with G.)

This is now fixed.

Thanks,
Gianny


Re: [M2] Failing *one* test in the kernel module

Posted by Jacek Laskowski <el...@gmail.com>.
2006/2/20, Gianny Damour <gi...@optusnet.com.au>:

> As a work-around, I have committed the reset of the RMI code base
> property prior to use MarshalledObject.

Hi Gianny,

Thanks for the help! It doesn't work for me, though :(

jlaskowski@JLASKOWSKI /cygdrive/c/oss/geronimo
$ svn up
U    modules/kernel/src/test/org/apache/geronimo/gbean/GBeanNameTest.java
Updated to revision 379110.

jlaskowski@JLASKOWSKI /cygdrive/c/oss/geronimo/modules/kernel
$ maven -o clean test:test
...
test:compile:
    [javac] Compiling 21 source files to
C:\oss\geronimo\modules\kernel\target\test-classes
    [javac] C:\oss\geronimo\modules\kernel\src\test\org\apache\geronimo\gbean\GBeanNameTest.java:171:
cannot resolve symbol
    [javac] symbol  : method clearProperty (java.lang.String)
    [javac] location: class java.lang.System
    [javac]             System.clearProperty(codeBaseProperty);
    [javac]                   ^
    [javac] 1 error
...
jlaskowski@JLASKOWSKI /cygdrive/c/oss/geronimo/modules/kernel
$ java -version
java version "1.4.2_10"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_10-b03)
Java HotSpot(TM) Client VM (build 1.4.2_10-b03, mixed mode)

> Gianny

Jacek

--
Jacek Laskowski
http://www.laskowski.org.pl

Re: [M2] Failing *one* test in the kernel module

Posted by Gianny Damour <gi...@optusnet.com.au>.
Jacek Laskowski wrote:

>Hi,
>
>  
>
<snip>

>Here's the snippet of the test report:
>
>$ more modules/kernel/target/surefire-reports/org.apache.geronimo.gbean.GBeanNameTest.txt
>...
>java.net.MalformedURLException: no protocol: and
>        at java.net.URL.<init>(URL.java:537)
>        at java.net.URL.<init>(URL.java:434)
>        at java.net.URL.<init>(URL.java:383)
>
>  
>
<snip>

>According to http://java.sun.com/j2se/1.4.2/docs/api/java/rmi/MarshalledObject.html,
>during the serialization (MarshalledObject.get) an object is annotated
>with information that's necessary for deserialization. Upon closer
>look, during debugging session, I've noticed that
>java.rmi.server.RMIClassLoader is provided with the value of null for
>codebase parameter in Maven1 while codebase is set to the entire test
>classpath in M2. Since it contains entires separated with spaces, any
>directory with spaces is divided inappropriately leading to the above
>exception.
>
>Is there anyone who could lend me a hand and sort it out? Should I
>find for help in the user@maven mailing list? Brett, Jason, Vincent -
>could you help with it?
>  
>
As a work-around, I have committed the reset of the RMI code base 
property prior to use MarshalledObject.

Thanks,
Gianny

>Jacek (utterly frustrated by not achieving at least a partial success
>with M2 after the *whole* weekend)
>
>--
>Jacek Laskowski
>http://www.laskowski.org.pl
>
>
>
>  
>