Re: Building a uber/fat jar

2017-09-30 Thread John D. Ament
I use Maven for the actual build. I use these dependencies (with 9.0.0.M26):


org.apache.tomcat.embed
tomcat-embed-core


org.apache.tomcat.embed
tomcat-embed-el


org.apache.tomcat
tomcat-juli


org.apache.tomcat.embed
tomcat-embed-websocket


And use the Capsule Maven Plugin to build the actual runtime (better
isolation than a shaded JAR):


com.github.chrisdchristo
capsule-maven-plugin
${capsule.maven.plugin.version}



build


your.main.class.here
fat





And then the actual bootstrap would look like this:
https://paste.apache.org/vVNs (I put it in a paste since it's pretty long).

On Sat, Sep 30, 2017 at 4:51 AM Brian Toal  wrote:

> Can someone point me to a example of how to run Tomcat as a embedded
> application, packaged in a uber jar?  I'm not interested in running via a
> war.  I've struggled to find a example.
>


web-fragment.xml in embedded containers

2017-01-23 Thread John D. Ament
Hi,

I was wondering if there was some configuration option that I could enable
in an embedded Tomcat container to have it process web-fragment.xml files?

John


Re: [OT] Tomcat listener not coming up - no stuck threads

2016-12-29 Thread John D. Ament
So I wanted to make sure I didn't lose track of this.  Did you want me to
revise what I put out there, or were you going to bring in your changes?

On Thu, Dec 15, 2016 at 5:06 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> John,
>
> On 12/15/16 5:03 PM, John D. Ament wrote:
> > On Thu, Dec 15, 2016 at 4:06 PM Christopher Schultz <
> > ch...@christopherschultz.net> wrote:
> >
> > Mark,
> >
> > On 12/15/16 2:44 PM, Mark Thomas wrote:
> >>>> On 15/12/2016 19:35, Christopher Schultz wrote:
> >>>>> John,
> >>>>>
> >>>>> On 12/14/16 10:01 PM, John D. Ament wrote:
> >>>>>> I was feeling ambitious so I gave this a shot.  Here's
> >>>>>> what I changed:
> >>>>>> https://github.com/johnament/tomcat85/commit/a0281b2d4e0fea7cb0f7
> a9d <https://github.com/johnament/tomcat85/commit/a0281b2d4e0fea7cb0f7a9d>
> >
> >>>>>>
> 3c
> > <https://github.com/johnament/tomcat85/commit/a0281b2d4e0fea7cb0f7a9d3
> c>
> >>>>>
> >>>>>>
> >
> >
> d1e750b48498ff2
> >>>>
> >>>> That was pretty much what I was thinking.
> >
> >
> >> If you want it, let me know.  I can provide a patch.  I'm not
> >> sure what tests to add, other than verify no extra threads were
> >> created.  I need to setup a bugzilla account too.
> >
> >
> >
> >>>>
> >>>>> My
> >>>>>
> >>>>> tack was going to be to create an ExecutorService that
> >>>>> didn't dispatch. That way, less code has to change.
> >>>>
> >>>> Seems like more work. And doesn't solve the original problem
> >>>> of the main thread holding a lock.
> >
> > No, it won't hold a lock. The (Abstract)ExecutorService just
> > dispatches to the execute(Runnable job) method which can simply
> > be:
> >
> > job.run()
> >
> > In that case, only one thread is ever involved: the thread that
> > submitted the job.
> >
> >
> >> The problem is that tomcat is expecting a ThreadPoolExecutor.  It
> >> may make sense to wrap it in a delegate that just handles the
> >> calls you need, since you're only calling one method on the
> >> executor.  That would simplify this logic as well.
>
> That was exactly what I was going to do: create a class that would do
> double-duty. So rather than if/else blocks behaving differently for
> the case where 1 thread is being used rather than >1, the
> ExecutorService (ThreadPoolExecutor) would handle the difference. So
> it would be a one-line change to the ContainerBase class.
>
> - -chris
> -BEGIN PGP SIGNATURE-
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJYUxPwAAoJEBzwKT+lPKRYmlwP/A/3F64wo3nJ46if8Ldm72hG
> 1zCUHD+ticxSX/wnjxjjItpy24jLw74d7ub/zuEGdXbcz0FZkL7HkX7uBqsoq/5K
> SR3fS4Vukz7h4aohDrkGFqMYcI48xZOBj2qPP26PNxKgBD4JbGGA/5kP2g1ItVbC
> EWhKRhHUJbP+sPqbyw6EGgxuGFczen/nXXhiTgDY5J5heG/4UoAOzCMJSbWzmywG
> lpPsa3UPvrErf43WE5AH8TijwxSOOSMCQDgVSDWgo5obqPRUzYE69f1h4pap7j5M
> HJlJZyaR+/5H3epfgyim1D4G6+LudvbS8chLIl0Dq9cPcFfbUny118ZSd9zs1n2D
> Np0q03wL4fTSfZTe95q8OWTdmGdwpg++GIoL8hsDg6wzkkPnWOX0mC3qc4TZ5Z8P
> cr+jW5VW12INwKyJROqe3KfX0IJQHS+MfddO+VDaItumibAeDeNEY+TTRsOWSq7k
> MSFH8Uic/S7EoWCTrGILTVgiZ5swAZIgIYSThSEukE3smltdnjZoR9juqwqz8ZgC
> ivIhrHx0lyHr36kbtebCgC/G9IRmv1oO5zNSUglCOmB4fsssxX84CUZXrcx1jxA2
> rdxgImaDw1igiLyhA++RUEL33t38wFzzqk0yfuNSZIa3jX7Obs89LY+wS6Oi6lMI
> bmjL4dBBuzbKbDgnTn26
> =JFw5
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: [OT] Tomcat listener not coming up - no stuck threads

2016-12-15 Thread John D. Ament
On Thu, Dec 15, 2016 at 4:06 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Mark,
>
> On 12/15/16 2:44 PM, Mark Thomas wrote:
> > On 15/12/2016 19:35, Christopher Schultz wrote:
> >> John,
> >>
> >> On 12/14/16 10:01 PM, John D. Ament wrote:
> >>> I was feeling ambitious so I gave this a shot.  Here's what I
> >>> changed:
> >>> https://github.com/johnament/tomcat85/commit/a0281b2d4e0fea7cb0f7a9d
> 3c
> <https://github.com/johnament/tomcat85/commit/a0281b2d4e0fea7cb0f7a9d3c>
> >>
> >>>
> d1e750b48498ff2
> >
> > That was pretty much what I was thinking.
>

If you want it, let me know.  I can provide a patch.  I'm not sure what
tests to add, other than verify no extra threads were created.  I need to
setup a bugzilla account too.



> >
> >> My
> >>
> >> tack was going to be to create an ExecutorService that didn't
> >> dispatch. That way, less code has to change.
> >
> > Seems like more work. And doesn't solve the original problem of the
> > main thread holding a lock.
>
> No, it won't hold a lock. The (Abstract)ExecutorService just
> dispatches to the execute(Runnable job) method which can simply be:
>
>job.run()
>
> In that case, only one thread is ever involved: the thread that
> submitted the job.
>

The problem is that tomcat is expecting a ThreadPoolExecutor.  It may make
sense to wrap it in a delegate that just handles the calls you need, since
you're only calling one method on the executor.  That would simplify this
logic as well.


