Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
336 views
in Technique[技术] by (71.8m points)

jms - How to connect to a websphere Application Server 8.5 Message Queue while Administrative Security is enabled

i have written a little client test programm running against a Websphere Applicationserver Message Topic. All works fine. Now, if i am turning on the administrative security i got an error.

That's the code i am using.

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());

    }

An here's the error i am getting

Looking up CF in jndi... JSAS1480I: Die Sicherheit ist nicht aktiviert, weil die ConfigURL-Eigenschaftendatei nicht definiert ist. javax.naming.NamingException: Error getting WsnNameService properties [Root exception is org.omg.CORBA.TRANSIENT: initial and forwarded IOR inaccessible vmcid: IBM minor code: E07 completed: No] at com.ibm.ws.naming.util.WsnInitCtxFactory.mergeWsnNSProperties(WsnInitCtxFactory.java:1552) at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootContextFromServer(WsnInitCtxFactory.java:1042) at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:962) at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:614) at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:128) at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:765) at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:164) at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:179) at javax.naming.InitialContext.lookup(InitialContext.java:436) at testmsg.main(testmsg.java:31) Caused by: org.omg.CORBA.TRANSIENT: initial and forwarded IOR inaccessible vmcid: IBM minor code: E07 completed: No 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) at com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1423) at 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 more Caused by: java.net.ConnectException: connect: Address is invalid on local machine, or port is not valid on remote machine at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:381) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:243) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:230) at java.net.SocksSocketImpl.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) at com.ibm.rmi.iiop.TransportManager.get(TransportManager.java:97) at com.ibm.rmi.iiop.GIOPImpl.getConnection(GIOPImpl.java:130) at com.ibm.rmi.iiop.GIOPImpl.locate(GIOPImpl.java:219) at 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 more I'am not very familiar with the websphere Server has anybody an advice what is going wrong ? I have only turned on the administrative security note the bus security. If i turn i off all works regular.

Thanks for any hint.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The exception you got indicates you did not set the ConfigURL for the client

JSAS1480I: Security is not enabled because the ConfigURL property file is not set.

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.

You are missing

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

You can read the instructions on the Info Center: Running the IBM Thin Client for Enterprise JavaBeans (EJB)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...