2012-12-12 65 views
1

我已經編寫了一個針對Websphere Application Server消息主題的小客戶機測試程序。 所有工作正常。 現在,如果我打開管理安全性,我得到一個錯誤。如何在啓用管理安全性的情況下連接到Websphere Application Server 8.5 Message Queue

這是我使用的代碼。

public static void main(String[] args) 
    { 
    try { 
    /** 
    * Lookup connection factory object using jndi 
    */ 
    System.out.println("* Looking up CF in jndi..."); 
    Hashtable env = new Hashtable(); 

    env.put(Context.PROVIDER_URL, "iiop://192.168.195.144:2809"); 
    env.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory"); 

    Context ctx = new InitialContext(env); 

    TopicConnectionFactory fact=(TopicConnectionFactory)ctx.lookup("jms/Ttestsecure"); 
    TopicConnection connect = fact.createTopicConnection(); 
    TopicSession session=connect.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); 
    Topic topic=null; 
    try 
    { 
     topic =(Topic) ctx.lookup("jms/Totestsecure"); 
     System.out.println(topic.getTopicName()); 

    } 

的這裏是我得到

在JNDI仰望CF錯誤... JSAS1480I:模具Sicherheit北京時間nicht aktiviert,韋爾死ConfigURL-Eigenschaftendatei nicht definiert IST。 javax.naming.NamingException中:錯誤獲取WsnNameService性質[根異常是org.omg.CORBA.TRANSIENT:初始和轉發IOR難以接近vmcid:IBM次要代碼:E07完成:否] 在com.ibm.ws.naming.util .WsnInitCtxFactory.mergeWsnNSProperties(WsnInitCtxFactory.java:1552) 在com.ibm.ws.naming.util.WsnInitCtxFactory.getRootContextFromServer(WsnInitCtxFactory.java:1042) 在com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory的.java:962) 在com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:614) 在com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:128) 在com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:765) 在com.ibm.ws.nam在javax.naming.InitialContext.lookup(InitialContext.java:int)中查找(wsnInitCtx.java:179) (http://support.microsoft.com/default.aspx?scid=fh;en-us;;;;;;;;;;;;;;;) 436) at testmsg.main(testmsg.java:31) 由org.omg.CORBA.TRANSIENT引起:初始和轉發的IOR無法訪問vmcid:IBM次要代碼:E07已完成:否 at com.ibm.rmi.corba .ClientDelegate.createRequest(ClientDelegate.java:1276) at com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1457) at com.ibm.rmi.corba.ClientDelegate.createRequest(ClientDelegate.java:1164 ) 在com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1423) 在com.ibm.rmi.corba.ClientDelegate.request(ClientDelegate.java:1886) at com.ibm.CORBA.iiop.ClientDelegate.request(ClientDelegate.java:1379) at org.omg.CORBA.portable.ObjectImpl._request(ObjectImpl.java:458) at com.ibm.WsnBootstrap._WsnNameServiceStub。 getProperties(_WsnNameServiceStub.java:38) at com.ibm.ws.naming.util.WsnInitCtxFactory.mergeWsnNSProperties(WsnInitCtxFactory.java:1549) ... 9更多 導致:java.net.ConnectException:connect:Address is在本地計算機上無效,或端口在遠程計算機上無效 at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:381) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:243) at java.net .PlainSocketImpl.connect(PlainSocketImpl.java:230) 在java.net.SocksSocketI mp.connect(SocksSocketImpl.java:377) at java.net.Socket.connect(Socket.java:539) at com.ibm.ws.orbimpl.transport.WSTCPTransportConnection.createSocket(WSTCPTransportConnection.java:313) at com.ibm.CORBA.transport.TransportConnectionBase.connect(TransportConnectionBase.java:357) at com.ibm.ws.orbimpl.transport.WSTransport.getConnection(WSTransport.java:436) at com.ibm.CORBA.transport。 TransportBase.getConnection(TransportBase.java:187) 在com.ibm.rmi.iiop.TransportManager.get(TransportManager.java:97) 在com.ibm.rmi。iiop.GIOPImpl.getConnection(GIOPImpl.java:130) 在com.ibm.rmi.iiop.GIOPImpl.locate(GIOPImpl.java:219) 在com.ibm.rmi.corba.ClientDelegate.locate(ClientDelegate.java: 1983) at com.ibm.rmi.corba.ClientDelegate._createRequest(ClientDelegate.java:2008) at com.ibm.rmi.corba.ClientDelegate.createRequest(ClientDelegate.java:1186) at com.ibm.rmi。 corba.ClientDelegate.createRequest(ClientDelegate.java:1272) ... 17更多 我不是很熟悉websphere服務器有任何人建議什麼是錯誤的? 我只打開了管理安全說明的公交安全。 如果我關閉所有常規作品。

感謝您的任何提示。

回答

3

你得到了異常指示您沒有設置ConfigURL客戶端

JSAS1480I:安全性未啓用,因爲ConfigURL屬性文件 未設置。

Explanation The com.ibm.CORBA.ConfigURL property specified in setupCmdLine.bat or on the java command line is not set. 
Action To enable security, set the com.ibm.CORBA.ConfigURL property to a properties file which exists, such as the sas.client.props file. 

你缺少

-Dcom.ibm.CORBA.ConfigURL=file:///home/user1/sas.client.props 

您可以在信息中心閱讀說明書:Running the IBM Thin Client for Enterprise JavaBeans (EJB)

+0

非常感謝。我在ssl config中遇到了一些問題,但知道它的工作原理 – user1897869

相關問題