Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

Invalid Object Stream (StreamCorruptedException) when obtaining registrar

On the latest builds of both XAP full and community editions I've had problems running the Plain JavaSpaces Tutorial. Unfortunately the examples seem to be missing from the distro (they are no longer in the examples/ directory), so I've just copied-and-pasted from the source posted in the wiki. I'm just trying to launch the JiniSpaceAccessor.java at this point, but right when I perform a locator.getRegistrar() a runtime exception is thrown:

java.io.StreamCorruptedException: invalid stream header: 00ACED00 at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783) <snip> at net.jini.core.discovery.LookupLocator.getRegistrarFromSocket(LookupLocator.java:375) at net.jini.core.discovery.LookupLocator.getRegistrar(LookupLocator.java:331) at net.jini.core.discovery.LookupLocator.getRegistrar(LookupLocator.java:288) at <my little="" test="" class="">

The space is created, I can see it in the console, I've double-checked to ensure I'm registering correctly, but I get the invalid header each time.

Any ideas?

Actual code is: {code} public void testGigaspaces() throws Exception { Class [] classes = new Class[]{net.jini.space.JavaSpace.class}; Name sn = new Name( "mySpace" ); ServiceTemplate tmpl = new ServiceTemplate(null,classes,new Entry[] { sn } );

LookupLocator locator = new LookupLocator("jini://localhost:4162");
ServiceRegistrar sr = locator.getRegistrar();
 JavaSpace space =  (JavaSpace)sr.lookup(tmpl);

assertNotNull(space);

} {code} h4. Attachments

[SpaceAccess.java|/upfiles/13759713646368792.java]

[SpaceAccess.java|/upfiles/13759713642862192.java]

{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=2733]{quote}

asked 2008-11-24 14:18:52 -0500

updated 2013-08-08 09:52:00 -0500

jaissefsfex gravatar image
edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted
0

Are you using the Jini jars comes with GigaSpaces?

answered 2008-11-24 14:24:39 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Comments

Yup, triple-checked to make sure. I've got my usual Apache Commons, JUnit and Apache Camel JARs, but other than that just jsk-lib.jar and jsk-platform.jar from the full XAP distro.

deckerego gravatar imagedeckerego ( 2008-11-24 14:28:04 -0500 )edit
0

And, if it helps, here's my XAP invocation:

hostname:~/Desktop/gigaspaces-xapcommunity-6.6.1-ga> bin/gsInstance.sh "/./myspace?schema=javaspace" Starting a Space Instance
Setting space url to /./myspace?schema=javaspace

Starting gsInstance with line: /usr/lib64/jvm/java/bin/java -server -showversion -Xmx512m -Xbootclasspath/p::bin/../lib/xml/serializer.jar:bin/../lib/xml/xalan.jar:bin/../lib/xml/xercesImpl.jar:bin/../lib/xml/xml-apis.jar -Dsun.rmi.dgc.client.gcInterval=36000000 -Dsun.rmi.dgc.server.gcInterval=36000000 -Djava.rmi.server.hostname=plasmatop -Djava.rmi.server.RMIClassLoaderSpi=default -Djava.rmi.server.logCalls=false -Dcom.gs.jini_lus.locators= -Dcom.gs.jini_lus.groups=gigaspaces-6.6.1-XAPCommunity-ga -Dcom.gs.home=bin/.. -Dcom.gs.start-embedded-lus=true -Dcom.gs.start-embedded-mahalo=false -Dcom.gs.logging.debug=false -Djava.util.logging.config.file=bin/../config/gs_logging.properties -classpath ::::bin/../lib/jdbc/h2.jar:bin/../lib/jdbc/hsqldb.jar:bin/..:bin/../lib/JSpaces.jar: com.j_spaces.core.client.SpaceFinder /./myspace?schema=javaspace
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) 64-Bit Server VM (build 11.0-b15, mixed mode)

Nov 24, 2008 3:29:48 PM WARNING [com.gigaspaces.common.resourceloader]: Could not find the container schema: config/schemas/javaspace-container-schema.xml. Instead, loaded the default container schema < config/schemas/default-container-schema.xml > for the container configuration.

Nov 24, 2008 3:29:49 PM INFO [com.gigaspaces.container]:

System Environment: System: OS Version: 2.6.25.18-0.2-default Architecture: amd64 OS Name: Linux Number Of Processors: 2 J2SE Support: VM Vendor: Sun Microsystems Inc. Using Java Home: /usr/java/jdk1.6.0_10/jre Java(TM) SE Runtime Environment Java HotSpot(TM) 64-Bit Server VM (build 11.0-b15 ) JVM Memory: Max Heap Size (KB): 466048 Current Allocated Heap Size (KB): 9770 Network Interfaces Information: Host Name: [plasmatop.site] Network Interface Name: tun0 / tun0 IP Address: 10.0.0.6 Network Interface Name: eth0 / eth0 IP Address: 10.100.1.108 Network Interface Name: lo / lo IP Address: 127.0.0.2 IP Address: 127.0.0.1 GigaSpaces Platform: Edition: XAPCommunity 6.6.1 ga Build: 3002 Jar Spec: 1.5 Home: bin/../

Nov 24, 2008 3:29:49 PM INFO [com.gigaspaces.container]: Created RMIRegistry on: < 127.0.0.2:10098 >

Nov 24, 2008 3:29:49 PM INFO [com.gigaspaces.container]: Webster HTTP server started successfully serving the following roots: bin/..//lib;bin/..//lib/jini Webster serving on: 127.0.0.2:9813

