Properties properties = null;
try {
properties = new Properties();
properties.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
properties.setProperty("java.naming.provider.url",
"jnp://" +engineHostLocation + ":1099");
System.out.println("RSMessageSenderBean========queueHostLocation:"
+ engineHostLocation);
properties.setProperty("java.naming.factory.url.pkgs",
"org.jnp.interfaces.NamingContextFactory");
InitialContext ctx = new InitialContext(properties); Object obj = ctx.lookup(rsMessageSenderJNDI);
rsmsHome = (RSMessageSenderHome)PortableRemoteObject.narrow(obj,
RSMessageSenderHome.class); obj = ctx.lookup(driverManagerJNDI);
dmHome = (DriverManagerHome) PortableRemoteObject.narrow(obj,
DriverManagerHome.class); obj = ctx.lookup(authenticateCenterJNDI);
acHome = (AuthenticateCenterHome)PortableRemoteObject.narrow(obj,
AuthenticateCenterHome.class);
}catch (Exception e) {
try {
properties = new Properties();
properties.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
properties.setProperty("java.naming.provider.url",
"jnp://" +engineHostLocation + ":1099");
System.out.println("RSMessageSenderBean========queueHostLocation:"
+ engineHostLocation);
properties.setProperty("java.naming.factory.url.pkgs",
"org.jnp.interfaces.NamingContextFactory");
InitialContext ctx = new InitialContext(properties); Object obj = ctx.lookup(rsMessageSenderJNDI);
rsmsHome = (RSMessageSenderHome)PortableRemoteObject.narrow(obj,
RSMessageSenderHome.class); obj = ctx.lookup(driverManagerJNDI);
dmHome = (DriverManagerHome) PortableRemoteObject.narrow(obj,
DriverManagerHome.class); obj = ctx.lookup(authenticateCenterJNDI);
acHome = (AuthenticateCenterHome)PortableRemoteObject.narrow(obj,
AuthenticateCenterHome.class);
}catch (Exception e) {
解决方案 »
- json错误
- 求大侠支援,hibernate+jap 怎么调用视图
- eclipse中js文件中方法提示没有定义,但在另一个工程中却可以找到
- 求教:String对象作为输入流,相应的写到文件中的流操作
- HQL 子查询问题
- weblogic如何配置两个应用(不同的域名)共用80端口
- Thread中的join问题
- 我的javamail用imap收邮件出现异常!大家帮忙!!!PS:pop3没问题!
- 请教高手有关sql2000数据库备份的问题,在线等!急!急!!急!!!
- 请问哪里有EJB3。0方面的资料啊?
- 数据库错误:com.microsoft.jdbc.sqlserver.SQLServerDriver
- 问:hibernate_in_action是什么意思啊?
<%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<title>
jsp2
</title>
</head>
<body bgcolor="#ffffff">
<h1>
JBuilder Generated JSP
<br />
<% Hashtable environment = new Hashtable();
environment.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
environment.put(javax.naming.Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
environment.put(javax.naming.Context.PROVIDER_URL, "jnp://localhost:1099");
javax.naming.Context ctx=new javax.naming.InitialContext(environment);
untitled9.JBossWeblogicHome h=(untitled9.JBossWeblogicHome) ctx.lookup("JBossWeblogic");
untitled9.JBossWeblogic l=h.create();
out.println( l.TestCall());
%>
</h1>
</body>
</html>//访问结果
http://lym:7001/WebModule2/jsp2.jsp 显示内容:
JBuilder Generated JSP
this is the test call
import javax.ejb.SessionContext;
import javax.ejb.CreateException;public class JBossWeblogicBean
implements SessionBean {
SessionContext sessionContext;
public void ejbCreate() throws CreateException {
} public void ejbRemove() {
} public void ejbActivate() {
} public void ejbPassivate() {
} public void setSessionContext(SessionContext sessionContext) {
this.sessionContext = sessionContext;
} public String TestCall() {
return "this is the test call";
}
}
jboss-j2ee.jar
jboss-common-client.jar
jbossall-client.jar
jmx-rmi-connector-client.jar
jnp-client.jar
log4j.jar
版本不一样,可能略有不同,我上面的版本配置有这几个就够了。千万别一古脑全加进去。否则出现问题后删除非常困难,搞不清楚哪里有残留。