Man*_*aik 6 websphere java-ee ejb-3.1
在查找部署在WebSphere 8.5上的EJB 3.1时,我遇到了问题.
请建议我:
注意:我正在使用Eclipse IDE
试试这个 :
com.ibm.ws.ejb.thinclient_8.5.0.jar和com.ibm.ws.orb_8.5.0.jarjar到客户端应用程序的类路径.createEJBStubs.sh脚本生成客户端存根.
createEJBStubs.sh在<WAS_HOME>/bin目录下找到的脚本.
./createEJBStubs.sh <ejbJarName>.jarJNDI为您提供自定义名称EJB:
Applications>All applications.
Bind EJB Business下面Enterprise Java Bean Properties.
为您的下栏JNDI名称.例如EJBJNDI namecustomLookupString客户代码示例:
public class WebSphereClient {
public static void main(String[] args) {
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
props.put(javax.naming.Context.PROVIDER_URL, "iiop://localhost:2818");
TestBeanRemote bean = null;
Object obj;
try {
InitialContext ctx = new InitialContext(props);
obj= ctx.lookup("customLookupString");
if (obj instanceof TestBeanRemote) {
bean = (TestBeanRemote) obj;
}
System.out.println("Name : "+bean.getName());
} catch (NamingException e) {
e.printStackTrace();
}
}
}
Run Code Online (Sandbox Code Playgroud)
以上代码和流程对我有用.
查看此页面运行IBM Thin Client for Enterprise JavaBeans(EJB)以获取更多详细信息.
我需要在classpath中包含哪些库?
您将需要com.ibm.ws.ejb.thinclient_8.5.0.jar(位于app_server_root\runtimes)和endorsed_apis_8.5.0.jar(位于app_server_root\runtimes\endorsed中).将endoresed jar复制到JAVA_JRE\lib\endorsed
如何构造查找字符串?
像这样调用你的应用程序:
<java_install_root>\bin\java
-classpath com.ibm.ws.ejb.thinclient_8.5.0.jar;<list_of_your_application_jars_and_classes>
-Djava.naming.provider.url=iiop://<your_application_server_machine_name>:<orbPort>
<fully_qualified_class_name_to_run>
Run Code Online (Sandbox Code Playgroud)
如果您在服务器上启用了安全性并且需要SSL,则需要添加以下内容:
-Dcom.ibm.SSL.ConfigURL=file:///home/user1/ssl.client.props
-Dcom.ibm.CORBA.ConfigURL=file:///home/user1/sas.client.props
Run Code Online (Sandbox Code Playgroud)
您可以在WebSphere安装文件中找到这些文件 PROFILE_ROOT\properties
| 归档时间: |
|
| 查看次数: |
7941 次 |
| 最近记录: |