>
> >> The problem with that approach is that, technically, the thread
> >> count can change for a variety of reasons and it should behave
> >> correctly at the time the contexts are started/stopped.
> >>
> >> I'd be interested in some comments on changing the behavior of
> >> Tomcat based upon the documentation of startStopThreads. For a
> >> value of "1", it explicitly says that 1 thread will be used. I'd
> >> be surprised if Tomcat were not to use a single (separate) thread
> >> rather than the main thread.
> >>
> >> Thing about this use-case: you have an embedded scenario where
> >> you want to launch Tomcat and you expect the start() call to
> >> return fairly soon so you can continue doing whatever you wanted
> >> to do. But instead of using the "1 thread" to start all the
> >> contexts, it's using the current thread and blocking you.
> >
> > That isn't what happens. The main thread always blocks until all
> > the container start threads have completed.
>
> Oh, well, then my use-case seems moot. Or, at least, no
> currently-running code will expect that behavior.
>
> >> I'm wondering if we need to invent a new magic number for this.
> >> Unfortunately, 0 is already taken. Perhaps we could use a
> >> non-numeric value for this special case.
> >
> > I don't see a need for that.
>
> I could imagine a need for that behavior, but there's an easier way
> for client code to handle it: launch Tomcat.start() from a separate
> thread.
>
> - -chris
> -BEGIN PGP SIGNATURE-
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJYUwXHAAoJEBzwKT+lPKRYYNwP/36ZY+6XsIU2GgsihjHxCIPe
> kixjLj6GZXtc8mhoBWRVg3D16dhG62PhCSt813JIKFZMQQMd/zjuYFV6qqkZlv4D
> 4k0+wxVGLC9oWZA0awuAfWOiAYeHDUEe6Rwr67oUrmpxNcanvv9uk0URxYWEZjzj
> YS5ogX/lxJ/EuYIxz2aOptQ8q6W/fARQTsAdiIL3KWy2kjrDvWH/8V46oQxUwdXJ
> ilqnMPvCkTwAyKqeCug4bsDr4V/Xk7gjdqttb0qlntfLYay1WmWx1mAnTCD77V/H
> 6iCSviICy7dFrif4dfTHJ8SS2a8WxXMPR+ng8daCCaZE4GcNqs7bp1z254626xSw
> f/Ob2JPlD8aAsjM6WwAhtdlsE/0DzwkKm0Ski3ejt/A2Uh8V5KfaECyNgg1dRoak
> czJxxegVyUotkUjx7nL8nqW3dwb2wFJjhUVb/KKiZrl6TC8ME0Ix8UvcCx+Ldaoe
> KDVyJjqDSvEECwHLkCUTMbdX0wCJ2qMoH3ULDXMIEHpot9tkDQEa8iUAC9oS7dP0
> zUmPY9syYwTBueRT0taSnpumrZ+iZkQIGPGEfX52kf90O9e8uGTFFSBMCoPpwI0M
> OfoH6A7g0I69tHiO05fFicj16Rf5BqoNQvKfn8CCzEJA41Uek9yTETGdlHUcbIZy
> NwWg49KyTN9G3o851TmW
> =QY5c
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: [OT] Tomcat listener not coming up - no stuck threads

2016-12-14 Thread John D. Ament
I was feeling ambitious so I gave this a shot.  Here's what I changed:
https://github.com/johnament/tomcat85/commit/a0281b2d4e0fea7cb0f7a9d3cd1e750b48498ff2
.
I get some failed tests, but generallys eems good (I broke it earlier, and
lots of things failed).

   [concat] Testsuites with failed tests:
   [concat]
TEST-org.apache.catalina.session.TestStandardSessionIntegration.NIO.txt
   [concat]
TEST-org.apache.catalina.session.TestStandardSessionIntegration.NIO2.txt
   [concat]
TEST-org.apache.catalina.startup.TestHostConfigAutomaticDeployment.NIO.txt
   [concat]
TEST-org.apache.catalina.startup.TestHostConfigAutomaticDeployment.NIO2.txt
   [concat]
TEST-org.apache.catalina.tribes.group.TestGroupChannelMemberArrival.NIO.txt
   [concat]
TEST-org.apache.catalina.tribes.group.TestGroupChannelMemberArrival.NIO2.txt
   [concat]
TEST-org.apache.catalina.tribes.group.TestGroupChannelStartStop.NIO.txt
   [concat]
TEST-org.apache.catalina.tribes.group.TestGroupChannelStartStop.NIO2.txt
   [concat]
TEST-org.apache.catalina.tribes.group.interceptors.TestOrderInterceptor.NIO.txt
   [concat]
TEST-org.apache.catalina.tribes.group.interceptors.TestOrderInterceptor.NIO2.txt
   [concat]
TEST-org.apache.catalina.tribes.group.interceptors.TestTcpFailureDetector.NIO.txt
   [concat]
TEST-org.apache.catalina.tribes.group.interceptors.TestTcpFailureDetector.NIO2.txt
   [concat]
TEST-org.apache.tomcat.util.net.openssl.ciphers.TestCipher.NIO.txt
   [concat]
TEST-org.apache.tomcat.util.net.openssl.ciphers.TestCipher.NIO2.txt
   [concat]
TEST-org.apache.tomcat.util.net.openssl.ciphers.TestOpenSSLCipherConfigurationParser.NIO.txt
   [concat]
TEST-org.apache.tomcat.util.net.openssl.ciphers.TestOpenSSLCipherConfigurationParser.NIO2.txt


I'm wondering, can I publish local maven artifacts using the ant build?
Would be good to see if this fixes or changes my behavior.

John

On Wed, Dec 14, 2016 at 12:22 PM Mark Thomas  wrote:

> On 14/12/2016 16:23, Christopher Schultz wrote:
> > Mark,
> >
> > On 12/8/16 4:19 AM, Mark Thomas wrote:
> >> On 07/12/2016 15:21, Christopher Schultz wrote:
> >>>
> >>> Hmm... there is the "startStopThreads" setting on the Engine,
> >>> but unfortunately there is not (currently available) setting that
> >>> says "don't use multiple threads at all". It looks like Tomcat is
> >>> always going to use at least one (separate) thread to launch the
> >>> various Hosts (and webapps).
> >
> >> It wouldn't be too hard to change that to not use an executor if
> >> the default of startStopThreads="1" was being used.
> >
> > +1 to running start on the main thread if startStopThreads="1".
> >
> > Where would I look to start working on a proposed patch? The Tomcat
> > Lifecycle isn't my strong suit.
>
> ContainerBase. Look for uses of startStopThreads.#
>
> >> However...
> >
> > Even if this doesn't solve John's problem, I think it's worth doing.
> >
> > Comments?
>
> No objections. I'd thought about it previously but it wasn't an itch I
> felt the urge to scratch.
>
> Mark
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Populating init parameters

2016-12-14 Thread John D. Ament
Mark,

On Wed, Dec 14, 2016 at 3:10 AM Mark Thomas <ma...@apache.org> wrote:

> On 14/12/2016 03:13, John D. Ament wrote:
> > Hi,
> >
> > I'm using Tomcat embedded to start a container.  I need to set some
> > initParameters in that embedded runtime.  However, when I try to set the
> > parameters I get the follow:
> >
> > java.lang.IllegalStateException: Initialization parameters cannot be set
> > after the context has been initialized
> >
> > at
> >
> org.apache.catalina.core.ApplicationContext.setInitParameter(ApplicationContext.java:1003)
> > at
> >
> org.apache.catalina.core.ApplicationContextFacade.setInitParameter(ApplicationContextFacade.java:624)
> >
> > I'm using the following to set the init parameter:
> >
> > Context ctx = tomcat.addContext("",base.getAbsolutePath());
> > ServletContext servletContext = ctx.getServletContext();
> > servletContext.setInitParameter("key","value");
> >
> > When i look, the tomcat instance is in the new state.  So it hasn't been
> > initialized yet.  I was wondering if this was an error?  I'm using Tomcat
> > 8.5.9.
>
> The error message might need a tweak for the embedded case but it is
> telling you the ServletContext is in the wrong state for editing the
> parameters.
>
> You want to add addParameter() on the Context object.
>

That worked.  Thanks.


>
> Mark
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: [OT] Tomcat listener not coming up - no stuck threads

2016-12-14 Thread John D. Ament
On Wed, Dec 14, 2016 at 11:23 AM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Mark,
>
> On 12/8/16 4:19 AM, Mark Thomas wrote:
> > On 07/12/2016 15:21, Christopher Schultz wrote:
> >>
> >> Hmm... there is the "startStopThreads" setting on the Engine,
> >> but unfortunately there is not (currently available) setting that
> >> says "don't use multiple threads at all". It looks like Tomcat is
> >> always going to use at least one (separate) thread to launch the
> >> various Hosts (and webapps).
> >
> > It wouldn't be too hard to change that to not use an executor if
> > the default of startStopThreads="1" was being used.
>
> +1 to running start on the main thread if startStopThreads="1".
>
> Where would I look to start working on a proposed patch? The Tomcat
> Lifecycle isn't my strong suit.
>
> > However...
>
> Even if this doesn't solve John's problem, I think it's worth doing.
>

Having an option to startStop on the main thread would fix my issue.
However would that be when startStopThreads = 1 or some other parameter (to
not break compatibility) ?

John


