ejb该咋用就咋用啊,有啥问题?
解决方案 »
- =====共60分===========ps --cols 设置列宽
- barcode4j生成二维条码汉字问题
- Hibrnate createSQLQuery使用失败!!!
- 哪位大哥能告诉我EJB如何应用于WEB
- 关于包的导入的问题
- Struts 中文乱码问题 以及 URL暴露表单数据和SessionID问题,急~~~
- 关于Struts中的Validator验证的一些请教
- struts 中的action多次执行!!!!!!!!!!!!!急!!!!!!!!!!!!
- 哪位高手有JSP和Servlet发布到Weblogic的配置的文档,谢谢
- 请问J2EE到底是关于什么的
- 请问谁有把一个DOM对象输出成一个本地XML文件的CODE,谢谢
- 大虾急救
When you use the JNDI API within the same VM that the JBoss server is running do not have to perform any special configuration to create a JNDI InitialContext. You simply create an InitialContext without any arguments. When you use the JBoss naming service to remote JBoss server you need to specify the appropriate InitialContext environment either by passing a Hashtable containing the desired properties or by having a jndi.properties file available on the classpath. The properties required for the InitialContext to work with the JBossNS JNDI provider are as follows: java.naming.factory.initial (or Context.INITIAL_CONTEXT_FACTORY), The name of the environment property for specifying the initial context factory to use.This must be the org.jnp.interfaces.NamingContextFactory class for JBossNS. java.naming.provider.url (or Context.PROVIDER_URL), The name of the environment property for specifying the location of the JBossNS service provider the client will use. The NamingContextFactory class uses this information to know which JBossNS server to connect to. The value of the property should be a URL string. For JBossNS the URL format is jnp://host:port/[jndi_path]. The jnp: portion of the URL is the protocol and refers to the socket/RMI based protocol used by JBossNS. The jndi_path portion of the URL is an option JNDI name relative to the root context, for example, "apps" or "apps/tmp". Everything but the host component is optional. The following examples are equivalent because the default port value is 1099:
jnp://www.jboss.org:1099/
www.jboss.org:1099
www.jboss.orgnaming.factory.url.pkgs (or Context.URL_PKG_PREFIXES), The name of the environment property for specifying the list of package prefixes to use when
loading in URL context factories. For JBossNS this must be org.jboss.naming:org.jnp.interfaces. This property is essential for locating the jnp: and
java: URL context factories bundled with the JBossNS provider.
jnp.socketFactory, The fully qualified class name of the javax.net.SocketFactory
implementation to use to create the bootstrap socket. The default value is org.jnp.interfaces.TimedSocketFactory. The TimedSocketFactory is a simple
SocketFactory implementation that supports the specification of a connection and read timeout. These two properties are specified by:
jnp.timeout, The connection timeout in milliseconds. The default value is 0 which means the connection will block until the VM TCP/IP layer times out.
jnp.sotimeout, The connected socket read timeout in milliseconds. The default value is 0 which means reads will block. This is the value passed to the
Socket.setSoTimeout on the newly connected socket.
A sample jndi.properties file for connecting to a JBoss server running on appserver.dot.com on port 9901 is showing in Listing 4-2.
Listing 4-2, A sample jndi.properties file for connecting to a remote JBoss server
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=jnp://appserver.dot.com:9901/
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
# The jnp protocol socket factory class
jnp.socketFactory=org.jnp.interfaces.TimedSocketFactory
# The TimedSocketFactory connection timeout in milliseconds(0 == blocking)
jnp.timeout=0
# The TimedSocketFactory read timeout in milliseconds(0 == blocking)
jnp.sotimeout=0
In order for a client to connect to a JBossNS server, the client must include the jndi.properties file along with the jnp-client.jar and jnet.jar if you are using a JDK release
prior to 1.4.