Nov 24, 2008 3:29:49 PM INFO [com.sun.jini.reggie]: started Reggie: 4e081ce7-8633-43c5-a98b-25311b0ebc2a, [gigaspaces-6.6.1-XAPCommunity-ga], jini://127.0.0.2/

Nov 24, 2008 3:29:49 PM INFO [com.gigaspaces.core.common]: Starting Space <myspace_container:myspace> with url [/./myspace?schema=javaspace&groups=gigaspaces-6.6.1-XAPCommunity-ga&state=started] ...

Nov 24, 2008 3:29:50 PM INFO [com.gigaspaces.cache]: Cache manager created with policy [ALL IN CACHE], persistency mode [memory]

Nov 24, 2008 3:29:50 PM INFO [com.gigaspaces.cache]: Data source recovery: Found 0 entries in data source. Inserted to space 0 entries. Under transaction - 0 entries.

Nov 24, 2008 3:29:50 PM INFO [com.gigaspaces.core.common]: Space <myspace_container:myspace> with url [/./myspace?schema=javaspace&groups=gigaspaces-6.6.1-XAPCommunity-ga&state=started] started successfully h4. Attachments

[SpaceAccess.java|/upfiles/13759713653913982.java]

[SpaceAccess.java|/upfiles/137597136551582.java]

answered 2008-11-24 14:46:47 -0500

edit flag offensive delete link more

Comments

Attached works for me.

I'm starting the space using : gsInstance.bat "/./mySpace"

Shay h4. Attachments

[SpaceAccess.java|/upfiles/13759713662199409.java]

[SpaceAccess.java|/upfiles/13759713667629409.java]

shay hassidim gravatar imageshay hassidim ( 2008-11-24 14:49:49 -0500 )edit

See attached using also the Name attribute. Works for me. Started the space using: gsInstance.bat "/./mySpace?schema=javaspace" Shay h4. Attachments

[SpaceAccess.java|/upfiles/13759713664762527.java]

shay hassidim gravatar imageshay hassidim ( 2008-11-24 15:17:30 -0500 )edit

Indeed - the discovery managers seem to work just fine, while the straight-on registrar and lookup locators do not. I wonder if this is a bug with the Gigaspaces registrar implementation or if the wiki example is simply out of date?

I'd much rather use the discovery managers anyway (since I can back them with a lookup cache), but it seems odd that XAP has object serialization issues with the very sample they demonstrate.

Thanks for the assistance!

deckerego gravatar imagedeckerego ( 2008-11-24 16:22:36 -0500 )edit

I was able to get things running using: {code} java -Djava.security.policy=policy/policy.all -classpath lib/jini/jsk-lib.jar:lib/jini/jsk-platform.jar:lib/JSpaces.jar:. JavaSpaces myspace {code} Using JSpaces.jar from the GigaSpaces distro and jsk-platform.jar from their Jini distro.

deckerego gravatar imagedeckerego ( 2008-12-01 23:26:48 -0500 )edit
0

I'm a bit concerned that the client must be deployed with gigaspaces jars. Does this mean that any existing clients participating in a Jini network will no longer be able to connect to Gigaspace instances?

Will this be changed in a future release? It brings up a serious threat of lock-in and isolation from other Jini efforts.

answered 2008-11-30 18:10:45 -0500

nkabir gravatar image
edit flag offensive delete link more
0

Just to be crystal, the code I'm running is:

{code} import java.rmi.RMISecurityManager; import net.jini.core.discovery.LookupLocator; import net.jini.core.entry.Entry; import net.jini.core.lookup.ServiceRegistrar; import net.jini.core.lookup.ServiceTemplate; import net.jini.lookup.entry.Name; import net.jini.space.JavaSpace;

public class JavaSpaces { public static void main(String[] args) throws Exception { if ( System.getSecurityManager() == null ) System.setSecurityManager( new RMISecurityManager() );

            Class [] classes = new Class[]{net.jini.space.JavaSpace.class};
            Name sn = new Name( args[0] );
            ServiceTemplate tmpl = new ServiceTemplate(null,classes,new Entry[] { sn } );

            LookupLocator locator = new LookupLocator("jini://localhost");
            ServiceRegistrar sr = locator.getRegistrar();
            JavaSpace space =  (JavaSpace)sr.lookup(tmpl);

    if(space == null) System.out.println("No JavaSpace!");
    else System.out.println(space.toString());
    }

} {code}

And the invocation is: {code} hostname:~/Desktop/gigaspaces-xapcommunity-6.6.1-ga> java -Djava.security.policy=policy/policy.all -classpath lib/jini/jsk-lib.jar:lib/jini/jsk-platform.jar:. JavaSpaces myspace Exception in thread "main" java.io.StreamCorruptedException: invalid stream header: 00ACED00 at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783) at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280) at sun.rmi.server.MarshalInputStream.<init>(MarshalInputStream.java:107) at java.rmi.MarshalledObject$MarshalledObjectInputStream.<init>(MarshalledObject.java:283) at java.rmi.MarshalledObject.get(MarshalledObject.java:140) at net.jini.core.discovery.LookupLocator.getRegistrarFromSocket(LookupLocator.java:375) at net.jini.core.discovery.LookupLocator.getRegistrar(LookupLocator.java:331) at net.jini.core.discovery.LookupLocator.getRegistrar(LookupLocator.java:288) at JavaSpaces.main(JavaSpaces.java:21) {code}

Java version is: java version "1.6.0_10" Java(TM) SE Runtime Environment (build 1.6.0_10-b33) Java HotSpot(TM) 64-Bit Server VM (build 11.0-b15, mixed mode)

answered 2008-11-24 14:42:25 -0500

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2008-11-24 14:18:52 -0500

Seen: 433 times

Last updated: Nov 30 '08