第一个EJB示例

FirstEJB2.0.zip

Eclipse + JBoss 5.1

 

Ejb3Example.zip

Eclipse + JBoss 7.1

注意点:

1. jboss 增加用户:

D:\DevPrograms\jboss\jboss-as-7.1.1.Final\bin>add-user.bat

What type of user do you wish to add?
 a) Management User (mgmt-users.properties)
 b) Application User (application-users.properties)
(a): b

Enter the details of the new user to add.
Realm (ApplicationRealm) :
Username : cg
Password :
Re-enter Password :
What roles do you want this user to belong to? (Please enter a comma separated l
ist, or leave blank for none) : testrole
About to add user 'cg' for realm 'ApplicationRealm'
Is this correct yes/no? yes
Added user 'cg' to file 'D:\DevPrograms\jboss\jboss-as-7.1.1.Final\standalone\co
nfiguration\application-users.properties'
Added user 'cg' to file 'D:\DevPrograms\jboss\jboss-as-7.1.1.Final\domain\config
uration\application-users.properties'
Added user 'cg' with roles testrole to file 'D:\DevPrograms\jboss\jboss-as-7.1.1
.Final\standalone\configuration\application-roles.properties'
Added user 'cg' with roles testrole to file 'D:\DevPrograms\jboss\jboss-as-7.1.1
.Final\domain\configuration\application-roles.properties'
Press any key to continue . . .

  

2.  jboss-as-7.1.1.Final\standalone\configuration\standalone.xml

    <interfaces>
        <interface name="management">
            <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
        </interface>
        <interface name="public">
            <inet-address value="${jboss.bind.address:0.0.0.0}"/>
        </interface>
        <interface name="unsecure">
            <inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
        </interface>
		<-- add begin -->
        <interface name="any">
            <any-ipv4-address/>
        </interface>
		<-- add end -->
    </interfaces>
	<!--default-interface="public" 改为 default-interface="any"  >
    <socket-binding-group name="standard-sockets" default-interface="any" port-offset="${jboss.socket.binding.port-offset:0}">

3. EJB Client项目要引用:  jboss-as-7.1.1.Final\bin\client\jboss-client.jar

 

PS:

ejb查找名:
ejb:<app-name>/<module-name>/<distinct-name>/<bean-name>!<fully-qualified-classname-of-the-remote-interface>
ejb stateful:
ejb:<app-name>/<module-name>/<distinct-name>/<bean-name>!<fully-qualified-classname-of-the-remote-interface>?stateful

posted @ 2014-10-20 16:54  庚武  Views(307)  Comments(0Edit  收藏  举报