>
> Comments?
>
> - -chris
> -BEGIN PGP SIGNATURE-
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJYUXIcAAoJEBzwKT+lPKRYuWsQAMhrAt3mFLGio4u16ZABWLyG
> vPwlNRH24l9AnXu2yJ2FALS0ydIB8RTKW7BlwsdrlVAINQ8I0tWXFY4cn7jnMox3
> GLyg0ABmSIYqO/Qxqd4YIILBWWycNmvWn8BBgfLvqJaVDO/VB8vrsGClBnVbuqh8
> UetcFoCuIjXWpSQFBI7NhPouE4C145eMrmSmbz0Go7jtBPEfib5dgF26QepfX56M
> +ds8CDJc9OLusGSCvNgzYu7HXo3fBAFr52LoykQn6IqJbfv0PduiX8ySbLceBXpa
> VGlD9Fb9P/08wgANgBs7cbgkmxaEU/PnpXB/B5Mx8QbBV08Ajch3Rxedc2ikqMgi
> GP0n8xYzk0GaeEl8VSEwIQCbkib8kz4cR8s+nsiDwcq1WkFrIUqqr0UapN3dyRAS
> ySlfFyYN+Wbhe37lRjjQrMDsVcS8mX7t9ELKYRQ3difkmKeeme6D60tyNX/gEUPp
> NqHFeOknpgNw/Orj3KM6v1b9BAeRstFelx+kAffrc0G9Gz9GG8+BY7ThBvdfrSZO
> wp/ufXhmyVta57qVmmpwR7ua3b5npbCvgkIos6GTu2dKRMqRj2pBPBA3f9HyT82S
> 1IsYM72RhCTimrmskIb2/G6okRNa1aft5f3iypwsG6J1+ZLxgYROZVWfTbdA9WRS
> 2/n3/Gtg2yi9GhED0luy
> =FbNM
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Populating init parameters

2016-12-13 Thread John D. Ament
Hi,

I'm using Tomcat embedded to start a container.  I need to set some
initParameters in that embedded runtime.  However, when I try to set the
parameters I get the follow:

java.lang.IllegalStateException: Initialization parameters cannot be set
after the context has been initialized

at
org.apache.catalina.core.ApplicationContext.setInitParameter(ApplicationContext.java:1003)
at
org.apache.catalina.core.ApplicationContextFacade.setInitParameter(ApplicationContextFacade.java:624)

I'm using the following to set the init parameter:

Context ctx = tomcat.addContext("",base.getAbsolutePath());
ServletContext servletContext = ctx.getServletContext();
servletContext.setInitParameter("key","value");

When i look, the tomcat instance is in the new state.  So it hasn't been
initialized yet.  I was wondering if this was an error?  I'm using Tomcat
8.5.9.
John


Re: Tomcat listener not coming up - no stuck threads

2016-12-13 Thread John D. Ament
On Thu, Dec 8, 2016 at 4:20 AM Mark Thomas <ma...@apache.org> wrote:

> On 07/12/2016 15:21, Christopher Schultz wrote:
> > John,
> >
> > On 12/7/16 7:19 AM, John D. Ament wrote:
> >> On Wed, Dec 7, 2016 at 3:58 AM Mark Thomas <ma...@apache.org>
> >> wrote:
> >
> >>> On 06/12/2016 02:59, John D. Ament wrote:
> >>>
> >>> 
> >>>
> >>>> So I was able to identify my issue.  It's not specifically a
> >>>> tomcat problem, but tomcat's bootstrapping makes it unique.
> >>>>
> >>>> one of the issues I've observed is that Tomcat's use of
> >>>> multithreading causes some thread deadlocking with some
> >>>> synchronized blocks.  I was wondering if there's a way to turn
> >>>> that off?  Make tomcat's bootstrap happen in the same thread as
> >>>> the original invocation?
> >>>
> >>> What exactly do you mean by Tomcat's bootstrapping? Can you give
> >>> an example of concurrent execution that is causing issues?
> >>>
> >
> >> I instantiate the Tomcat object and invoke start() on the "main"
> >> thread. The invocation of ServletContextListeners happens on a
> >> "localhost-startStop-1" thread.  I would like to have that
> >> invocation happen on the main thread instead.
> >
> > Hmm... there is the "startStopThreads" setting on the Engine, but
> > unfortunately there is not (currently available) setting that says
> > "don't use multiple threads at all". It looks like Tomcat is always
> > going to use at least one (separate) thread to launch the various
> > Hosts (and webapps).
>
> It wouldn't be too hard to change that to not use an executor if the
> default of startStopThreads="1" was being used. However...
>
> >> Its nothing within tomcat that is deadlocking, but under the covers
> >> weld has a synchronized block, its inside that synchronized block
> >> where Tomcat is instantiated.  There's a later point where Weld
> >> tries getting a lock again.  In that case, when its single threaded
> >> (in other containers) it passes since it has a lock, but in this
> >> case it can't get that lock.
>
> The Weld documentation suggests that it is initialized per web
> application with a ServletContainerInitializer. This would be fine with
> Tomcat's current use of an Executor for container start/stop.
>
> I don't, therefore, understand how Weld is instantiating Tomcat. Can you
> expand on this?
>
>
There's two ways to make this work.  The documentation you're reading is
referring to standard servlet containers.  E.g. someone's installed tomcat
somewhere and has a WAR with weld-servlet in it.

In my case, I'm using weld-se to bootstrap a JVM, wrote a CDI extension
that bootstraps Tomcat embedded, pointing to the embedded weld instance.
Its not designed for multiple apps, but a single service in that JVM.
Since I'm using an extension, weld isn't 100% started yet.  Since it hasn't
started yet, some of the bootstrap logic is trying to fire an event.  That
event shouldn't be fired quite yet, and its not able to coordinate that
between the threads, hence where I got this problem.

I ended up working around the issue by delaying Tomcat's bootstrap even
further, ensuring that the container is 100% up before trying to launch
tomcat.



> Mark
>
> > Is there any way for you to remove the required monitor on your own
> > code? Or is Weld so intricately-involved in the whole process that
> > unwinding it isn't possible?
> >
> > -chris
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Tomcat listener not coming up - no stuck threads

2016-12-07 Thread John D. Ament
On Wed, Dec 7, 2016 at 3:58 AM Mark Thomas <ma...@apache.org> wrote:

> On 06/12/2016 02:59, John D. Ament wrote:
>
> 
>
> > So I was able to identify my issue.  It's not specifically a tomcat
> > problem, but tomcat's bootstrapping makes it unique.
> >
> > one of the issues I've observed is that Tomcat's use of multithreading
> > causes some thread deadlocking with some synchronized blocks.  I was
> > wondering if there's a way to turn that off?  Make tomcat's bootstrap
> > happen in the same thread as the original invocation?
>
> What exactly do you mean by Tomcat's bootstrapping? Can you give an
> example of concurrent execution that is causing issues?
>

I instantiate the Tomcat object and invoke start() on the "main" thread.
The invocation of ServletContextListeners happens on a
"localhost-startStop-1" thread.  I would like to have that invocation
happen on the main thread instead.

Its nothing within tomcat that is deadlocking, but under the covers weld
has a synchronized block, its inside that synchronized block where Tomcat
is instantiated.  There's a later point where Weld tries getting a lock
again.  In that case, when its single threaded (in other containers) it
passes since it has a lock, but in this case it can't get that lock.


>
> Mark
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Tomcat listener not coming up - no stuck threads

2016-12-05 Thread John D. Ament
On Sat, Dec 3, 2016 at 2:28 PM Mark Thomas <ma...@apache.org> wrote:

