Weblogic10 + EJB3入门教程(1):编写第一个无状态会话Bean(Stateless Session Bean)...

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="ProgId" content="Word.Document"> <meta name="Generator" content="Microsoft Word 11"> <meta name="Originator" content="Microsoft Word 11"> <link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"> <!--[if gte mso 9]><xml> Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4 </xml><![endif]--><!--[if gte mso 9]><![endif]--><style> <!-- /* Font Definitions */ &#64;font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1;} &#64;font-face {font-family:""&#64;宋体"; panose-1:2 1 6 0 3 1 1 1 1 1;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; font-size:10.5pt; font-family:"Times New Roman";} /* Page Definitions */ &#64;page {} &#64;page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;} div.Section1 {page:Section1;} --> </style> <!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable { mso-style-parent:""; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} </style> <![endif]-->

本文为原创,如需转载,请注明作者和出处,谢谢!

在本文主要介绍如何来开发一个Stateless Session Bean,并在未安装WebLogic10的机器上访问Session Bean。开发EJB3 Stateless Session Bean要比开发EJB2 Stateless Session Bean容易得多,只需要几个注释就可以搞定。读者可按如下的步骤来开发和调用EJB3 Stateless Session Bean:

第1步:编写远程接口

每一个Session Bean需要一个远程接口,该接口的代码如下:

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> package com.earth;

import javax.ejb.Remote;

// 此处必须使用@Remote注释指定该接口为远程接口
@Remote
public interface CompanyRemote
{
public StringgetName();
public Employee[]getEmployees();
}

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="ProgId" content="Word.Document"> <meta name="Generator" content="Microsoft Word 11"> <meta name="Originator" content="Microsoft Word 11"> <link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"> <!--[if gte mso 9]><xml> Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4 </xml><![endif]--><!--[if gte mso 9]><![endif]--><style> <!-- /* Font Definitions */ &#64;font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1;} &#64;font-face {font-family:""&#64;宋体"; panose-1:2 1 6 0 3 1 1 1 1 1;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; font-size:10.5pt; font-family:"Times New Roman";} /* Page Definitions */ &#64;page {} &#64;page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;} div.Section1 {page:Section1;} --> </style> <!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable { mso-style-parent:""; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} </style> <![endif]-->

在CompanyRemote接口中定义了两个方法,分别返回一个字符串和一个Employee类型的数组。

第2步:编写Employee类

Employee类是一个实现implements java.io.Serializable接口的JavaBean,代码如下:

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> package com.earth;

public class Employee implements java.io.Serializable
{
private Stringname;
private Stringjob;
private int age;
public StringgetName()
{
return name;
}
public void setName(Stringname)
{
this .name = name;
}
public StringgetJob()
{
return job;
}
public void setJob(Stringjob)
{
this .job = job;
}
public int getAge()
{
return age;
}
public void setAge( int age)
{
this .age = age;
}
}

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="ProgId" content="Word.Document"> <meta name="Generator" content="Microsoft Word 11"> <meta name="Originator" content="Microsoft Word 11"> <link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"> <!--[if gte mso 9]><xml> Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4 </xml><![endif]--><!--[if gte mso 9]><![endif]--><style> <!-- /* Font Definitions */ &#64;font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1;} &#64;font-face {font-family:""&#64;宋体"; panose-1:2 1 6 0 3 1 1 1 1 1;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; font-size:10.5pt; font-family:"Times New Roman";} /* Page Definitions */ &#64;page {} &#64;page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;} div.Section1 {page:Section1;} --> </style> <!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable { mso-style-parent:""; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} </style> <![endif]-->

第3步:编写Stateless Session Bean

Session Bean需要实现CompanyRemote接口,代码如下:

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> package com.earth;

import java.util.List;
import java.util.ArrayList;
import javax.ejb.Remote;
import javax.ejb.Stateless;

