- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 machine1 上部署了一个安全的 ejb,当我在同一台机器上运行客户端代码时,它工作正常。但是当我在任何其他机器上运行客户端代码时,它会抛出错误。粘贴在下面。
在错误中可以看出它没有获取所提供的 ip: 而是在客户端计算机本身中查找。问题出在客户端代码中还是我缺少 WebSphere 中的某些设置。
package org.was.tutorial.security.client;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import org.was.tutorial.security.bean.Calculator;
public class Client
{
public static void main(String[] args) throws Exception
{
//Establish the proxy with an incorrect security identity
Properties env = new Properties();
//username and password
//String username="teacher1";
//String password="teacher";
String username="student1";
String password="student";
//setting up environment properties..
env.setProperty(Context.SECURITY_PRINCIPAL, username);
env.setProperty(Context.SECURITY_CREDENTIALS, password);
env.setProperty(javax.naming.Context.PROVIDER_URL, "iiop://10.94.13.18:2809");
env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
InitialContext ctx = new InitialContext(env);
//javax.rmi.PortableRemoteObject.narrow(ctx.lookup("CalculatorBean/remote"), Calculator.class);
Calculator calculator =null;
try{
calculator = (Calculator)javax.rmi.PortableRemoteObject.narrow(ctx.lookup("CalculatorBean/remote"), Calculator.class);
if(calculator==null){
System.out.println("This is not going anywhere");
}else
System.out.println("Good. we made a progress.");
}catch (Exception e) {
e.printStackTrace();
}
System.out.println("User "+username);
System.out.println("Addition can be performed by all");
try
{
System.out.println("1 + 1 = " + calculator.add(1, 1));
}
catch (Exception ex)
{
System.out.println("Saw expected SecurityException: " + ex.getMessage());
}
System.out.println("Subtraction- can be performed by students only.");
try
{
System.out.println("16- 4 ="+calculator.subtract(16, 4));
}catch (Exception ex)
{
System.out.println(ex.getMessage());
}
System.out.println("Division- can be performed by teachers only.");
try
{
System.out.println("16/4 ="+calculator.divide(16, 4));
}catch (Exception ex)
{
System.out.println(ex.getMessage());
}
///cool
}
}
错误:
Exception in thread "P=13152:O=0:CT" 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:423)
at com.temenos.services.ofsconnector.ejb.IntegrationFrameworkServiceClient.main(IntegrationFrameworkServiceClient.java:50)
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:1109)
at com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1463)
at com.ibm.rmi.corba.ClientDelegate.createRequest(ClientDelegate.java:1001)
at com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1429)
at com.ibm.rmi.corba.ClientDelegate.request(ClientDelegate.java:1618)
at com.ibm.CORBA.iiop.ClientDelegate.request(ClientDelegate.java:1385)
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: org.omg.CORBA.COMM_FAILURE: CONNECT_FAILURE_ON_SSL_CLIENT_SOCKET - JSSL0130E: java.io.IOException: Signals that an I/O exception of some sort has occurred. Reason: Connection refused: connect Remote Host: 127.0.0.1 Remote Port: 9403 vmcid: 0x49421000 minor code: 80 completed: No
at com.ibm.ws.security.orbssl.WSSSLClientSocketFactoryImpl.tryToCreateConnectedSSLSocket(WSSSLClientSocketFactoryImpl.java:357)
at com.ibm.ws.security.orbssl.WSSSLClientSocketFactoryImpl.createSSLSocket(WSSSLClientSocketFactoryImpl.java:219)
at com.ibm.ws.orbimpl.transport.WSSSLTransportConnection.createSocket(WSSSLTransportConnection.java:236)
at com.ibm.CORBA.transport.TransportConnectionBase.connect(TransportConnectionBase.java:348)
at com.ibm.ws.orbimpl.transport.WSTransport$1.run(WSTransport.java:503)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at com.ibm.ws.orbimpl.transport.WSTransport.getConnection(WSTransport.java:500)
at com.ibm.CORBA.transport.TransportBase.getConnection(TransportBase.java:181)
at com.ibm.rmi.iiop.TransportManager.get(TransportManager.java:97)
at com.ibm.rmi.iiop.GIOPImpl.getConnection(GIOPImpl.java:134)
at com.ibm.rmi.iiop.GIOPImpl.locate(GIOPImpl.java:230)
at com.ibm.rmi.corba.ClientDelegate.locate(ClientDelegate.java:1696)
at com.ibm.rmi.corba.ClientDelegate._createRequest(ClientDelegate.java:1721)
at com.ibm.rmi.corba.ClientDelegate.createRequest(ClientDelegate.java:1023)
at com.ibm.rmi.corba.ClientDelegate.createRequest(ClientDelegate.java:1105)
... 17 more
更新
我使用以下脚本创建了节点和配置文件:
文件1:setUpEnv.bat
set WAS_HOME=C:\IBM\WebSphere\AppServer
set HOST_NAME=localhost
set PROFILE_NAME=AppSrv01
set NODE_NAME=%PROFILE_NAME%Node01
set CELL_NAME=%NODE_NAME%Cell
set SERVER_NAME=server1
set DMGR_USER=user1
set DMGR_PASSWORD=123456
set DMGR_HOST=localhost
set DMGR_PORT=8879
文件2:
CALL ./setUpEnv.bat
set WAS_HOME=C:\IBM\WebSphere\AppServer
CALL %WAS_HOME%\bin\manageprofiles.bat -create -profileName %PROFILE_NAME% - profilePath %WAS_HOME%\profiles\%PROFILE_NAME% -templatePath %WAS_HOME%\profileTemplates\default -serverName %SERVER_NAME% -cellName %CELL_NAME% -nodeName %NODE_NAME% -hostName %HOST_NAME% -enableAdminSecurity true -adminUserName %DMGR_USER% -adminPassword %DMGR_PASSWORD%
最佳答案
9403 是 RMI/IIOP SSL 通信的正确端口 (CSIV2_ SSL_ SERVERAUTH_ LISTENER_ ADDRESS)。可能会发生这样的情况:您使用 localhost 错误地安装了 WAS,并且它向客户端发送了 localhost 的重定向,而不是其主机名。
例如通过 Web 控制台在服务器 -> 管理 -> 端口部分中仔细检查 WAS 配置。
如果您使用 localhost 安装了 WAS,则必须更改主机或重新创建 provile(如果您是 WAS 新手,则第二种可能会更容易)。
关于java - WebSphere javax.naming.NamingException 和连接被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40972716/
我得到错误: javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.Na
我有一个直接使用 Java Transaction API 资源的 hibernate 应用程序。我正在尝试使用 UserTransaction 来完成一些基本的数据库事务 The UserTrans
我尝试向 activemq 发布消息。但是我在 java 应用程序中遇到一个命名异常。这是代码如下 Properties props = new Properties(); props.se
我在 Weblogic 11g 上运行 Java 6。 我正在开发一个使用 EJB 与数据库通信的 Web 服务项目。目前我正在处理错误,因此我尝试在调用 Web 服务之前取消部署 EJB。我的 EJ
我正在使用 maven 跟踪错误 tomcat 7.0.53。我在 server.xml 的 Resource 标签中使用了 factory="org.apache.commons.dbcp.Basi
当我运行以下命令时: package NonServletFiles; import java.sql.Connection; import java.sql.PreparedStatement; i
我新使用 j2ee,当我使用 netbean 6.9 运行这个项目时。我遇到了这个问题 javax.naming.NamingException: Lookup failed for 'java:co
我在 web.xml 中添加了以下内容: ejb/userManagerBean Session gha.ywk.name.entry.ejb.use
我在 machine1 上部署了一个安全的 ejb,当我在同一台机器上运行客户端代码时,它工作正常。但是当我在任何其他机器上运行客户端代码时,它会抛出错误。粘贴在下面。 在错误中可以看出它没有获取所提
我的监听器代码如下 package org.javaimplant.newsfeed.Init; import javax.naming.Context; import javax.naming.In
我有两个项目,第一个是Ejb3项目,名称是SessionBean,另一个是java项目,名称是SessionBeanClient。对于 IDE,我使用 eclipse indigo。我已经完成了代码,
我已经尝试了下面的大量变体来使数据源工作但无济于事。我已经研究/尝试了几天,所以我认输并寻求帮助。不过首先,我很难在这篇文章中格式化我的代码。没有缩进,某些 xml 标记正在消失。可能是愚蠢的 IE
我正在使用 tomcat 和 mysql(ide 是 eclipse)。我正在使用连接池。 在 context.xml 中,我有: 一开始我一直在easyphp中使用mysql(root用户没有p
我有两个实现接口(interface)的无状态 EJB。为了加载实现,我使用了 InitialContext,但它总是失败并出现 NamingException。 界面 package app.ejb
我试图通过一个简单的 jsp 表单来持久化一个实体,但它不起作用。出现的异常是:javax.naming.NamingException: Lookup failed for 'java:global
我是 java EE 的新手。最近我正在开发一个使用 bean stateless 的项目,但出现以下错误 bean : @Stateless(mappedName = "FlightServiceB
我知道这个问题已经被问过很多次了,但即使在遵循所有答案之后我仍然有一个异常(exception)。我的配置是: 上下文.xml web.xml Prod C
我正在使用 wildfly10。这是我的 Java 代码。 private Hashtable mEnv = new Hashtable(); InitialContext e = new Initi
尝试通过 tomcat Context.xml 公开一个 Oracle 连接时,我得到了一个 NamingException。我已经学习了几个教程,但仍然遇到异常。帮助! Java: String e
关于这个问题似乎有几个主题,但还没有找到答案。我对 JSF 很陌生,想创建一个 postgresql 连接池,使用: JSF 2.2.9 Tomcat 8.0.27 但是 tomcat 总是给我一个
我是一名优秀的程序员,十分优秀!