> On 03/12/2016 17:39, John D. Ament wrote:
> > Sorry missed a response..
> >
> > On Sat, Dec 3, 2016 at 12:36 PM John D. Ament <john.d.am...@gmail.com>
> > wrote:
> >
> >> On Wed, Nov 30, 2016 at 8:50 PM Christopher Schultz <
> >> ch...@christopherschultz.net> wrote:
> >>
> > John,
> >
> > On 11/26/16 7:29 PM, John D. Ament wrote:
> >>>> Hi,
> >>>>
> >>>> Looking for some external input.  I've put together a simple
> >>>> tomcat embedded instance designed to deploy an arbitrary set of
> >>>> servlets, filters, etc.
> >>>>
> >>>> For some reason, when I run tests with Tomcat the server never
> >>>> fully launches.  I can see the port in use, but connections to the
> >>>> server are not answered by the instance.  When I debug the start
> >>>> up, I see what appears to be a loop attempting to start services
> >>>> that never returns, in LifecycleBase.
> >
> > So you see a busy-loop? What's the stack trace?
> >
> >
> >> I am probably seeing a busy-loop, however I  see no stack traces.
>
> Take a thread dump.
>
> Better, take 3 ~10s apart and compare.
>
> > Tomcat version?
> >
> >
> > 8.5.8 and a few older ones, so 8.0.30 and 8.5.3 as well (that I can
> recall
> > recently)
> >
> >
> >
> >>>> Easiest way to reproduce it with this project is to clone
> >>>> https://github.com/hammock-project/hammock/ and run a local build
> >>>> (to get snapshots) and then run 'mvn clean install -Ptomcat-test'
> >>>> from rest-resteasy (or spark or jersey).
> >
> > Er... sorry, I'm not going to do that, and it doesn't look like anyone
> > else is going to do that, either.
> >
> >
> > Its always worth a shot.
> >
> >
> >
> >>>> I'm sure there's something simple I'm over looking.
> >
> > I browsed your github repo for about 15 seconds until I realized that
> > there are like 10k files and I'd never find the embedded driver
> > without asking. So, where is it?
> >
> > Can you compare your driver with any of the many Tomcat test cases
> > that launch an embedded server instance? Those test classes do exactly
> > what it sounds like you are trying to do.
> >
> >
> > Happily, can you point me to some of these test cases?
>
> Most of them under trunk/test
>
> This one has several variations:
>
> http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/connector/TestRequest.java?view=annotate
>
>
> > On a related note, documentation for tomcat embedded is scarce.  I
> usually
> > have to find it on non-apache channels.  What would be the best way to
> get
> > a document page started, maybe linked off of
> > http://tomcat.apache.org/tomcat-8.5-doc/index.html ?  What repo contains
> > your site?  I'd be happy to provide some patches from my own learnings.
>
> The docs are taken from the releases so you need to start here:
>
> http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/
>
>
So I was able to identify my issue.  It's not specifically a tomcat
problem, but tomcat's bootstrapping makes it unique.

one of the issues I've observed is that Tomcat's use of multithreading
causes some thread deadlocking with some synchronized blocks.  I was
wondering if there's a way to turn that off?  Make tomcat's bootstrap
happen in the same thread as the original invocation?


>
> Mark
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Tomcat listener not coming up - no stuck threads

2016-12-03 Thread John D. Ament
Sorry missed a response..

On Sat, Dec 3, 2016 at 12:36 PM John D. Ament <john.d.am...@gmail.com>
wrote:

> On Wed, Nov 30, 2016 at 8:50 PM Christopher Schultz <
> ch...@christopherschultz.net> wrote:
>
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> John,
>
> On 11/26/16 7:29 PM, John D. Ament wrote:
> > Hi,
> >
> > Looking for some external input.  I've put together a simple
> > tomcat embedded instance designed to deploy an arbitrary set of
> > servlets, filters, etc.
> >
> > For some reason, when I run tests with Tomcat the server never
> > fully launches.  I can see the port in use, but connections to the
> > server are not answered by the instance.  When I debug the start
> > up, I see what appears to be a loop attempting to start services
> > that never returns, in LifecycleBase.
>
> So you see a busy-loop? What's the stack trace?
>
>
I am probably seeing a busy-loop, however I  see no stack traces.


>
> Tomcat version?
>
>
> 8.5.8 and a few older ones, so 8.0.30 and 8.5.3 as well (that I can recall
> recently)
>
>
>
> > Easiest way to reproduce it with this project is to clone
> > https://github.com/hammock-project/hammock/ and run a local build
> > (to get snapshots) and then run 'mvn clean install -Ptomcat-test'
> > from rest-resteasy (or spark or jersey).
>
> Er... sorry, I'm not going to do that, and it doesn't look like anyone
> else is going to do that, either.
>
>
> Its always worth a shot.
>
>
>
> > I'm sure there's something simple I'm over looking.
>
> I browsed your github repo for about 15 seconds until I realized that
> there are like 10k files and I'd never find the embedded driver
> without asking. So, where is it?
>
> Can you compare your driver with any of the many Tomcat test cases
> that launch an embedded server instance? Those test classes do exactly
> what it sounds like you are trying to do.
>
>
> Happily, can you point me to some of these test cases?
>
> On a related note, documentation for tomcat embedded is scarce.  I usually
> have to find it on non-apache channels.  What would be the best way to get
> a document page started, maybe linked off of
> http://tomcat.apache.org/tomcat-8.5-doc/index.html ?  What repo contains
> your site?  I'd be happy to provide some patches from my own learnings.
>
> John
>
>
>
> - -chris
> -BEGIN PGP SIGNATURE-
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJYP4HoAAoJEBzwKT+lPKRYOL8P/A5MQFuVMK0kbgsAzbYVWx81
> yLsIN5BgjMBwPCxr2S2KIg40/P8dq256+VFYkwLI/Y3kKi206IK0KQdRJCTQFEO9
> avTOSFTgY3IXCCEEijSh5HeM8ofO7AgFrjcUGYZ6PI5PmnkCx/bN+sCAmbIL4SuE
> hpOdA+A6zaV7TFFqjk2b71dVeijCTO3B/nUjkwOY7lP56jOX4bM2YDZoZj1o0SsV
> bLsR3hjIlyZX1q83XNGPNYicueMZv9EsoUuZkwN3N/9CwTIbn27ck9xWfs3zOsOr
> DLppYHdcKQNByd630cL0xhgYEHShJJcUcRddXWCeuEJOQ0urFYvfiOW2H5Py86lE
> jwlA8XqIhvK5nmG5fOjwInSN3v+Fhd5A9rAhZrPZpP4+J1tGK37FvVhPJa9xXFWz
> OYgtUxP2y1zwYyq+qs5jCYy628HE3Y++YSUSK+mWSN8Id/jDBqKUzZkZWuc7750B
> wRy/8rb6F9L47sAVkg4gj8XqQF/gQ3gbS3ujf+eYuIf4GS4h1pmI4xCmuoZo0LLt
> NJo2k4jAfwx2l48BpjO9Ry8MaSft2a9vE0uBQR/jwY5dvn5Y0mYX8Dr2JgdFYpeW
> Skxf9+U2U/IzB2qePvdmo5u5QUyl40fu6/ndMjoEk/AXycwfodr6/UG9fLOG7uDR
> kLSU4n1jBzwEf+9WMtFA
> =7GKl
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Tomcat listener not coming up - no stuck threads

2016-12-03 Thread John D. Ament
On Wed, Nov 30, 2016 at 8:50 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> John,
>
> On 11/26/16 7:29 PM, John D. Ament wrote:
> > Hi,
> >
> > Looking for some external input.  I've put together a simple
> > tomcat embedded instance designed to deploy an arbitrary set of
> > servlets, filters, etc.
> >
> > For some reason, when I run tests with Tomcat the server never
> > fully launches.  I can see the port in use, but connections to the
> > server are not answered by the instance.  When I debug the start
> > up, I see what appears to be a loop attempting to start services
> > that never returns, in LifecycleBase.
>
> So you see a busy-loop? What's the stack trace?
>
> Tomcat version?
>

8.5.8 and a few older ones, so 8.0.30 and 8.5.3 as well (that I can recall
recently)


>
> > Easiest way to reproduce it with this project is to clone
> > https://github.com/hammock-project/hammock/ and run a local build
> > (to get snapshots) and then run 'mvn clean install -Ptomcat-test'
> > from rest-resteasy (or spark or jersey).
>
> Er... sorry, I'm not going to do that, and it doesn't look like anyone
> else is going to do that, either.
>

Its always worth a shot.


>
> > I'm sure there's something simple I'm over looking.
>
> I browsed your github repo for about 15 seconds until I realized that
> there are like 10k files and I'd never find the embedded driver
> without asking. So, where is it?
>
> Can you compare your driver with any of the many Tomcat test cases
> that launch an embedded server instance? Those test classes do exactly
> what it sounds like you are trying to do.
>

Happily, can you point me to some of these test cases?

On a related note, documentation for tomcat embedded is scarce.  I usually
have to find it on non-apache channels.  What would be the best way to get
a document page started, maybe linked off of
http://tomcat.apache.org/tomcat-8.5-doc/index.html ?  What repo contains
your site?  I'd be happy to provide some patches from my own learnings.

John


>
> - -chris
> -BEGIN PGP SIGNATURE-
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJYP4HoAAoJEBzwKT+lPKRYOL8P/A5MQFuVMK0kbgsAzbYVWx81
> yLsIN5BgjMBwPCxr2S2KIg40/P8dq256+VFYkwLI/Y3kKi206IK0KQdRJCTQFEO9
> avTOSFTgY3IXCCEEijSh5HeM8ofO7AgFrjcUGYZ6PI5PmnkCx/bN+sCAmbIL4SuE
> hpOdA+A6zaV7TFFqjk2b71dVeijCTO3B/nUjkwOY7lP56jOX4bM2YDZoZj1o0SsV
> bLsR3hjIlyZX1q83XNGPNYicueMZv9EsoUuZkwN3N/9CwTIbn27ck9xWfs3zOsOr
> DLppYHdcKQNByd630cL0xhgYEHShJJcUcRddXWCeuEJOQ0urFYvfiOW2H5Py86lE
> jwlA8XqIhvK5nmG5fOjwInSN3v+Fhd5A9rAhZrPZpP4+J1tGK37FvVhPJa9xXFWz
> OYgtUxP2y1zwYyq+qs5jCYy628HE3Y++YSUSK+mWSN8Id/jDBqKUzZkZWuc7750B
> wRy/8rb6F9L47sAVkg4gj8XqQF/gQ3gbS3ujf+eYuIf4GS4h1pmI4xCmuoZo0LLt
> NJo2k4jAfwx2l48BpjO9Ry8MaSft2a9vE0uBQR/jwY5dvn5Y0mYX8Dr2JgdFYpeW
> Skxf9+U2U/IzB2qePvdmo5u5QUyl40fu6/ndMjoEk/AXycwfodr6/UG9fLOG7uDR
> kLSU4n1jBzwEf+9WMtFA
> =7GKl
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Tomcat listener not coming up - no stuck threads

2016-11-26 Thread John D. Ament
Hi,

Looking for some external input.  I've put together a simple tomcat
embedded instance designed to deploy an arbitrary set of servlets, filters,
etc.

For some reason, when I run tests with Tomcat the server never fully
launches.  I can see the port in use, but connections to the server are not
answered by the instance.  When I debug the start up, I see what appears to
be a loop attempting to start services that never returns, in LifecycleBase.

Easiest way to reproduce it with this project is to clone
https://github.com/hammock-project/hammock/ and run a local build (to get
snapshots) and then run 'mvn clean install -Ptomcat-test' from
rest-resteasy (or spark or jersey).

I'm sure there's something simple I'm over looking.

John


Re: How to properly map a filter in tomcat embedded

2016-08-28 Thread John D. Ament
On Sun, Aug 28, 2016 at 5:07 AM Mark Thomas <m...@homeinbox.net> wrote:

> On 28 August 2016 02:33:00 BST, "John D. Ament" <johndam...@apache.org>
> wrote:
> >Hi,
> >
> >I have this pretty straight forward case of starting an instance of
> >tomcat
> >and bringing in a filter.
>
> 
>
> >When starting this up (Just running in a plain JUnit test), the
> >container
> >is running however making requests to localhost:8080/ just result in
> >404's.  I'd expect my filter to handle those requests.
> >
> >When using a servlet, its perfectly fine.
> >
> >I tried it on both 8.5.4 and 8.0.30.
> >
> >Any ideas?
>
> The Mapper (the component that Maps requests to the correct Host + Context
> + Servlet) expects to map a request to a Servlet and returns a 404 if none
> is found even if there is a filter that will handle the request.
>
> Normally you'd never see this behaviour because of the Default Servlet.
>

Ah ha, perfect tip!  I can simply programmatically register default servlet
if none found.  And that works!


>
> Mark
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


How to properly map a filter in tomcat embedded

2016-08-27 Thread John D. Ament
Hi,

I have this pretty straight forward case of starting an instance of tomcat
and bringing in a filter.

Tomcat tomcat = new Tomcat();
tomcat.setPort(8080);
File base = new File(".");
Context ctx = tomcat.addContext("", base.getAbsolutePath());
String filterName = "Default";
FilterDef filterDef = new FilterDef();
filterDef.setFilterName(filterName);
filterDef.setFilterClass(DefaultFilter.class.getName());
ctx.addFilterDef(filterDef);

FilterMap mapping = new FilterMap();
mapping.setFilterName(filterName);
mapping.addURLPattern("/*");
ctx.addFilterMap(mapping);
tomcat.start();
tomcat.getServer().await();
Thread.sleep(6);

My filter's pretty boring, but here it is

public class DefaultFilter implements Filter{
@Override
public void init(FilterConfig filterConfig) throws ServletException {

}

@Override
public void doFilter(ServletRequest servletRequest, ServletResponse
servletResponse, FilterChain filterChain) throws IOException,
ServletException {
servletResponse.getWriter().println("Hello, world!");
}

@Override
public void destroy() {

}
}

When starting this up (Just running in a plain JUnit test), the container
is running however making requests to localhost:8080/ just result in
404's.  I'd expect my filter to handle those requests.

When using a servlet, its perfectly fine.

I tried it on both 8.5.4 and 8.0.30.

Any ideas?

John


RE: diAdmin/launch/logon.do missing

2016-05-31 Thread John D. Ament
Is it vendor software or in house?
On May 31, 2016 18:27, "Michael Hargis"  wrote:

> Andre,
>   Sorry, kinda shooting in the dark here.
>
> Apache Tomcat 5.5.20
> Java 1.6.0.60
> Windows 2003 R2 Standard Edition Service Pack 2
>
> Data Integrator Management Console is what I the application I am trying
> to get to. It allows me to manage Business Objects Data Integrator jobs.
>
> Thanks for any help you can give me.
>
> Michael J. Hargis
> EDI Specialist
> Wockhardt/Morton Grove Pharmaceuticals
> 6451 Main St.
> Morton Grove, IL
> Phone: 847-410-6705
> Cell: 847-975-4872
>
> -Original Message-
> From: André Warnier (tomcat) [mailto:a...@ice-sa.com]
> Sent: Monday, May 30, 2016 7:52 AM
> To: users@tomcat.apache.org
> Subject: Re: diAdmin/launch/logon.do missing
>
> On 30.05.2016 14:44, Michael Hargis wrote:
> > Hello,
> > When I try to log on to Data Integrator Management Console I get the
> HTTP Status 404 message:
> > The requested resource (diAdmin/launch/logon.do) is not available.
> Anybody give me an idea how I might fix this problem?
> >
>
> Maybe, if you gave us some usable details about what you are talking
> about, such as :
> - is this a Tomcat webserver which you are trying to access ?
> - if yes,
>   - which version of Tomcat
>   - which version of Java
>   - which OS platform
>
> and what is "Data Integrator Management Console" ?
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>
>
>
> This communication (including its attachments) is the property of Morton
> Grove
>
> Pharmaceuticals (MGP) and Wockhardt USA, LLC (WUSA), is to be used by the
> intended recipient only, and may include MGP and WUSA confidential
> proprietary
> information.  The unauthorized use, disclosure, dissemination or copying
> of any
> part of this communication is prohibited.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: dataSource.getConnectionManager() is null

2016-05-08 Thread John D. Ament
Rob,

What database are you trying to connect to? What version of the JDBC driver?

On Sun, May 8, 2016 at 9:07 PM Rob Clemens  wrote:

> Hello all,
>
> We've had an application that was stable for several years, no changes for
> the last few aside from OS/java/tomcat patching. We've had no recent
> changes at the web/app server layer and our application started crashing
> about every 1-2 hours. We're running the following versions of software:
>
> apache-tomcat-7.0.52
> jdk1.6.0_113
> SunOS vs-danaus 5.10 Generic_150400-35 sun4v sparc sun4v
>
>
> Essentially, the only errors I see are the following that repeat themselves
> in the logs:
>
> [system:ERROR on 2016-05-08 21:02:27,250 ajp-bio-8009-exec-5]
> dataSource.getConnectionManager() is null
> [system:ERROR on 2016-05-08 21:02:27,251 ajp-bio-8009-exec-5]
> java.lang.NullPointerException trapped in filter: null
>
>
> A simple restart fixes it, but only for up to a couple of hours. Load does
> not matter in this case either. Let me know if you have any other questions
> and thank you in advance for your assistance.
>


Re: Information about incident ID 2205106170494020972

2016-04-04 Thread John D. Ament
Is it at all possible that you have some network level security that's
blocking your access to this port?

On Mon, Apr 4, 2016 at 10:03 PM Yin, Ivan  wrote:

> Hi,
>
> I am sure this error message doesn't come from that webapp since there is
> no "incident ID" in the webapp.
> In addition, I searched this error in google and I found a lot of similar
> error messages coming from different webapps deployed on tomcat so I
> thought it might come from Tomcat.
>
> The original error is:
>
> This page can't be displayed. Contact support for additional information.
> The incident ID is: N/A.
>
> I found the following message in http trace:
>
> This page can't be displayed. Contact support for additional information.
> The incident ID is: 2205106170494020972.
>
> May I know if there is a concept called "incident ID" in tomcat?
>
> Regards,
> Ivan
>
> -邮件原件-
> 发件人: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com]
> 发送时间: 2016年4月5日 9:38
> 收件人: Tomcat Users List 
> 主题: RE: Information about incident ID 2205106170494020972
>
> > From: Yin, Ivan [mailto:ivan@sap.com]
> > Subject: Information about incident ID 2205106170494020972
>
> > When I tried to click one button in the web application deployed in
> Tomcat 7, it throws
> > an error message as below:
>
> > This page can't be displayed. Contact support for additional information.
> > The incident ID is: 2205106170494020972.
>
> > May I know what is the meaning of this incident ID and how I can solve
> this issue?
>
> The message does not come from Tomcat itself, but most likely a webapp
> deployed under Tomcat.  As the message says, you'll need to contact the
> support personnel for the webapp.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail and
> its attachments from all computers.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: change persistence.xml at run time

2016-03-26 Thread John D. Ament
Well, Tomcat doesn't provide any support for JPA OOTB, so you'd probably
need to check w/ your JPA implementation on what they support.

John

On Sat, Mar 26, 2016 at 8:02 AM Kaouthar Ghorbel 
wrote:

> hello,
>
> I have two database that have the same design and the same tables , I
> already developped methods for  database  A and I want to reuse them  for
>  database  B.
>
>  for that I must change jndi in persistance.xml at run time , is it
> possible to do that?
>


Re: when idle tomcat runs on 3.9% CPU

2015-02-24 Thread John D. Ament
When you say idle, is there an application deployed to tomcat, or is it
just the bare app server with nothing deployed?

On Tue Feb 24 2015 at 7:35:31 AM Peter Irbizon peterirbi...@gmail.com
wrote:

 Hello,
 I would like to know if it is normal that tomcat7 runs on 3.9% CPU when
 idle? I saw all other processes are at 0%, only tomcat7 is always at least
 3.9%.



Re: login issue

2015-02-18 Thread John D. Ament
Thanks for providing!

The attribute name on the user is roles not role

  user username=tomcat1 password=tomcat1 roles=manager-script /

  user username=tomcat password=tomcat roles=manager-gui /


You should only define a user once and give them multiple roles.  Your file
should then look like this:

tomcat-users xmlns=http://tomcat.apache.org/xml;

  xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;

  xsi:schemaLocation=http://tomcat.apache.org/xml
tomcat-users.xsd

  version=1.0

  role rolename=manager-gui /

  role rolename=manager-script /

  role rolename=admin-gui /

  role rolename=admin-script /

  user username=charnasol password=charnasol role=manager-gui /

  user username=tomcat1 password=tomcat1 role=manager-script /

  user username=tomcat password=tomcat role=admin-script,admin-gui /

/tomcat-users


John



On Wed Feb 18 2015 at 12:36:49 PM James McEvoy tradingllc2...@gmail.com
wrote:

 l version='1.0' encoding='utf-8'?
 !--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the License); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an AS IS BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 --
 tomcat-users
   role rolename=manager-gui /
   role rolename=manager-script /
   role rolename=admin-gui /
   role rolename=admin-script /
   user username=charnasol password=charnasol role=manager-gui /
   user username=tomcat1 password=tomcat1 role=manager-script /
   user username=tomcat password=tomcat role=admin-gui /
   user username=tomcat password=tomcat role=admin-script /
 /tomcat-users


 On Wed, Feb 18, 2015 at 7:17 AM, James McEvoy tradingllc2...@gmail.com
 wrote:

  Will do.
 
 
  On Wednesday, February 18, 2015, Terence M. Bandoian tere...@tmbsw.com
  wrote:
 
  On 2/17/2015 9:51 AM, James McEvoy wrote:
 
  Checked logs, added admin and manager to all needed files and added url
  so
  it's ok for tomcat to use and still rejected when Logging in.
  Stumped. I started and stopped it etc.
 
 
 
  Hi, James-
 
  You might try posting the new contents of tomcat-users.xml (with
  passwords obfuscated).
 
  -Terence Bandoian
 
 
 
  On Tuesday, February 17, 2015, James McEvoy tradingllc2...@gmail.com
  wrote:
 
   Ok if will check all
 
  On Tuesday, February 17, 2015, John D. Ament johndam...@apache.org
  javascript:_e(%7B%7D,'cvml','johndam...@apache.org'); wrote:
 
   Check your logs for why.  Don't forget to include the manager-gui
 role
  in
  the list of roles.
 
  John
 
  On Tue Feb 17 2015 at 8:15:45 AM James McEvoy 
  tradingllc2...@gmail.com
  wrote:
 
   ok it wont take the shutdown command.
 
  On Tue, Feb 17, 2015 at 6:59 AM, James McEvoy 
  tradingllc2...@gmail.com
 
  wrote:
 
   couldnt screenshot so i just copied and pasted.
 
  ?xml version='1.0' encoding='utf-8'?
  !--
 Licensed to the Apache Software Foundation (ASF) under one or
 more
 contributor license agreements.  See the NOTICE file distributed
 
  with
 
 this work for additional information regarding copyright
 ownership.
 The ASF licenses this file to You under the Apache License,
  Version
 
  2.0
 
 (the License); you may not use this file except in compliance
  with
 the License.  You may obtain a copy of the License at
 
 http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing,
  software
 distributed under the License is distributed on an AS IS
 BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 
  implied.
 
 See the License for the specific language governing permissions
  and
 limitations under the License.
  --
  tomcat-users
 role rolename=tomcat /
 role rolename=role1 /
 user username=tomcat password=tomcat role=tomcat /
 user username=both password=tomcat role=tomcat,role1 /
 user username=role1 password=tomcat role=role1 /
  /tomcat-users
 
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
  For additional commands, e-mail: users-h...@tomcat.apache.org
 
 



Re: login issue

2015-02-18 Thread John D. Ament
Of course I copied the wrong one...

tomcat-users xmlns=http://tomcat.apache.org/xml;
  xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
  xsi:schemaLocation=http://tomcat.apache.org/xml
tomcat-users.xsd
  version=1.0
  role rolename=manager-gui /
  role rolename=manager-script /
  role rolename=admin-gui /
  role rolename=admin-script /
  user username=charnasol password=charnasol roles=manager-gui /
  user username=tomcat1 password=tomcat1 roles=manager-script /
  user username=tomcat password=tomcat roles=admin-script,admin-gui
/
/tomcat-users

On Wed Feb 18 2015 at 12:48:32 PM John D. Ament johndam...@apache.org
wrote:

 Thanks for providing!

 The attribute name on the user is roles not role

   user username=tomcat1 password=tomcat1 roles=manager-script /

   user username=tomcat password=tomcat roles=manager-gui /


 You should only define a user once and give them multiple roles.  Your
 file should then look like this:

 tomcat-users xmlns=http://tomcat.apache.org/xml;

   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;

   xsi:schemaLocation=http://tomcat.apache.org/xml
 tomcat-users.xsd

   version=1.0

   role rolename=manager-gui /

   role rolename=manager-script /

   role rolename=admin-gui /

   role rolename=admin-script /

   user username=charnasol password=charnasol role=manager-gui /

   user username=tomcat1 password=tomcat1 role=manager-script /

   user username=tomcat password=tomcat role=admin-script,admin-gui
 /

 /tomcat-users


 John



 On Wed Feb 18 2015 at 12:36:49 PM James McEvoy tradingllc2...@gmail.com
 wrote:

 l version='1.0' encoding='utf-8'?
 !--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the License); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an AS IS BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 --
 tomcat-users
   role rolename=manager-gui /
   role rolename=manager-script /
   role rolename=admin-gui /
   role rolename=admin-script /
   user username=charnasol password=charnasol role=manager-gui /
   user username=tomcat1 password=tomcat1 role=manager-script /
   user username=tomcat password=tomcat role=admin-gui /
   user username=tomcat password=tomcat role=admin-script /
 /tomcat-users


 On Wed, Feb 18, 2015 at 7:17 AM, James McEvoy tradingllc2...@gmail.com
 wrote:

  Will do.
 
 
  On Wednesday, February 18, 2015, Terence M. Bandoian tere...@tmbsw.com
 
  wrote:
 
  On 2/17/2015 9:51 AM, James McEvoy wrote:
 
  Checked logs, added admin and manager to all needed files and added
 url
  so
  it's ok for tomcat to use and still rejected when Logging in.
  Stumped. I started and stopped it etc.
 
 
 
  Hi, James-
 
  You might try posting the new contents of tomcat-users.xml (with
  passwords obfuscated).
 
  -Terence Bandoian
 
 
 
  On Tuesday, February 17, 2015, James McEvoy tradingllc2...@gmail.com
 
  wrote:
 
   Ok if will check all
 
  On Tuesday, February 17, 2015, John D. Ament johndam...@apache.org
  javascript:_e(%7B%7D,'cvml','johndam...@apache.org'); wrote:
 
   Check your logs for why.  Don't forget to include the manager-gui
 role
  in
  the list of roles.
 
  John
 
  On Tue Feb 17 2015 at 8:15:45 AM James McEvoy 
  tradingllc2...@gmail.com
  wrote:
 
   ok it wont take the shutdown command.
 
  On Tue, Feb 17, 2015 at 6:59 AM, James McEvoy 
  tradingllc2...@gmail.com
 
  wrote:
 
   couldnt screenshot so i just copied and pasted.
 
  ?xml version='1.0' encoding='utf-8'?
  !--
 Licensed to the Apache Software Foundation (ASF) under one or
 more
 contributor license agreements.  See the NOTICE file
 distributed
 
  with
 
 this work for additional information regarding copyright
 ownership.
 The ASF licenses this file to You under the Apache License,
  Version
 
  2.0
 
 (the License); you may not use this file except in compliance
  with
 the License.  You may obtain a copy of the License at
 
 http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing,
  software
 distributed under the License is distributed on an AS IS
 BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 
  implied.
 
 See the License for the specific language governing permissions
  and
 limitations under the License.
  --
  tomcat-users
 role rolename