@Stateless(mappedName
= " Company " )
public class Company implements CompanyRemote
{
public Employee[]getEmployees()
{
Employee[]employees
= new Employee[ 2 ];
employees[
0 ] = new Employee();
employees[
0 ].setName( " superman " );
employees[
0 ].setJob( " CEO " );
employees[
0 ].setAge( 1234 );

employees[
1 ] = new Employee();
employees[
1 ].setName( " 擎天柱 " );
employees[
1 ].setJob( " CTO " );
employees[
1 ].setAge( 4321 );

return employees;
}
public StringgetName()
{
return " 地球软件有限公司 " ;
}
}

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="ProgId" content="Word.Document"> <meta name="Generator" content="Microsoft Word 11"> <meta name="Originator" content="Microsoft Word 11"> <link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"> <!--[if gte mso 9]><xml> Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4 </xml><![endif]--><!--[if gte mso 9]><![endif]--><style> <!-- /* Font Definitions */ &#64;font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1;} &#64;font-face {font-family:""&#64;宋体"; panose-1:2 1 6 0 3 1 1 1 1 1;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; font-size:10.5pt; font-family:"Times New Roman";} /* Page Definitions */ &#64;page {} &#64;page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;} div.Section1 {page:Section1;} --> </style> <!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable { mso-style-parent:""; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} </style> <![endif]-->

这个Session Bean使用了@Stateless注释指定了该Session Bean是无状态的,并使用了mappedName属性指定该Session Bean的JNDI名的前一部分,如果mappedName属性的值是Company,则该Session Bean的JNDI名是Company#com.earth.CompanyRemote。

第4步:编译.java文件,并生成.jar文件


将上面三个.java文件放到同一个目录下,并使用如下的命令生成相应的.class文件:

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> javac - d. - classpath.;C:\bea\wlserver_10. 3 \server\lib\weblogic.jar * .java

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="ProgId" content="Word.Document"> <meta name="Generator" content="Microsoft Word 11"> <meta name="Originator" content="Microsoft Word 11"> <link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"> <!--[if gte mso 9]><xml> Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4 </xml><![endif]--><!--[if gte mso 9]><![endif]--><style> <!-- /* Font Definitions */ &#64;font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1;} &#64;font-face {font-family:""&#64;宋体"; panose-1:2 1 6 0 3 1 1 1 1 1;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; font-size:10.5pt; font-family:"Times New Roman";} /* Page Definitions */ &#64;page {} &#64;page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;} div.Section1 {page:Section1;} --> </style> <!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable { mso-style-parent:""; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} </style> <![endif]-->

注意:在编译.java文件时要将在classpath环境变量或javac的-classpath参数中指定weblogic.jar文件,假设WebLogic10安装在了C盘的bea目录,则weblogic.jar文件位于C:"bea"wlserver_10.3"server"lib目录中,本例使用了weblogic10.3。
在生成.class文件后,使用如下的命令生成company.jar文件:

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> jarcvfcompany.jarcom


<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 11"><meta name="Originator" content="Microsoft Word 11"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"><!--[if gte mso 9]><xml> Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4 </xml><![endif]--><!--[if gte mso 9]><![endif]--><style> <!-- /* Font Definitions */ &#64;font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1;} &#64;font-face {font-family:""&#64;宋体"; panose-1:2 1 6 0 3 1 1 1 1 1;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; font-size:10.5pt; font-family:"Times New Roman";} /* Page Definitions */ &#64;page {} &#64;page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;} div.Section1 {page:Section1;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable { mso-style-parent:""; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} </style> <![endif]-->

第5步:发布EJB

发布EJB的方法很多,然而最简单的是直接将company.jar文件复制到如下的目录:

C:\bea\user_projects\domains\base_domain_new\autodeploy

其中base_domain_new是域名,读者也可将company.jar文件复制到其他域的autodeploy目录中。
启动Weblogic,该EJB自动发布。读者可以使用如下的URL来查看在当前Weblogic服务器中注册的JNDI:


http://localhost:7001/console/consolejndi.portal?_nfpb=true&_pageLabel=JNDIHomePage&server=AdminServer

其中AdminServer为Weblogic的服务名,可能在读者的机器上是其他的服务名,请使用如下的URL进行Weblogic Console进行查看:

http://localhost:7001/console

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="ProgId" content="Word.Document"> <meta name="Generator" content="Microsoft Word 11"> <meta name="Originator" content="Microsoft Word 11"> <link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"> <!--[if gte mso 9]><xml> Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4 </xml><![endif]--><!--[if gte mso 9]><![endif]--><style> <!-- /* Font Definitions */ &#64;font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1;} &#64;font-face {font-family:""&#64;宋体"; panose-1:2 1 6 0 3 1 1 1 1 1;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; font-size:10.5pt; font-family:"Times New Roman";} /* Page Definitions */ &#64;page {} &#64;page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;} div.Section1 {page:Section1;} --> </style> <!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable { mso-style-parent:""; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} </style> <![endif]-->

安装EJB后,本机注册的JNDI如下图所示。

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 11"><meta name="Originator" content="Microsoft Word 11"><!--[if gte mso 9]><xml> Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4 </xml><![endif]--><!--[if gte mso 9]><![endif]--><style> <!-- /* Font Definitions */ &#64;font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1;} &#64;font-face {font-family:""&#64;宋体"; panose-1:2 1 6 0 3 1 1 1 1 1;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; font-size:10.5pt; font-family:"Times New Roman";} /* Page Definitions */ &#64;page {} &#64;page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;} div.Section1 {page:Section1;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable { mso-style-parent:""; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} </style> <![endif]-->
第6
步:编写客户端程序

调用EJB的客户端代码如下:

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import com.earth. * ;

public class TestCompany
{
public static void main(String[]args) throws Exception
{

Propertiesprops
= new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
" weblogic.jndi.WLInitialContextFactory " );
props.setProperty(Context.PROVIDER_URL,
" t3://192.168.17.127:7001 " );
InitialContextctx
= new InitialContext(props);
CompanyRemotecompanyRemote
= (CompanyRemote)ctx
.lookup(
" Company#com.earth.CompanyRemote " );
System.out.println(companyRemote.getName());
Employee[]employees
= companyRemote.getEmployees();
for (Employeeemployee:employees)
{
System.out.println(
" name: " + employee.getName());
System.out.println(
" job: " + employee.getJob());
System.out.println(
" age: " + employee.getAge());
System.out.println(
" ------------------------- " );
}
}
}

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 11"><meta name="Originator" content="Microsoft Word 11"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"><!--[if gte mso 9]><xml> Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4 </xml><![endif]--><!--[if gte mso 9]><![endif]--><style> <!-- /* Font Definitions */ &#64;font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1;} &#64;font-face {font-family:""&#64;宋体"; panose-1:2 1 6 0 3 1 1 1 1 1;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; font-size:10.5pt; font-family:"Times New Roman";} /* Page Definitions */ &#64;page {} &#64;page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;} div.Section1 {page:Section1;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable { mso-style-parent:""; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} </style> <![endif]-->使用如下的命令编译TestCompany.java:

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> javac - classpath.;company.jar;E:\bea\wlserver_10. 3 \server\lib\weblogic.jarTestCompany.java

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 11"><meta name="Originator" content="Microsoft Word 11"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"><!--[if gte mso 9]><xml> Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4 </xml><![endif]--><!--[if gte mso 9]><![endif]--><!--[if !mso]> <style> st1":*{behavior:url(#ieooui) } </style> <![endif]--><style> <!-- /* Font Definitions */ &#64;font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1;} &#64;font-face {font-family:""&#64;宋体"; panose-1:2 1 6 0 3 1 1 1 1 1;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; font-size:10.5pt; font-family:"Times New Roman";} /* Page Definitions */ &#64;page {} &#64;page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;} div.Section1 {page:Section1;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable { mso-style-parent:""; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} </style> <![endif]-->

注意:TestCompany.java与company.jar文件需要在同一目录下。

