EJBs with main () - what is it all?

While doing initial EJB training with Sun, I came across a rather strange concept of a corporate application client, which has the concept of dependecy injection and the 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 reference information about this. How:

  • How it should work.
  • How to run such an application without NetBeans.
  • How you build this construct without NetBeans (iE with Maven).

Yes, I use NetBeans - but I am not satisfied if I cannot perform the same operation on the command line and / or Maven.

+3
source share
2 answers

Answering my own question (again)

  • How should this work?

    main() , main(). (appclient).

  • NetBeans?

    , appclient. :

    appclient -enableassertions -mainclass auctionapp.TestClient -jar target/AuctionApp-ejb.jar

  • NetBeans (i.E. Maven)?

    . , ( ), lib. maven-assembly-plugin . .

. SO .

+2

.

Java EE Application Client ( Java EE, Java SE, EJB, ) Java EE Application Client Main-Class static.

NetBeans.

, , (ACC). .

, GlassFish appclient. JBoss . wiki () . :)

NetBeans (i.E. Maven).

- JAR, :

  • Java bean.
  • A META-INF/application-client.xml - () Java EE.
  • A META-INF/MANIFEST.MF , , Java.
  • ()

+5

Source: https://habr.com/ru/post/1772653/


All Articles