Re: login issue

2015-02-17 Thread John D. Ament
Check your logs for why.  Don't forget to include the manager-gui role in
the list of roles.

John

On Tue Feb 17 2015 at 8:15:45 AM James McEvoy tradingllc2...@gmail.com
wrote:

 ok it wont take the shutdown command.

 On Tue, Feb 17, 2015 at 6:59 AM, James McEvoy tradingllc2...@gmail.com
 wrote:

  couldnt screenshot so i just copied and pasted.
 
  ?xml version='1.0' encoding='utf-8'?
  !--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the License); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at
 
http://www.apache.org/licenses/LICENSE-2.0
 
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an AS IS BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 implied.
See the License for the specific language governing permissions and
limitations under the License.
  --
  tomcat-users
role rolename=tomcat /
role rolename=role1 /
user username=tomcat password=tomcat role=tomcat /
user username=both password=tomcat role=tomcat,role1 /
user username=role1 password=tomcat role=role1 /
  /tomcat-users
 
 



Re: login issue

2015-02-17 Thread John D. Ament
And also make sure you bounce tomcat after updating the tomcat-users.xml
file.  It is not read dynamically, it is read on start up.

John

On Tue Feb 17 2015 at 7:23:34 AM Mark Thomas ma...@apache.org wrote:

 On 17/02/2015 12:17, James McEvoy wrote:
  Mark
  I did that one before and it didn't work either. I even tried admin-gui

 The manager-gui role isn't in the file you quoted below. It should be.
 Add it and then show us the new version of the file.

 Did you restart Tomcat after you edited tomcat-users.xml?

 If it still doesn't work, provide the full URL you are trying to access
 and the full text of any response you receive.

 Mark

 
 
  On Tuesday, February 17, 2015, Mark Thomas ma...@apache.org wrote:
 
  On 17/02/2015 11:59, James McEvoy wrote:
  couldnt screenshot so i just copied and pasted.
 
  No user has the manager-gui role.
 
  Mark
 
 
 
  ?xml version='1.0' encoding='utf-8'?
  !--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version
 2.0
(the License); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at
 
http://www.apache.org/licenses/LICENSE-2.0
 
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an AS IS BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  implied.
See the License for the specific language governing permissions and
limitations under the License.
  --
  tomcat-users
role rolename=tomcat /
role rolename=role1 /
user username=tomcat password=tomcat role=tomcat /
user username=both password=tomcat role=tomcat,role1 /
user username=role1 password=tomcat role=role1 /
  /tomcat-users
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 javascript:;
  For additional commands, e-mail: users-h...@tomcat.apache.org
  javascript:;
 
 
 


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




Re: Login issues

2015-02-16 Thread John D. Ament
What are the contents of your tomcat-users.xml?

On Mon Feb 16 2015 at 8:03:33 PM James McEvoy tradingllc2...@gmail.com
wrote:

 hi
 I've read every document I can and still after following all the steps it
 will not authenticate me to the login manager. I am using tomcat7.
 Thanks
 James



Re: JSR 236 with tomcat 8

2014-11-24 Thread John D. Ament
Concurrency utils is specific to app servers, where applications are
generally unable to create or manage threads.  This is an old EJB
limitation.

This limitation is not present in servlet containers.

Why do you think you need them?

On Mon, Nov 24, 2014 at 9:58 PM, shailendra singh
shailendra...@outlook.com wrote:
 Hi,

 I am looking for a way to use JSR 236 with tomcat 8.  Can someone please 
 suggest a way to achieve this?

 - Shailendra


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: JAX-WS Web Services

2014-10-12 Thread John D. Ament
Tomcat's a servlet container, not an app server.  If you want SOAP APIs,
you need to use a SOAP runtime like CXF in your app.

On Sun, Oct 12, 2014 at 10:16 AM, Meeraj Kunnumpurath 
mee...@servicesymphony.com wrote:

 Hi,

 I am porting an application from Weblogic 12 to Tomcat 8. The application
 has a set of web services that implement javax.xml.ws.ProviderSOAPMessage
 exposed by declaring them as servlets in web.xml. However, it doesn't seem
 to be working in Tomcat, when access the WSDL URL, I get a 404.

 Regards

 --
 *Meeraj Kunnumpurath*



 *Director and Executive PrincipalService Symphony Ltd00 44 7702
 693597mee...@servicesymphony.com mee...@servicesymphony.com*



Re: Embedded Tomcat question

2014-07-09 Thread John D. Ament
Well, thanks for the helpful advice thus far..

So, now that I've added a listener properly, I get this:

java.lang.UnsupportedOperationException: Section 4.4 of the Servlet
3.0 specification does not permit this method to be called from a
ServletContextListener that was not defined in web.xml, a
web-fragment.xml file nor annotated with @WebListener

at 
org.apache.catalina.core.StandardContext$NoPluggabilityServletContext.addListener(StandardContext.java:7019)

When I try adding my listener...

@WebListener
public class CdiServletContextListener implements ServletContextListener
{
@Override
public void contextInitialized(ServletContextEvent servletContextEvent)
{
servletContextEvent.getServletContext().addListener(new
CdiCtrlListener());
}

I even tried rigging my class to have WebListener on it.. until I
noticed the method just threw an exception... no questions asked. :-)

