-
1. Re: Chunk overflow error
eileen407 Sep 2, 2003 5:10 PM (in response to eileen407)Hi Francisco,
Thanks for all your help! Unfortunately, I'm already doing all the things you've suggested, i.e. using PortableRemoteObject.narrow(), the correct classpath, same command line options, security policy set to AllPermissions, etc. I've tried the option using rmi generated stubs + sun orb fix, but jacOrb doesn't look like it's picking up the stubs. I've also removed all stubs from the classpath. Both ways, I'm still getting the same NullPointerException. Are there any flags I can add to get more debugging information?
My code looks like this:
SesHome sesHome =
(SesHome) PortableRemoteObject.narrow
(context.lookup("SesHome"), SesHome.class);
ses = sesHome.create();
The NullPointerException is coming from the create().
Here's my commandline:
CLASSPATH=${JAS_HOME}/classes:${JBOSS_JARS}/jacorb.jar:${JBOSS_JARS}/jboss-client.jar:${JBOSS_JARS}/jbo
ss-common-client.jar:${JBOSS_JARS}/jboss-iiop-client.jar:${JBOSS_JARS}/jboss-j2ee.jar:${JBOSS_JARS}/log
4j.jar:${JAS_HOME}/jars/xerces.jar
NAMING_PROVIDER=corbaloc::lifeboat:3528/JBoss/Naming/root
JNDI_CLASS=com.sun.jndi.cosnaming.CNCtxFactory
PROPS="-Djava.security.manager -Djava.security.policy=${JAS_HOME}/config/client.policy -Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB -Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton -Djacorb.verbosity=1 -Djacorb.suppress_no_props_warning=on"
JAVA="$JAVA_HOME/bin/java -Xmx100m -Djava.naming.factory.initial=${JNDI_CLASS} -Djava.naming.provider.url=${NAMING_PROVIDER} ${PROPS}" -
2. Create Durable Subscription at runtime when clientID is in u
ricardotemporal Sep 2, 2003 5:10 PM (in response to eileen407)Hello,
we have an application where each user has ists own queue and each user-group has its own topic. when i put a user into a group i need to add a durable subscription for the user on the topic associated with that group. the -service.xml file of the topic allows every member of the group to create a durable subscription.
i add a member to a group by getting the DynamicStateManager mbean and calling addUserToRole() on it. afterwards i call saveConfig().
i actually create the subscription for "newMember" on "groupTopic" using the following code:Context ctx = null; TopicConnection topicConnection = null; TopicSession topicSession = null; TopicSubscriber subscriber = null; try { Hashtable env = new Hashtable(); env.put(Context.PROVIDER_URL, providerURL); env.put(Context.SECURITY_PRINCIPAL, principal); env.put(Context.SECURITY_CREDENTIALS, credentials); ctx = new InitialContext(env); TopicConnectionFactory factory = (TopicConnectionFactory) ctx.lookup(connectionFactory); topicConnection = factory.createTopicConnection(principal, credentials); topicConnection.setClientID(newMember); topicSession = topicConnection.createTopicSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE); Topic messageTopic = (Topic)ctx.lookup(groupTopic); subscriber = topicSession.createDurableSubscriber(messageTopic, groupTopic, null, true); // getStateManager() returns the statemanager mbean getStateManager().saveConfig(); } catch (Exception e) { e.printStackTrace(); } finally { if (subscriber != null) subscriber.close(); if (topicSession != null) try { topicSession.close(); } catch (JMSException e) {} if (topicConnection != null) try { topicConnection.close(); } catch (JMSException e) {} if (ctx != null) try { ctx.close(); } catch (Exception e) {} }
the code above works fine if the clientId (newMember) is not in use. so i check this first and if it is in use i only use the statemanager procedure above - giving the user the permission to create its durable subscription when it logs in the next time.
but when he tries to do the following exception is thrown:
javax.jms.JMSSecurityException: Connection not authorized to do durable subscription on topic: g7000
at org.jboss.mq.security.ServerSecurityInterceptor.subscribe(ServerSecurityInterceptor.java:142)
at org.jboss.mq.server.TracingInterceptor.subscribe(TracingInterceptor.java:816)
at org.jboss.mq.server.JMSServerInvoker.subscribe(JMSServerInvoker.java:297)
at org.jboss.mq.il.uil2.ServerSocketManagerHandler.handleMsg(ServerSocketManagerHandler.java:160)
at org.jboss.mq.il.uil2.SocketManager$ReadTask.handleMsg(SocketManager.java:355)
at org.jboss.mq.il.uil2.msgs.BaseMsg.run(BaseMsg.java:377)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:732)
at java.lang.Thread.run(Thread.java:536)
what am i missing here. do i have to restart the topic (which i cannot do because there may be users logged in using it)? are there any sideeffects in the statemanager i do not know? is there another, more preferable method to create a durable subscription? i use jboss 3.2.3.
any idea would be appreciated.
ingo -
3. Re: Chunk overflow error
reverbel Sep 2, 2003 5:10 PM (in response to eileen407)Hi Francisco,
Thanks for all your help! Unfortunately, I'm already doing all the things you've suggested, i.e. using PortableRemoteObject.narrow(), the correct classpath, same command line options, security policy set to AllPermissions, etc. I've tried the option using rmi generated stubs + sun orb fix, but jacOrb doesn't look like it's picking up the stubs. I've also removed all stubs from the classpath. Both ways, I'm still getting the same NullPointerException. Are there any flags I can add to get more debugging information?
My code looks like this:
SesHome sesHome =
(SesHome) PortableRemoteObject.narrow
(context.lookup("SesHome"), SesHome.class);
ses = sesHome.create();
The NullPointerException is coming from the create().
Here's my commandline:
CLASSPATH=${JAS_HOME}/classes:${JBOSS_JARS}/jacorb.jar:${JBOSS_JARS}/jboss-client.jar:${JBOSS_JARS}/jbo
ss-common-client.jar:${JBOSS_JARS}/jboss-iiop-client.jar:${JBOSS_JARS}/jboss-j2ee.jar:${JBOSS_JARS}/log
4j.jar:${JAS_HOME}/jars/xerces.jar
NAMING_PROVIDER=corbaloc::lifeboat:3528/JBoss/Naming/root
JNDI_CLASS=com.sun.jndi.cosnaming.CNCtxFactory
PROPS="-Djava.security.manager -Djava.security.policy=${JAS_HOME}/config/client.policy -Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB -Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton -Djacorb.verbosity=1 -Djacorb.suppress_no_props_warning=on"
JAVA="$JAVA_HOME/bin/java -Xmx100m -Djava.naming.factory.initial=${JNDI_CLASS} -Djava.naming.provider.url=${NAMING_PROVIDER} ${PROPS}" -
4. Re: Chunk overflow error
reverbel Sep 3, 2003 7:32 AM (in response to eileen407)Where did you get the exception, at the server side or at the client side? Which ORB are you using at the client side?
Francisco -
5. Re: Chunk overflow error
eileen407 Sep 3, 2003 4:18 PM (in response to eileen407)The exception is on the client side. I am using the Sun orb. I tried using JacOrb on the client side, but when I did the look up, it would always retrieve an object of type org.jacorb.orb.Reference. With the Sun orb, every works fine except for this MarshalException
-
6. Re: Chunk overflow error
eileen407 Sep 3, 2003 4:45 PM (in response to eileen407)I just noticed that JBoss reports this warning when I start up:
WARNING: no properties file found! This warning can be ignored
for applets. A file file called "jacorb.properties" or
".jacorb_properties" should be present in the classpath,
but when I put the properties file in my home directory, the iiop service is unable to startup because of an ArrayOutOfBounds error. -
7. Re: Chunk overflow error
reverbel Sep 4, 2003 10:56 AM (in response to eileen407)This message does not show up anymore, you are probably using an older version of JBoss. Switch to 3.2.1 or 3.2.2RC3.
Francisco -
8. Re: Chunk overflow error
eileen407 Sep 4, 2003 1:07 PM (in response to eileen407)Hi Francisco,
Thanks for your help.
I'm using JBoss 3.2.2RC3, and I never saw the ClassCastExceptions that you descibe with the Sun orb. With the Sun orb, the client is able to cast the results of the client call to a Vector, but the size of the Vector is always zero, and I get this MarshalException. What does the "Chunk overflow" refer to?
I'm tried jacOrb on the client side again. I removed all stubs from the client classpath, and gave the client AllPermission. I copied the setup from one of your previous postings.
NAMING_PROVIDER=corbaloc::lifeboat:3528/JBoss/Naming/root
JNDI_CLASS=com.sun.jndi.cosnaming.CNCtxFactory
PROPS="-Djava.security.manager"
PROPS="${PROPS} -Djava.security.policy=${HOME}/config/client.policy"
PROPS="${PROPS} -Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB"
PROPS="${PROPS} -Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton"
PROPS="${PROPS} -Djacorb.verbosity=1"
PROPS="${PROPS} -Djacorb.suppress_no_props_warning=on"
PROPS="${PROPS} -Djacorb.hashtable_class=java.util.Hashtable"
PROPS="${PROPS} -Djacorb.security.ssl.client.required_options=0"
PROPS="${PROPS} -Djacorb.security.ssl.client.supported_options=0"
Here are the results:
[ Connected to 10.5.8.96:3528 from local port 63038 ]
looking up the Ses home
obj class : class org.jacorb.orb.Reference
SesHome class : interface foo.SesHome
Is obj assignable to SesHome : false
Exception in thread "main" java.rmi.RemoteException: Failure creating bean java.lang.NullPointerException
The client isn't dynamically downloading the stubs. -
9. Re: Chunk overflow error
reverbel Sep 4, 2003 1:53 PM (in response to eileen407)The code I have pasted in my previous message contains superfluous lines. This is all you need in class FixSunDelegateBug:
public class FixSunDelegateBug
extends com.sun.corba.se.internal.iiop.ShutdownUtilDelegate {
public boolean isLocal(javax.rmi.CORBA.Stub stub)
throws java.rmi.RemoteException {
try {
org.omg.CORBA.portable.Delegate delegate = stub._get_delegate();
return delegate.is_local(stub);
}
catch (org.omg.CORBA.SystemException e) {
throw javax.rmi.CORBA.Util.mapSystemException(e);
}
}
}
This class simply extends Sun's implementation (ShutdownUtilDelegate)
and overrides isLocal() to do the right thing. Use it with JDK 1.4
("-Djavax.rmi.CORBA.UtilClass=FixSunDelegateBug") to circumvent the isLocal() bug.
Francisco -
10. Re: Chunk overflow error
reverbel Sep 4, 2003 3:01 PM (in response to eileen407)> I'm using JBoss 3.2.2RC3, and I never saw the
> ClassCastExceptions that you descibe with the Sun
> orb.
That is correct, you shouldn't see it with Sun's ORB. I would expect you to see a ClassCastException within an isLocal() call at the client side under the following conditions:
1) You use Sun's JDK 1.4.x, but you don't use the Sun's ORB. Instead, you specify another ORB, such as JacORB, by saying something like "-Dorg.omg.CORBA.ORBClass=..".
2) You use RMI/IIOP stubs generated with "rmic -iiop".
> With the Sun orb, the client is able to cast
> the results of the client call to a Vector, but the
> size of the Vector is always zero, and I get this
> MarshalException. What does the "Chunk overflow"
> refer to?
IIOP breaks valuetypes into pieces called "chunks".
> I'm tried jacOrb on the client side again.
> ... [snip]
> Here are the results:
> [ Connected to 10.5.8.96:3528 from local port 63038
> ]
> looking up the Ses home
> obj class : class org.jacorb.orb.Reference
> SesHome class : interface foo.SesHome
> Is obj assignable to SesHome : false
So far so good.
> Exception in thread "main" java.rmi.RemoteException:
> Failure creating bean java.lang.NullPointerException
Are you trying to assign obj to SesHome by any chance? You should use PortableRemoteObject.narrow, as indicated below:
FooHome home = (FooHome)PortableRemoteObject.narrow(obj, FooHome.class);
> The client isn't dynamically downloading the stubs.
The call to PortableRemoteObject..narrow should cause a stub to be downloaded. Make sure you have the JBoss client jars in the client classpath, as well as the jacorb.jar file included in the JBoss distro.
To start a client that downloads IIOP stubs from JBoss, use a command line like this:
java -Djava.security.manager -Djava.security.policy=./client.policy -Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB -Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton -classpath .:$JBOSS_HOME/client/jacorb.jar:$JBOSS_HOME/client/jboss-client.jar:$JBOSS_HOME/client/jboss-common-client.jar:$JBOSS_HOME/client/jboss-iiop-client.jar:$JBOSS_HOME/client/jboss-j2ee.jar YourClient
To start a client that runs on JDK 1.4 and uses rmic-generated IIOP stubs (instead of downloading the stubs from JBoss), use a command line like this:
java -Djavax.rmi.CORBA.UtilClass=FixSunDelegateBug -Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB -Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton -classpath .:$JBOSS_HOME/client/jacorb.jar:$JBOSS_HOME/client/jboss-client.jar:$JBOSS_HOME/client/jboss-common-client.jar:$JBOSS_HOME/client/jboss-iiop-client.jar:$JBOSS_HOME/client/jboss-j2ee.jar YourClient
Good luck!
Francisco -
11. Re: bug in JacOrb?
eileen407 Sep 9, 2003 12:54 PM (in response to eileen407)I have jacOrb successfully running on the client side, but I'm still getting a marshalException when returning my vector of objects. It's now complaining of an "unknown value tag" (see below). I believe there's probably a bug in the way jacOrb is serializing this Vector. I would like to try Sun's orb in jboss to test this theory. Does anyone know how this would be set up in iiop-service.xml?
Thanks.
java.rmi.MarshalException: CORBA MARSHAL 0 No;
nested exception is:
org.omg.CORBA.MARSHAL: unknown value tag: 83efa432 vmcid: 0x0 minor code: 0
completed: No
java.rmi.MarshalException: CORBA MARSHAL 0 No; nested exception is:
org.omg.CORBA.MARSHAL: unknown value tag: 83efa432 vmcid: 0x0 minor code: 0
completed: No
at com.sun.corba.se.internal.iiop.ShutdownUtilDelegate.mapSystemException(Shu
tdownUtilDelegate.java:97)
at javax.rmi.CORBA.Util.mapSystemException(Util.java:65)
at org.jboss.proxy.ejb.DynamicIIOPStub.invoke(DynamicIIOPStub.java:138)
at _Foo_Stub.findLargeFoos(Unknown Source)
at driver.doLargeFoos(FooAgent.java:168)
at driver.FooAgent.run(FooAgent.java:128)
Caused by: org.omg.CORBA.MARSHAL: unknown value tag: 83efa432 vmcid: 0x0 minor code
: 0 completed: No
at org.jacorb.orb.CDRInputStream.read_value(CDRInputStream.java:1978)
at com.sun.corba.se.internal.io.IIOPInputStream.inputObjectField(IIOPInputStr
eam.java:1577)
at com.sun.corba.se.internal.io.IIOPInputStream.inputClassFields(IIOPInputStr
eam.java:1796)
at com.sun.corba.se.internal.io.IIOPInputStream.inputObject(IIOPInputStream.j
ava:913)
at com.sun.corba.se.internal.io.IIOPInputStream.simpleReadObject(IIOPInputStr
eam.java:261)
at com.sun.corba.se.internal.io.ValueHandlerImpl.readValueInternal(ValueHandl
erImpl.java:247)
at com.sun.corba.se.internal.io.ValueHandlerImpl.readValue(ValueHandlerImpl.j
ava:209)
at org.jacorb.util.ValueHandler.readValue(ValueHandler.java:25)
at org.jacorb.orb.CDRInputStream.read_untyped_value(CDRInputStream.java:2186)
at org.jacorb.orb.CDRInputStream.read_typed_value(CDRInputStream.java:2219)
at org.jacorb.orb.CDRInputStream.read_value(CDRInputStream.java:1870)
at org.jacorb.orb.Any.read_value(Any.java:804)