File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JBoss/WildFly and the fly likes How to deploy standalone java Api in JBoss Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "How to deploy standalone java Api in JBoss" Watch "How to deploy standalone java Api in JBoss" New topic

How to deploy standalone java Api in JBoss

Maurice Tambouradj

Joined: Jun 10, 2012
Posts: 1

I have a standalone java project which is basically a Snmp trap listener. this application will keep listening in a port. currently this app will be started by calling main method.
how to deploy this project in Jboss. whenever jboss server is started this application should also started and keep listening in a port.

please advice me what should i do for this.

Thanks in advance,
Peter Johnson

Joined: May 14, 2008
Posts: 5852

Sounds like you want to convert this app into a service. Exactly how to do this depends on the version of Boss AS. For 6.x and earlier you would convert it into an MBean. Not sure what the corresponding thing would be in 7.x.

JBoss In Action
Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

Peter Johnson wrote:Not sure what the corresponding thing would be in 7.x.

AS 7.x supports MBeans too although the xsd for -service.xml files has changed slightly (some advanced features have been removed and no longer supported).

[My Blog] [JavaRanch Journal]
E Armitage

Joined: Mar 17, 2012
Posts: 989
In EE6 you'll want to look at @Startup and @Singleton but remember that

Why can an enterprise bean not listen to or accept connections on a socket?
Because if an enterprise bean is listening on a socket, it can't be passivated -- it must always be available. Enterprise beans can be network socket clients, and so they can use other network resources (including other enterprise bean servers) to do their jobs. Just as with a database connection, don't hang on to open client sockets across method calls; instead, open them, communicate through the socket, and close it before returning from the method.

Of course you could use container specific strategies to turn off passivation and probably get it to work but the question here is what is the motivation for deploying this into an EJB container?
I agree. Here's the link:
subject: How to deploy standalone java Api in JBoss
It's not a secret anymore!