On Tue, Jul 1, 2014 at 12:37 PM, Mark Thomas ma...@apache.org wrote:
 On 01/07/2014 17:16, John D. Ament wrote:
 I looked for the source code, at least on github, there's no tag for
 7.0.55 defined (see [1])

 Given you are using 7.0.54, why would you look for a tag for 7.0.55?

 How do I get access to a StandardContext?  CAn I cast the Context object?

 Yes. It would have taken less time to try that than it did to type the
 question.

 Mark



 [1]: https://github.com/apache/tomcat

 On Mon, Jun 30, 2014 at 4:51 AM, Mark Thomas ma...@apache.org wrote:
 On 30/06/2014 01:27, John D. Ament wrote:
 I spoke a little too quickly, ServletContext is avilable from ctx
 (just didn't search hard enough).  Adding the request listener here
 though results in:

 java.lang.NullPointerException

 at 
 org.apache.catalina.core.ApplicationContext.createListener(ApplicationContext.java:1402)

 at 
 org.apache.catalina.core.ApplicationContext.addListener(ApplicationContext.java:1307)

 at 
 org.apache.catalina.core.ApplicationContextFacade.addListener(ApplicationContextFacade.java:636)

 A quick look in the source code will tell you why you are getting an NPE
 here.

 You can't add a ServletRequestListener directly. There are a couple of
 ways to do this. Probably the simplest is to create a
 ServletContextListener, add that directly to Tomcat's StandardContext
 with addApplicationLifecycleListener() and then from that
 ServletContextListener add and request and/or session listeners from the
 contextInitialized() event.

 You could also do this with a ServletContainerInitializer.

 Mark



 On Sun, Jun 29, 2014 at 8:21 PM, John D. Ament john.d.am...@gmail.com 
 wrote:
 Hi,

 I'm on Tomcat 7.0.54, though I would hope your APIs aren't volatile
 enough that your internals should matter..

 I tried this:

 Wrapper wrapper =
 Tomcat.addServlet(ctx,Greeter,GreeterServlet.class.getName());
 wrapper.addMapping(/*);
 wrapper.getServlet().getServletConfig().getServletContext().addListener(MyListener.class);

 This results in a NPE.  This makes me think I don't have access to the
 context yet.  I would actually think it's somewhere in this chain:

 tomcat = new Tomcat();
 tomcat.setPort(8080);
 File base = new File(target/webapp-runner);
 if(!base.exists()) {
 base.mkdirs();
 }
 Context ctx = tomcat.addContext(/,base.getAbsolutePath());

 however, it doesn't look like Context here is a ServletContext.


 On Sun, Jun 29, 2014 at 6:30 PM, Caldarale, Charles R
 chuck.caldar...@unisys.com wrote:
 From: John D. Ament [mailto:john.d.am...@gmail.com]
 Subject: Embedded Tomcat question

 Playing around a bit with embedded tomcat.  It looks like there are
 APIs to add all of the tomcat specific listeners, however how would I
 add a ServletRequestListener?

 Look in the servlet spec for the version of Tomcat you're using (which 
 you didn't mention), and the JavaDoc for ServletContext (e.g., 
 addListener).

  - Chuck


 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
 MATERIAL and is thus for use only by the intended recipient. If you 
 received this in error, please contact the sender and delete the e-mail 
 and its attachments from all computers.


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org

Re: Embedded Tomcat question

2014-07-01 Thread John D. Ament
I looked for the source code, at least on github, there's no tag for
7.0.55 defined (see [1])

How do I get access to a StandardContext?  CAn I cast the Context object?

[1]: https://github.com/apache/tomcat

On Mon, Jun 30, 2014 at 4:51 AM, Mark Thomas ma...@apache.org wrote:
 On 30/06/2014 01:27, John D. Ament wrote:
 I spoke a little too quickly, ServletContext is avilable from ctx
 (just didn't search hard enough).  Adding the request listener here
 though results in:

 java.lang.NullPointerException

 at 
 org.apache.catalina.core.ApplicationContext.createListener(ApplicationContext.java:1402)

 at 
 org.apache.catalina.core.ApplicationContext.addListener(ApplicationContext.java:1307)

 at 
 org.apache.catalina.core.ApplicationContextFacade.addListener(ApplicationContextFacade.java:636)

 A quick look in the source code will tell you why you are getting an NPE
 here.

 You can't add a ServletRequestListener directly. There are a couple of
 ways to do this. Probably the simplest is to create a
 ServletContextListener, add that directly to Tomcat's StandardContext
 with addApplicationLifecycleListener() and then from that
 ServletContextListener add and request and/or session listeners from the
 contextInitialized() event.

 You could also do this with a ServletContainerInitializer.

 Mark



 On Sun, Jun 29, 2014 at 8:21 PM, John D. Ament john.d.am...@gmail.com 
 wrote:
 Hi,

 I'm on Tomcat 7.0.54, though I would hope your APIs aren't volatile
 enough that your internals should matter..

 I tried this:

 Wrapper wrapper =
 Tomcat.addServlet(ctx,Greeter,GreeterServlet.class.getName());
 wrapper.addMapping(/*);
 wrapper.getServlet().getServletConfig().getServletContext().addListener(MyListener.class);

 This results in a NPE.  This makes me think I don't have access to the
 context yet.  I would actually think it's somewhere in this chain:

 tomcat = new Tomcat();
 tomcat.setPort(8080);
 File base = new File(target/webapp-runner);
 if(!base.exists()) {
 base.mkdirs();
 }
 Context ctx = tomcat.addContext(/,base.getAbsolutePath());

 however, it doesn't look like Context here is a ServletContext.


 On Sun, Jun 29, 2014 at 6:30 PM, Caldarale, Charles R
 chuck.caldar...@unisys.com wrote:
 From: John D. Ament [mailto:john.d.am...@gmail.com]
 Subject: Embedded Tomcat question

 Playing around a bit with embedded tomcat.  It looks like there are
 APIs to add all of the tomcat specific listeners, however how would I
 add a ServletRequestListener?

 Look in the servlet spec for the version of Tomcat you're using (which you 
 didn't mention), and the JavaDoc for ServletContext (e.g., addListener).

  - Chuck


 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
 MATERIAL and is thus for use only by the intended recipient. If you 
 received this in error, please contact the sender and delete the e-mail 
 and its attachments from all computers.


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Embedded Tomcat question

2014-06-29 Thread John D. Ament
Hi,

Playing around a bit with embedded tomcat.  It looks like there are
APIs to add all of the tomcat specific listeners, however how would I
add a ServletRequestListener?

John

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Embedded Tomcat question

2014-06-29 Thread John D. Ament
Hi,

I'm on Tomcat 7.0.54, though I would hope your APIs aren't volatile
enough that your internals should matter..

I tried this:

Wrapper wrapper =
Tomcat.addServlet(ctx,Greeter,GreeterServlet.class.getName());
wrapper.addMapping(/*);
wrapper.getServlet().getServletConfig().getServletContext().addListener(MyListener.class);

This results in a NPE.  This makes me think I don't have access to the
context yet.  I would actually think it's somewhere in this chain:

tomcat = new Tomcat();
tomcat.setPort(8080);
File base = new File(target/webapp-runner);
if(!base.exists()) {
base.mkdirs();
}
Context ctx = tomcat.addContext(/,base.getAbsolutePath());

however, it doesn't look like Context here is a ServletContext.


On Sun, Jun 29, 2014 at 6:30 PM, Caldarale, Charles R
chuck.caldar...@unisys.com wrote:
 From: John D. Ament [mailto:john.d.am...@gmail.com]
 Subject: Embedded Tomcat question

 Playing around a bit with embedded tomcat.  It looks like there are
 APIs to add all of the tomcat specific listeners, however how would I
 add a ServletRequestListener?

 Look in the servlet spec for the version of Tomcat you're using (which you 
 didn't mention), and the JavaDoc for ServletContext (e.g., addListener).

  - Chuck


 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
 MATERIAL and is thus for use only by the intended recipient. If you received 
 this in error, please contact the sender and delete the e-mail and its 
 attachments from all computers.


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Embedded Tomcat question

2014-06-29 Thread John D. Ament
I spoke a little too quickly, ServletContext is avilable from ctx
(just didn't search hard enough).  Adding the request listener here
though results in:

java.lang.NullPointerException

at 
org.apache.catalina.core.ApplicationContext.createListener(ApplicationContext.java:1402)

at 
org.apache.catalina.core.ApplicationContext.addListener(ApplicationContext.java:1307)

at 
org.apache.catalina.core.ApplicationContextFacade.addListener(ApplicationContextFacade.java:636)

On Sun, Jun 29, 2014 at 8:21 PM, John D. Ament john.d.am...@gmail.com wrote:
 Hi,

 I'm on Tomcat 7.0.54, though I would hope your APIs aren't volatile
 enough that your internals should matter..

 I tried this:

 Wrapper wrapper =
 Tomcat.addServlet(ctx,Greeter,GreeterServlet.class.getName());
 wrapper.addMapping(/*);
 wrapper.getServlet().getServletConfig().getServletContext().addListener(MyListener.class);

 This results in a NPE.  This makes me think I don't have access to the
 context yet.  I would actually think it's somewhere in this chain:

 tomcat = new Tomcat();
 tomcat.setPort(8080);
 File base = new File(target/webapp-runner);
 if(!base.exists()) {
 base.mkdirs();
 }
 Context ctx = tomcat.addContext(/,base.getAbsolutePath());

 however, it doesn't look like Context here is a ServletContext.


 On Sun, Jun 29, 2014 at 6:30 PM, Caldarale, Charles R
 chuck.caldar...@unisys.com wrote:
 From: John D. Ament [mailto:john.d.am...@gmail.com]
 Subject: Embedded Tomcat question

 Playing around a bit with embedded tomcat.  It looks like there are
 APIs to add all of the tomcat specific listeners, however how would I
 add a ServletRequestListener?

 Look in the servlet spec for the version of Tomcat you're using (which you 
 didn't mention), and the JavaDoc for ServletContext (e.g., addListener).

  - Chuck


 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
 MATERIAL and is thus for use only by the intended recipient. If you received 
 this in error, please contact the sender and delete the e-mail and its 
 attachments from all computers.


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org