here is the source code I'm running.
public class rmitest extends Object
{
public static void main(String args[])
{
try
{
Properties p = new Properties();
p.put( Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
p.put( Context.PROVIDER_URL, "iiop://mymachine:7001");
Context ic = new InitialContext(p);
Object obj = ic.lookup("myJNDIDatasource");
DataSource ds = (DataSource)javax.rmi.PortableRemoteObject.narrow(obj,DataSource.class);
Connection ct = ds.getConnection();
StringBuffer buf = new StringBuffer("");
buf.append("SELECT SYSDATE from DUAL ");
PreparedStatement stmt = ct.prepareStatement(buf.toString());
ResultSet rs=stmt.executeQuery();
if (rs.next())
{
System.out.println("Executed query");
}
else
{
throw new Exception("error ");
}
rs.close();
stmt.close();
ct.close();
ic.close();
}
catch(Throwable t)
{
t.printStackTrace();
}
}
}
I followed the instructions on "Using RMI over IIOP..." from weblogic 8.1 edocs
(http://e-docs.bea.com/wls/docs81/rmi_iiop/rmiiiop2.html#1071450), which suggest
the use of wlclient.jar or wljmsclient.jar.
Here is the stacktrace.
java.rmi.MarshalException: CORBA MARSHAL 0 Maybe; nested exception is:
org.omg.CORBA.MARSHAL: vmcid: 0x0 minor code: 0 completed: Maybe
at com.sun.corba.se.internal.iiop.ShutdownUtilDelegate.mapSystemExceptio
n(ShutdownUtilDelegate.java:97)
at javax.rmi.CORBA.Util.mapSystemException(Util.java:65)
at weblogic.jdbc.common.internal._RemoteDataSource_Stub.getConnection(Un
known Source)
at rmitest.main(rmitest.java:40)
Caused by: org.omg.CORBA.MARSHAL: vmcid: 0x0 minor code: 0 completed: Maybe
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:306)
at java.lang.Class.newInstance(Class.java:259)
at com.sun.corba.se.internal.iiop.messages.ReplyMessage_1_2.getSystemExc
eption(ReplyMessage_1_2.java:90)
at com.sun.corba.se.internal.iiop.ClientResponseImpl.getSystemException(
ClientResponseImpl.java:105)
at com.sun.corba.se.internal.corba.ClientDelegate.invoke(ClientDelegate.
java:314)
at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:457)
... 2 more
I'm running Weblogic 8.1 SP1 on Windows XP Professional.
JDK 1.4.1_03 on the client side.
Does anybody know what's wrong with it?
When I change it to use the t3 protocol it works fine.
Thanks for your time.
Jose
> I'm getting an exception java.rmi.MarshallException when trying to access a DataSource
> thru JNDI lookup using the iiop protocol.
DataSource is not a conformant RMI interface or object, it is not
supportable under IIOP in its current form. It only works under t3
through a proprietary extension to RMI.
andy
--
Another question then:
Do I have to place the weblogic.jar in the classpath in order to be able to use
the t3 protocol to have access to a DataSource?
I tried the wlclient.jar and wljmsclient.jar without success.
My goal with this is to have a standard way to access a DataSource so I can:
1- Have minimal or none extra deployment of jar files to my Java client app
2- Be able to support different App Servers (WebLogic, WebSphere at least).
Thanks again.
Jose
> Another question then:
> Do I have to place the weblogic.jar in the classpath in order to be able to use
> the t3 protocol to have access to a DataSource?
Yes
> I tried the wlclient.jar and wljmsclient.jar without success.
These use RMI-IIOP under the covers
> My goal with this is to have a standard way to access a DataSource so I can:
> 1- Have minimal or none extra deployment of jar files to my Java client app
This may be difficult to achieve. You could probably get round this by
writing a remote proxy for the datasource.
andy
--
Jose