老大, 那包基本是一堆接口, 属于JNDI(rt.jar里面可以找到). 它用Factory的方式来创建Context, 你需要提供些信息(可以在System.properties里, 也可以是个配置文件), 你可以参考下面的配置文件(jndiprovider.properties): # Provider resource file for the LDAP service provider.# Factory for the response controls supported by this release. java.naming.factory.control=com.sun.jndi.ldap.ctl.ResponseControlFactory# AttrsToCorba: Turn entry with corbaObject objectclass into a org.omg.CORBA.Object # MarshalledToObject: Turn entry with javaMarshalledObject into UnmarshalledObject java.naming.factory.object=com.sun.jndi.ldap.obj.AttrsToCorba:com.sun.jndi.ldap.obj.MarshalledToObject# RemoteToAttrs: Turn RMI/JRMP and RMI/IIOP object into javaMarshalledObject or # corbaObject LDAP entry # CorbaToAttrs: Turn CORBA object into corbaObject LDAP entry # RemoteToCorbaToAttrs: Turn RMI/IIOP object into corbaObject LDAP entry. # Note that there is no need to specify this in list unless RemoteToAttrs is # removed because RemotetoAttrs already handles this case java.naming.factory.state=com.sun.jndi.ldap.obj.RemoteToAttrs:com.sun.jndi.ldap.obj.CorbaToAttrs如果你的程序里需要名字服务, 那你至少得先知道provider什么的, 不知道websphere有没有类似的properties文件, 找找看, 100%有 :)
# Provider resource file for the LDAP service provider.# Factory for the response controls supported by this release.
java.naming.factory.control=com.sun.jndi.ldap.ctl.ResponseControlFactory# AttrsToCorba: Turn entry with corbaObject objectclass into a org.omg.CORBA.Object
# MarshalledToObject: Turn entry with javaMarshalledObject into UnmarshalledObject
java.naming.factory.object=com.sun.jndi.ldap.obj.AttrsToCorba:com.sun.jndi.ldap.obj.MarshalledToObject# RemoteToAttrs: Turn RMI/JRMP and RMI/IIOP object into javaMarshalledObject or
# corbaObject LDAP entry
# CorbaToAttrs: Turn CORBA object into corbaObject LDAP entry
# RemoteToCorbaToAttrs: Turn RMI/IIOP object into corbaObject LDAP entry.
# Note that there is no need to specify this in list unless RemoteToAttrs is
# removed because RemotetoAttrs already handles this case
java.naming.factory.state=com.sun.jndi.ldap.obj.RemoteToAttrs:com.sun.jndi.ldap.obj.CorbaToAttrs如果你的程序里需要名字服务, 那你至少得先知道provider什么的, 不知道websphere有没有类似的properties文件, 找找看, 100%有 :)
#comments jms properties file
com.sun.jms.internal.java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory
com.sun.jms.internal.java.naming.provider.url=com.sun.jms.client.transport_preference=IIOP#Possible values are SEVERE,WARNING,INFO, FINE, FINER, FINEST.
com.sun.jms.default.loglevel=WARNING
第一个一定要有哦~ 在你new一个InitialContext的时候, 它自己会去找相关信息的 :)
如果还不行, 你就去sun看看JNDI方面的资料吧 ...* 老大, 好消息, 我终于成功的打入了敌人的内部, 呵呵 ...
wM+08ywgztLV4rb5tcS087DR18rBz9T1w7SyxcTcuPjE48TYPw==;]