Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

A J2EE syslog server?

Thread view: 
Bogus Exception - 10 May 2007 17:11 GMT
If I'm using a J2EE container, how can I write a server like a UDP
port 515 syslog server that would run in the container? I am guessing
a servlet might be needed, but I don't know how to write a servlet as
a stateless bean.

And besides, a pool of beans all listening to the same port doesn't
sound feasible, either! :)

So do I need to write a J2SE app that points to a stateless bean, or
use JCA, or? The server and container would be on the same machine, so
I'm hoping to find an elegant example. Perhaps the solution is to find
a way to tell the container to ensure one-and only one-instance are
running at a time?

There are lots of examples of web services, but nothing I've found
(books or online) shows how to accomplish this utilizing J2EE.

If it helps, EJB3 and JBoss....

TIA!
Philipp Taprogge - 10 May 2007 19:17 GMT
Hi!

> a servlet might be needed, but I don't know how to write a servlet as
> a stateless bean.

Other conciderations aside, that's simply because you don't.
Normally, a JEE application consists of servlets servicing clients
and session beans that contain the business login. When a request is
received, the servlet will acquire a session bean (usually through
JNDI) and call some methods on it, generating a respons for the
client in the process.

I am not certain, however, if a servlet container can bind a servlet
to a udp port at all...

> So do I need to write a J2SE app that points to a stateless bean, or
> use JCA, or?

That depends on what exactly you have in mind...

> The server and container would be on the same machine, so
> I'm hoping to find an elegant example. Perhaps the solution is to find
> a way to tell the container to ensure one-and only one-instance are
> running at a time?

That would be a Singleton. Whether or not that will solve your
problem again depends on what you are aiming.

> There are lots of examples of web services, but nothing I've found
> (books or online) shows how to accomplish this utilizing J2EE.

Well, at least I have never heard of anything to interface syslog
and a JEE application...

Regards,

    Phil
Bogus Exception - 11 May 2007 18:51 GMT
Phil,

Thanks for writing!

> I am not certain, however, if a servlet container can bind a servlet
> to a udp port at all...

My point, exactly. If I can't create an app in the container that can
service clients on a specific port, then I'll need to use an external
one, then point it to a stateless session bean.

> > So do I need to write a J2SE app that points to a stateless bean, or
> > use JCA, or?
>
> That depends on what exactly you have in mind...

What I have in mind is to create a syslog server. I am shooting for a
100% container-based application, though, without having to tie in
other applications on the server.

> Well, at least I have never heard of anything to interface syslog
> and a JEE application...

A syslog server application is the most basic example. Other examples
include a telnet server, or other applications communicating on other
ports, using either UDP or TCP.

If the answer is that you cannot put the (network) server part of the
application in the app server, then that is the answer I was looking
for.

Thanks again!
Philipp Taprogge - 11 May 2007 20:56 GMT
Hi!

> If the answer is that you cannot put the (network) server part of the
> application in the app server, then that is the answer I was looking
> for.

Well, I think, you cannot. In JEE, the network interaction tier is
part of the container, i.e. appserver, not the application inside.
You could, however integrate your custom components into the
container if it's OpenSource. That way you will still have to write
and deploy it separately from the application, but you will at least
have all components living inside the same server and share the same
VM and JNDI realm.

Regards,

    Phil
Bogus Exception - 11 May 2007 21:20 GMT
Phil,

Interesting idea. I wonder what would be needed to enable the app
server to handle non-WS network traffic as you describe.

Main reason to have things simple: I'm trying to make something easy
to deploy.

Failing to do that, I need to learn how to do it otherwise!

Thanks for writing!

> Hi!
>
[quoted text clipped - 13 lines]
>
>         Phil
Philipp Taprogge - 11 May 2007 22:01 GMT
Hi!

> Interesting idea. I wonder what would be needed to enable the app
> server to handle non-WS network traffic as you describe.

In the case of JBoss, you'd have to roll your own connector and add
it to the embedded tomcat to handle the udp syslog traffic. That
will require delving deeply into the guts of the server itself.
Whether it's worth it, is for you to decide.

Regards,

    Phil
Bogus Exception - 12 May 2007 05:17 GMT
Phil,

Thanks for writing, and continuing the thread. I'm sure it seems
tedious to you! :)

I don't see having the app server ensuring the (JCA) connector is
running as a problem. I'm curious about the code running in a separate
thread that is the actual UDP server, though. In a perfect world, the
app server could keep tabs on the UDP network server code
(singleton?).

It would be an odd restriction to have so many components of the
solution outside the container. What would you say is the most logical
design pattern for ease of deployment, and higher application
availability?

TIA!

> In the case of JBoss, you'd have to roll your own connector and add
> it to the embedded tomcat to handle the udp syslog traffic.
Arne Vajhøj - 11 May 2007 01:28 GMT
> If I'm using a J2EE container, how can I write a server like a UDP
> port 515 syslog server that would run in the container? I am guessing
> a servlet might be needed, but I don't know how to write a servlet as
> a stateless bean.

To listen to UDP on a given port you should use a JCA inbound adapter.

Arne
Bogus Exception - 11 May 2007 19:53 GMT
> > If I'm using a J2EE container, how can I write a server like a UDP
> > port 515 syslog server that would run in the container? I am guessing
[quoted text clipped - 4 lines]
>
> Arne

Arne,

Thanks for writing. So I'll need to write the (network) server
component separate from the app server, then  call a server component/
bean, right?

Thanks!
Arne Vajhøj - 12 May 2007 00:15 GMT
>>> If I'm using a J2EE container, how can I write a server like a UDP
>>> port 515 syslog server that would run in the container? I am guessing
>>> a servlet might be needed, but I don't know how to write a servlet as
>>> a stateless bean.
>> To listen to UDP on a given port you should use a JCA inbound adapter.

> Thanks for writing. So I'll need to write the (network) server
> component separate from the app server, then  call a server component/
> bean, right?

Not really.

You write your JCA adapter, package it in a .rar file, deploy
that to the app server and the JCA adapter calls a MDB deployed
like any other EJB and that MDB can call whatever code is needed.

Arne
Bogus Exception - 12 May 2007 05:20 GMT
Arne,

Thank you for writing. This covers the JCA connector in a way that is
still not controlled/monitored by the container. And the actual UDP
server code would also be a Tomcat servlet, right?

If so, is there no way to make the system more reliable?

TIA!

> Not really.
>
> You write your JCA adapter, package it in a .rar file, deploy
> that to the app server and the JCA adapter calls a MDB deployed
> like any other EJB and that MDB can call whatever code is needed.
Arne Vajhøj - 12 May 2007 15:27 GMT
> Thank you for writing. This covers the JCA connector in a way that is
> still not controlled/monitored by the container.

Wrong.

>                                              And the actual UDP
> server code would also be a Tomcat servlet, right?

Wrong.

Try read about JCA.

Arne


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.