How to connect to the Application Server 8.5 Message Queue web server with administrative security enabled

I wrote a small client test program that works with the Websphere Application Server theme. Everything is working fine. Now, if I enable administrative security, I got an error.

This is the code I'm 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()); } 

Here is the error I get

A look at CF in jndi ... JSAS1480I: Die Sicherheit ist nicht aktiviert, weil die ConfigURL-Eigenschaftendatei nicht definiert ist. javax.naming.NamingException: Error retrieving WsnNameService properties [Root exception is org.omg.CORBA.TRANSIENT: starting and redirected IOR unavailable vmcid: IBM junior code: E07 completed: none] at com.ibm.ws.naming.util.WsnInitCtxactory .mergeWsnNProperties (WsnInitCtxFactory.java:1552) at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootContextFromServer (WsnInitCtxFactory.java:tn.jtnitjitnit.itnitjitnut.itnitjitnit.ittit.itnitjitnut.ittit.itnitjitnit.ittit.jtnititutilutitutilutiluti ) at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal (WsnInitCtxFactory.java:614) at com.ibm.ws.naming.util.WsnInitCtx.getContext (WsnInitCtx.java:m.12.m naming.util.WsnInitCtx.getContextIfNull (WsnInitCtx.java:765) at com.ibm.ws.naming.util.WsnInitCtx.lookup (WsnInitCtx.java:164) at com.ibm.ws.naming.util.ts.ns.t.s. WsnInitCtx.java:179) in javax.nam ing.InitialContext.lookup (InitialContext.java:436) on testmsg.main (testmsg.java:31) Called: org.omg.CORBA.TRANSIENT: starting and redirected IOR unavailable vmcid: junior IBM 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.ClientDelegatecreate .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 (_Wsnowname .ibm.ws.naming.util.WsnInitCtxFactory.mergeWsnNSProperties (WsnInitCtxFacto ry.java:1549) ... 9 more Reason: java.net.ConnectException: connect: address is not valid on the local computer, or the port is not valid on the remote machine on java.net.PlainSocketImpl.doConnect (PlainSocketImpl.javahaps81) in java .net.PlainSocketImpl.connectToAddress (PlainSocketImpl.java:243) on java.net.PlainSocketImpl.connect (PlainSocketImpl.java:230) on java.net.SocksSocketImpl.connect (SocksSocketImpl.javahaps77) on java.net.Socket. connect (Socket.javaPoint39) on com.ibm.ws.orbimpl.transport.WSTCPTransportConnection.createSocket (WSTCPTransportConnection.java data13) on com.ibm.CORBA.transport.TransportConnectionBase.connect (TransportConnectionBase.javahaps57) on 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.TransportManage r.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.createestququReRequate .java: 1186) at com.ibm.rmi.corba.ClientDelegate.createRequest (ClientDelegate.java:1272) ... 17 more I am not very familiar with the websphere server. Does anyone know what is going wrong? I just turned on the bus security administrative security note. If I turn off all the usual work.

Thanks for any hint.

+1
source share
1 answer

Exception thrown by you means that you did not set 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 lacking

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

You can read the instructions at the Infocenter: Starting IBM Thin Client for Enterprise JavaBeans (EJB)

+3
source

Source: https://habr.com/ru/post/1242739/


All Articles