由于调用客户端的代码并不一定在安装WebLogic的机器上运行,因此,在将TestCompany.class和company.jar(发布到客户端的这个jar文件只需要Employee.class和CompanyRemote.class文件即可,Company.class可以从该jar文件中删除)发布到客户端时还需要带一些WebLogic自身的jar文件。虽然Weblogic中有一个wlclient.jar文件,但光有这个文件还不够,不了方便提取客户端需要的jar文件,Weblogic提供了一个jar包,通过该包,可以将客户端需要的所有.class文件打成一个jar包。
这个jar文件是C:\bea\modules\com.bea.core.jarbuilder_1.2.0.0.jar,可通过如下的命令行来生成客户端需要的jar包:

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> java - jar.. / .. / .. / modules / com.bea.core.jarbuilder_1. 2.0 . 0 .jar

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 11"><meta name="Originator" content="Microsoft Word 11"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"><!--[if gte mso 9]><xml> Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4 </xml><![endif]--><!--[if gte mso 9]><![endif]--><style> <!-- /* Font Definitions */ &#64;font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1;} &#64;font-face {font-family:""&#64;宋体"; panose-1:2 1 6 0 3 1 1 1 1 1;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; font-size:10.5pt; font-family:"Times New Roman";} /* Page Definitions */ &#64;page {} &#64;page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;} div.Section1 {page:Section1;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable { mso-style-parent:""; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} </style> <![endif]-->注意:上面的命令必须在C:\bea\wlserver_10.3\server\lib目录中执行。

在执行上面的命令后,将在E:\bea\wlserver_10.3\server\lib目录生成一个wlfullclient.jar文件,将该文件与TestCompany.class、company.jar一同复制到客户端的机器上即可。并通过如下的命令来执行TestCompany.class:

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> java - classpath.;company.jar;wlfullclient.jarTestCom

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 11"><meta name="Originator" content="Microsoft Word 11"><!--[if gte mso 9]><xml> Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4 </xml><![endif]--><!--[if gte mso 9]><![endif]--><style> <!-- /* Font Definitions */ &#64;font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1;} &#64;font-face {font-family:""&#64;宋体"; panose-1:2 1 6 0 3 1 1 1 1 1;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; font-size:10.5pt; font-family:"Times New Roman";} /* Page Definitions */ &#64;page {} &#64;page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;} div.Section1 {page:Section1;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable { mso-style-parent:""; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} </style> <![endif]-->执行上面的命令后的输出结果如下面两个图所示:



Windows下的执行结果


Linux下的执行结果


国内最棒的Google Android技术社区(eoeandroid),欢迎访问!

《银河系列原创教程》发布

《Java Web开发速学宝典》出版,欢迎定购

weblogic教程全攻略 立即下载

相关推荐

weblogic安装和简单入门

WebLogic是美国Oracle公司出品的一个application server确切的说是一个基于JAVAEE架构的中间件,BEA WebLogic是用于开发、集成、部署和管理大型分布式Web应用、网络应用和数据库应用的Java应用服务器

测试开发进阶——常用中间件概念——会话Bean(SessionBean),实体Bean(Entity Bean)、消息驱动Bean(MessageDriven Bean)——EJB三种企业Bean的理...

