论坛首页 入门技术论坛

请教连接weblogic8.1的jndi程序出错的问题

浏览 2006 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2008-01-29  
我在weblgoic上建立了mysql的数据库连接池成功,并建立数据源test,jndi名字为:MYJNDI。然后在另外一台机子编写程序去连接:
程序如下:
try {
			Hashtable   env   =   new Hashtable();  
            env.put(Context.INITIAL_CONTEXT_FACTORY,   "weblogic.jndi.WLInitialContextFactory");  
            env.put(Context.PROVIDER_URL,   "t3://192.168.0.90:7001");  
            env.put(Context.SECURITY_PRINCIPAL, "weblogic");
            env.put(Context.SECURITY_CREDENTIALS,"weblogic");
			Context ctx = new InitialContext(env);
			DataSource ds = (DataSource) ctx.lookup("MYJNDI");
			if(ds != null) {
					System.out.println("***********" + ds.toString());
				Connection con = ds.getConnection(); 
				Statement  st = con.createStatement();
				ResultSet rs = st.executeQuery("select * from acl_user");
	
	            while(rs.next())   {  
	                    System.out.println(rs.getInt(1)   +   "\t"   +   rs.getString(2));  
	            }   
			}else {
				System.out.println("cannot find !!!!");
			}
		}catch (Exception ex) {
			ex.printStackTrace();
		}

结果是运行到Connection con = ds.getConnection(); 这行的时候出错了,出现的异常如下:
***********IOR:0000000000000044524d493a7765626c6f6769632e6a6462632e636f6d6d6f6e2e696e7465726e616c2e52656d6f746544617461536f757263653a30303030303030303030303030303030000000000100000000000004a0000102000000000d3139322e3136382e302e393000001b59000000880042454108010300000000096367536572766572000000000000000000000044524d493a7765626c6f6769632e6a6462632e636f6d6d6f6e2e696e7465726e616c2e52656d6f746544617461536f757263653a303030303030303030303030303030300000000004323739000000000142454128000000100000000000000000032ce7a9ccd193ec00000006000000010000002c0000000000010020000000030001002000010001050100010001010000000003000101000001010905010001000000190000003b0000000000000033687474703a2f2f3139322e3136382e302e39303a373030312f6265615f776c735f696e7465726e616c2f636c61737365732f00000000001f000000040000000300000020000000040000000100000021000000c800010000000000020006000000000024000000200000006600060000000000010000000d3139322e3136382e302e393000001b5a004000000000000806066781020101010000001f0401000806066781020101010000000f7765626c6f67696344454641554c540000000000000000000000000000000000000000000000002200000000004000000000000806066781020101010000001f0401000806066781020101010000000f7765626c6f67696344454641554c5400000000000000000000000000000000004245410300000290000000000000000c726f756e642d726f62696e00000000000000000a6d7973716c4a4e44490000000000000100000044524d493a7765626c6f6769632e6a6462632e636f6d6d6f6e2e696e7465726e616c2e52656d6f746544617461536f757263653a3030303030303030303030303030303000000000010000000000000208000102000000000d3139322e3136382e302e393000001b59000000880042454108010300000000096367536572766572000000000000000000000044524d493a7765626c6f6769632e6a6462632e636f6d6d6f6e2e696e7465726e616c2e52656d6f746544617461536f757263653a303030303030303030303030303030300000000004323739000000000142454128000000100000000000000000032ce7a9ccd193ec00000005000000010000002c0000000000010020000000030001002000010001050100010001010000000003000101000001010905010001000000190000003b0000000000000033687474703a2f2f3139322e3136382e302e39303a373030312f6265615f776c735f696e7465726e616c2f636c61737365732f00000000001f000000040000000300000020000000040000000100000021000000c800010000000000020006000000000024000000200000006600060000000000010000000d3139322e3136382e302e393000001b5a004000000000000806066781020101010000001f0401000806066781020101010000000f7765626c6f67696344454641554c540000000000000000000000000000000000000000000000002200000000004000000000000806066781020101010000001f0401000806066781020101010000000f7765626c6f67696344454641554c540000000000000000000000000000000000ffffffffccd193ec
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.mapSystemException(ShutdownUtilDelegate.java:97)
	at javax.rmi.CORBA.Util.mapSystemException(Util.java:65)
	at weblogic.jdbc.common.internal._RemoteDataSource_Stub.getConnection(Unknown Source)
	at com.monipro.jnditest.JndiStartUpListener.contextInitialized(JndiStartUpListener.java:32)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
	at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)
	at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
	at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
	at org.apache.catalina.core.StandardService.start(StandardService.java:480)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
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(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
	at java.lang.Class.newInstance0(Class.java:308)
	at java.lang.Class.newInstance(Class.java:261)
	at com.sun.corba.se.internal.iiop.messages.ReplyMessage_1_2.getSystemException(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)
	... 27 more

其中
at com.monipro.jnditest.JndiStartUpListener.contextInitialized(JndiStartUpListener.java:32)
指的就是
Connection con = ds.getConnection();这行错误

请教这问题怎么解决啊?
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics