tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexis <>
Subject Re: custom class as resource
Date Mon, 31 Jan 2011 22:23:07 GMT

Sure, find attached 3 files

1. LCMS3, started as Listener.
2. Queue (started from LCMS3 and responsible to start threads connecting to a device and get
information see QueueExec on this class)
3. Parser , responsible to parse and process results obtained from Queue.QueueExec

This app is intended to do the following (extremely resumed)

. Mantain n connections via telnet to a device
. Read a queue of commands to execute on these device
. parse the result and do 2 things with those results
1> show them via web (no need to persist the result in any way), for this purpose i have
a servlet that will parse the result and return an xml to be parsed by extjs(from sencha)
2> persist the data in a database to make off-line reports.

to accomplish what is described in point 1, i thought to handle an object that holds instance
of every object i parse on the database, so

Queue.QueueExec, gets the command, Parser parses the result and store the command in this
object stored on servletcontext, so whenever the servlet that serves the xml need's it, can
access and present the info.

The section regarding point 2 is done (from the called parser i have calls to a DAO class
that access the database)

Let me know if you need more info.

thanks in advance

On Jan 31, 2011, at 7:13 PM, Christopher Schultz wrote:

> Hash: SHA1
> Alexis,
> On 1/31/2011 4:48 PM, alexis wrote:
>> The only difference i found is the class that sets the attribute on
>> the servletcontext extends ServletContextListener.
>> the class that access and reads the context extends HttpServlet and
>> shows the content upon an http request.
>> the class that gets the null pointer, also extends HttpServlet but
>> it's instantiated from another class and a method is called from
>> there.
> Can you show us the code?
> If you aren't calling YourNewServlet.init(ServletContext) then you will
> probably get NPEs. Tomcat provides lots of bootstrap services for
> servlets that you will have to provide yourself if you want to load,
> instantiate, and configure servlets yourself.
>> there's no http request on this class. i've also declared this
>> class as a servlet in the web.xml of my app.
> That may not matter, depending on what your code it doing. Tomcat is
> likely to create an Servlet instance that you cannot access, and you're
> just wasting memory.
> - -chris
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla -
> VqgAn3HryldcUCRxrBIHQrKhXkwdDhRs
> =7JfY
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message