EJB——EnterpriceJavaBeans:是一个用于分布式业务应用的标准服务端组件模型。 采用EJB架构编写的应用是可伸的、事务性的、多用户安全的。可以一次编写这些应用,然后部署在任何支持EJB规范的服务器平台,如JBoss、WebLogic。 EJB定义了三种企业Bean——会话Bean(SessionBean),实体Bean(Entity Bean)、消息驱动Bean(Message...

小白龙白龙马的博客 1221

Weblogic基础入门学习系列

weblogic java 基础 入门 WebLogic 7.0,其功能强大、方便易用性,使得其市场占有率也很高。尤其是在开发一些企业化的web应用程序方面更能提供灵活强大的支持 1、Weblogic Server的安装; 2、Weblogic Domain and Server配置; 3、Weblogic 与 Jbuilder 的整合; 4、Weblogic Server发布第一个Web Application(JSP); 5、Weblogic ConnectionPool的建立; 6、DataSource 与Tx DataSource的区别;

weblogic从入门到起飞!(weblogic安装、domain配置、管理控制台)(一)

weblogic术语 通过JNDI接口,可以访问目录服务。 通过JDBC:可以访问数据库。 通过JMX,可以管理其他设备(接口)。 JMS,可以接收发送消息。 RMI-IIOP,可以访问另外的网路服务,Web Service。 通过JTA,可以做分布式事务的处理。 JAAS:认证和授权。(把重复部分拿出来单独成一个模块,这也是j2ee开发的精髓。) JNDI,将你写好的一个主键或者是一个资源,把它放进来并且暴露给外界,让网络上的其他程序能够通过JNDI访问它。 Web Client ...

秃了也弱了 1万+

很详细的weblogic图文教程以及集群

weblogic图文教程以及集群配置

weblogic自学全套教程

近期学习weblogic 搜集到一些资料希望能帮助到同学们

weblogic保姆级教程,weblogic安装,域安装,jdk环境搭建,项目部署以及weblogic碰见的问题

weblogic安装环境搭建及项目部署

sakura的博客 1万+

SAP SD跨公司销售IDOC自动记账配置实战指南

本文详细介绍了SAP SD模块中跨公司销售IDOC自动记账的配置实战指南。通过IDOC技术实现集团企业间交易的自动化处理,显著提升财务效率和准确性。文章涵盖前置配置、RFC连接、合作伙伴参数设置及财务科目分配等关键步骤,并提供了常见错误排查和性能优化建议,帮助用户快速掌握这一高效业务流程。

weixin_29284885的博客 762

Weblogic的了解、安装及其使用

WebLogic是美国Oracle公司出品的一个application server,确切的说是一个基于JAVAEE架构的中间件,WebLogic是用于开发、集成、部署和管理大型分布式Web应用、网络应用和数据库应用的Java应用服务器。将Java的动态功能和Java Enterprise标准的安全性引入大型网络应用的开发、集成、部署和管理之中。

沉淀所学,分享所思,让热爱与成长同行。商务记录AI实战经验,助力开发者快速成长。 热爱AI,希望做出有影响力的技术成果。 技术点亮生活,分享连接价值与机会。 专注AI落地实战,陪你走好技术每一步。 3万+

智能座舱芯片大乱斗:高通8155 vs 联发科MT8676 vs 华为麒麟990A,谁才是性价比之王?

本文深入对比了高通SA8155P、联发科MT8676与华为麒麟990A三款主流智能座舱芯片的性能、生态与成本。文章从CPU/GPU/NPU算力、开发生态、成本模型及典型应用场景出发,分析了各自在智能座舱领域的优势与适用性,为开发者与车企选型提供了实战参考,并探讨了智能座舱芯片未来的技术趋势。

yhn456789的博客 771

惊呆了!Oracle 11g从入门到放弃的保姆级指南(新手必看)

本文为Oracle 11g数据库新手提供了一份详尽的入门指南。内容涵盖从安装配置、SQL*Plus工具使用、核心的SQL增删改查操作,到事务、索引等进阶概念的解析。文章旨在帮助初学者避开常见陷阱,快速掌握这一经典关系型数据库管理系统的基本操作与核心技能,实现从入门到上手。

ooo22的博客 260

WebLogic教程

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34375054的博客 358

如何通过CAD图中的坐标来确定是哪个坐标系

地理坐标系:为球面坐标。参考平面地是椭球面,坐标单位:经纬度。以地球参考为例,坐标系就相当于整个地球,而地理坐标系就是椭球状的完整的立体地球。所以我们可以看到生活中的数据与地图是一定含有地理坐标系的,因为他是客观上来说确确实实存在的。投影坐标系:为平面坐标。参考平面地是水平面,坐标单位:米、千米等。这就相当于把地球当成一个橘子,然后一刀切开,把橘子皮平面铺开,这个过程就是地理投影的过程。严谨一点来说就是建立一个参考系统,按照对应位置把椭球体投射到平面。那坐标系统主要有那些呢?北京54。

vjmap的博客 2万+

Weblogic10 + EJB3入门教程(1):编写第一个无状态会话Bean(Stateless Session Bean)

Normal07.8 磅02falsefalsefalseMicrosoftInternetExplorer4<!--/* Font Definitions */@font-face{font-family:宋体;panose-1:2 1 6 0 3 1 1 1 1 1;}@font-face{font-f

一个被知识诅咒的人 1661

如何在win11中用双硬盘或移动硬盘装Ubuntu 20.04 双系统

win11 安装双系统

qq_42817360的博客 5120

RK3568下MIPI屏幕调试技巧

通过合理配置设备树节点、精确计算像素时钟并完成编译烧录,可高效实现RK3568平台MIPI屏幕的点亮与显示调试。关键在于严格遵循屏幕规格书参数,结合内核日志定位问题,逐步优化时序配置。掌握这一流程后,开发者可快速适配不同分辨率、刷新率的MIPI屏幕,为嵌入式系统显示模块开发奠定基础。如果在调试中遇到特定问题(如驱动匹配失败、时钟计算误差),建议优先查阅屏幕规格书和RK3568芯片手册,或通过内核社区(如Linux-DRI邮件列表)获取支持。

文石_2009的博客 1198

生肉跑团视频怎么看?以《无垢之神》总集篇为例的CoC实况观看指南

桌面角色扮演游戏(TRPG)正从小众走向大众,其中《克苏鲁的呼唤》(CoC)凭借神秘学元素与强叙事性吸引大量新玩家。跑团实况作为记录游戏过程的重要载体,既包含玩家投骰、查询规则的原始细节,也承载KP与调查员之间即兴共创的戏剧张力。面对无字幕的“生肉”版本,很多人因语言门槛望而却步,但这类视频恰恰保留了最完整的游戏现场。理解“调查员、KP、SAN值、检定”等基础规则词,调整观看心态,掌握“先追主线、再看判定”的节奏,就能突破生肉障碍。本文以热门模组《无垢之神》总集篇为例,解析从规则认知、设备准备到剧情拆解的完

keke1314520的博客 504

基于Keil软件实现OLED显示(江协科技HAL库)

没有HAL库的OLED驱动文件,可以看过来

2401_82728381的博客 1447

建立你的第一个无状态会话Bean--HelloWorld之三

google_ad_client = "pub-8800625213955058";/* 336x280, 创建于 07-11-21 */google_ad_slot = "0989131976";google_ad_width = 336;google_ad_height = 280;//<script type="text/java

java专栏 454

ProcessingJoy —— 最简单的实时流体模拟【JAVA】

实现基于非常非常经典的 Paper ——Jos Stam 的Real-Time Fluid Dynamics for Games 代码和注释 float visc = 0.0f; float diff = 0.0f; int N = 250; int size = (N + 2) * (N + 2); float[] u = new float[size]; // 速度, 水平/竖直 float[] v = new float[size]; float[] u_prev = new fl...

ShaderJoy 的兴趣技术杂货铺 2808

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

weblogic 9下,把stateless session bean发布为web services

假设我已经把EJB做好了,是一个HelloWorld,下面说如何发布 Bean文件如下:   package han.ejb; import java.rmi.RemoteException;import javax.ejb.EJBException;import javax.ejb.SessionBean;import javax.ejb.SessionContext

tntvs110的专栏 637

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

MyEclipse+Weblogic开发EJB(一)

MyEclipse+Weblogic开发EJB 编写人:邬文俊编写时间:2005-11-14联系邮件:wenjunwu430@gmail.com前言学习ejb也有段日子了,一直没有找到好的资料指导如何在myeclipse下面开发ejb,令我十分苦恼。经过查阅资料和阅读myeclipse自带帮助,总结出该文档,希望该文档能够让大家迅速上手使用MyEclipse开发EJB组件,做为我们组的培训资料。如

Peter Wu 7864
上一篇: Struts1.x系列教程(9):上传任意多个文件
下一篇: 银河系列原创教程
keke1314520
博客等级 码龄20年 7粉丝 714原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值