Java EE – EJB with main () – what is this about?

During the original training of EJB from sun, I came across a rather strange concept of enterprise application client, which has the concepts of dependency injection and main class:

@javax.ejb.EJB
private static auctionsystem.ejb.AuctionManagerRemote auctionManager;

public static void main (String[] args)
   {
   TestClient.logger.entering (TestClient.TAG,"main");

   final String message = "hello";
   TestClient.logger.log (Level.INFO,"Sending {0}",message);
   final String reply = auctionManager.communicationTest (message);
   TestClient.logger.log (Level.INFO,"Received {0}",reply);

   TestClient.logger.exiting (TestClient.TAG,"main");
   return;
   }

I just can't find any background information Like:

>What should this be. > How to start such applications without NetBeans. > How to build this construct without NetBeans (i.e. with Maven)

Yes, I do use NetBeans - but I'm not satisfied if I can't do the same on the command line and / or Maven

Solution

This must be a Java EE application client (another type of Java EE module that allows wrapping Java se applications, deploying them to application servers and using deployed EJBs, platform services and resources) and a Java EE application client main class that supports injection of resources in static annotation fields or methods

Assuming that the application client is packaged and deployed to the application server, you need to start the application client container (ACC) This command is application server specific

For example, to use GlassFish, you must use the appclient command To use JBoss, see this wiki page (huge) command For other application servers, refer to their respective documentation:)

The application client is a regular jar that contains:

>Java class for accessing beans. > Meta-INF / application-client. XML – (optional) Java EE application client deployment descriptor. > Reference the meta-inf / manifest. Of the main class MF file, which declares the complete package prefix and class name of the Java client. > App server specific deployment descriptor – (optional)

resources

>Java EE tutorial

> Creating the converter Application Client

>NetBeans tutorial

> Creating and Running an Application Client on the GlassFish Server

>Developing applications using WebLogic Server

> Dependency Injection of Resources

>GlassFish Development Guide

> Chapter 11 Developing Java Clients

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>