EJB access is divided into remote client access, local client access, and WebService client.
The remote invocation of the so-called EJB is that the EJB object in the client and server is not in the same JVM process.
Local client is the client and server EJB Span lang= "en-US" style= "Font-family:calibri" >JVM process.
WebService clients can access stateless sessions Bean interface, only if the business logic method is identified as @WebMethod the time, WebService clients can access the.
Remote Call
In the absence of a remote call, we need to use someone else's data, directly to the other people's interface and implementation are taken over, and then hit their own package, so that on the one hand is caused by the code redundancy, their own package will be very large, on the other hand this is not a remote call.
Next we improve, change to a remote call, directly call someone else's interface can be manipulated. The advantage of this is the interface programming, the structure is clear, very flexible.
Client Configuration:
1 and of course need to call the EJB of the BEAN must be remote:
@Stateless (name= "Classeao") @Remote (Classeao.class) @TransactionManagement (Transactionmanagementtype.container) @ TransactionAttribute (transactionattributetype.required) public class Classeaoimpl extends exambase<class> Implements CLASSEAO {}
we are EAO the implementation of the add-on remote annotation.
2 , we inject Bean when you need to use a remote JNDI , in their own Web Layer Spring-mvc.xml the inside configuration, i.e.
<jee:jndi-lookup id= "Schoolteachingbean" Jndi-name= "ejb:itoo-basic-schoolteaching-ear/ itoo-basic-schoolteaching-core-0.0.1-snapshot/schoolteachingbeanimpl! Com.tgb.itoo.basic.service.SchoolTeachingBean "environment-ref=" EVN "></jee:jndi-lookup>
Note the above Jndi-name , our project is to make a Ear package, and removed the Ear The version number:
<build><finalName>${project.artifactId}</finalName></build>
at the same time Applicationcontext-common.xml The inside configuration is as follows:
<util:properties id= "EVN" location= "Classpath:config/jboss-ejb-client.properties" ></util:properties>
The aim is to pass EVN find the appropriate JBOSS configuration, which requires remote invocation of the JBOSS of the IP, port number, user name and password.
3 web Layer add configuration file Jboss-ejb-client.properties
endpoint.name =client-endpointremote.connectionprovider.create.options.org.xnio.options.ssl_enabled= falseorg.jboss.ejb.client.scoped.context=truejboss.naming.client.ejb.context=truecontext.url_pkg_prefixes= org.jboss.ejb.client.namingjavax.naming.context.initial_context_factory= Org.jboss.naming.remote.client.InitialContextFactoryremote.connection.default.connect.options.org.xnio.Options.SASL _policy_noanonymous=falseremote.connectionprovider.create.options.org.xnio.options.ssl_starttls= falsejboss.naming.client.connect.options.org.xnio.options.sasl_policy_noplaintext=falseremote.connections= Oneremote.connection.one.host=192.*.*.*remote.connection.one.port=4447remote.connection.one.username= Adminksremote.connection.one.password=!adminks123
is mainly configured IP and port numbers, and those that require remote calls. JBOSS account name and password, and we can also configure multiple remote invocation interfaces in JBoss.
4 , the final step, in their own Ear add in the bag Jboss-deployment-structure.xml The configuration is as follows:
<?xml version= "1.0" encoding= "UTF-8"? ><jboss-deployment-structure><sub-deployment name= " Itoo-assess-studentassess-web-0.0.1-snapshot.war "><dependencies><module name=" Org.jboss.xnio "/> </dependencies></sub-deployment></jboss-deployment-structure>
because the JBOSS version that is used now is EAP 6.2 compared to the previous version of the concept of adding modules (used to be loaded), the above configuration is added to find War bag Inside Jndi the configuration.
Summarize:
the above mainly describes the configuration of the EJB Remote Call client, mainly because after the release of JBOSS Upgrade Now, the highlight is jboss< /c6> modularity, but also because of this love and Hate module A series of problems, solve a series of problems. The next blog continues to say remote calls to JBOSS configuration.
JBOSS EAP 6.2-EJB Remote call-Client configuration