You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dark Before Dawn <da...@gmail.com> on 2011/07/01 11:40:39 UTC

Re: Tomcat 7 Embedded: Manager

Hi again,
this is realy driving me nuts for weeks :)

I am developing a Java SE application using *Tomcat* 7 in embedded mode. 
  I am attempting to use the *tomcat* manager application 
(ManagerServlet) and Ant tasks to perform operations on the running 
*tomcat* instance.  Tasks such as list, start, stop work fine, however 
the deploy and undeploy tasks *fail* with the following *exception* (see 
below).  I actually get the same *exception* when trying to use the 
manager web interface (HTMLManagerServlet) which leads me to believe 
that this is a general configuration issue somewhere or misunderstanding 
in my code.

I guess there is still something wrong with my mappings as Chuck noticed.

/manager/html
/manager/jmxproxy
/manager/status
/manager/text

I realy read the API Documentation and UnitTest examples and haven't got 
any further :(

Code:
http://www.pastie.org/private/rehlryloo0zyl9korkupq

Errors via ANT and Web:

FAIL - Encountered exception javax.management.InstanceNotFoundException: Tomcat:type=Deployer,host=localhost

Trace:
01.07.2011 11:28:57 org.apache.catalina.core.ApplicationContext log
manager-servlet: managerServlet.check[/sample]
javax.management.InstanceNotFoundException: Tomcat:type=Deployer,host=localhost
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1094)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:833)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
	at org.apache.catalina.manager.ManagerServlet.isServiced(ManagerServlet.java:1433)
	at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:721)
	at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:350)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)

Cheers Darky

Am 28.06.2011 03:42, schrieb Caldarale, Charles R:
>> From: Dark Before Dawn [mailto:dark.before.dawn@gmail.com]
>> Subject: Re: Tomcat 7 Embedded: Manager
>> When using HTMLManagerServlet and navigating to http://localhost/manager
>> the Manager's HTML Interface will appear.
> It shouldn't, unless you've been playing with the mappings in WEB-INF/web.xml.  The valid URL paths are:
>
> /manager/html
> /manager/jmxproxy
> /manager/status
> /manager/text
>
> There is no /manager mapping, nor is there supposed to be one.  Note that each mapping has its own security constraint.
>
>   - 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-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


Re: Tomcat 7 Embedded: Manager

Posted by Dark Before Dawn <da...@gmail.com>.
sorry for that :) diddn't want to annoy
Cheers
Darky


Am 01.07.2011 12:41, schrieb Pid:
> On 01/07/2011 10:40, Dark Before Dawn wrote:
>> this is realy driving me nuts for weeks
> so *does* the arbit*rary* use of *bold* for me.
>
>
> p
>


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


Re: Tomcat 7 Embedded: Manager

Posted by Pid <pi...@pidster.com>.
On 01/07/2011 10:40, Dark Before Dawn wrote:
> this is realy driving me nuts for weeks

so *does* the arbit*rary* use of *bold* for me.


p


Tomcat 7 Embedded: Manager *additional info*

Posted by Dark Before Dawn <da...@gmail.com>.
Hi guys *kick* :)

I have additional info on this topic.
When deploying a webapp to an embedded tomcat server via ANT and listen 
all webapps via ANT afterwards, I noticed that the path information is 
completely missing for the freshly deployed webapp. In this case /test.
I think I missed to setup a path directive?!

      [LIST] OK - Listed applications for virtual host localhost
      [LIST] 
/manager:running:0:C:\Users\xx\AppData\Local\Temp\tc7embedded\webapps
      [LIST] /test:running:0:test

Java Code: http://pastie.org/2600008
Cheers
Darky

Am 27.09.2011 16:46, schrieb Dark Before Dawn:
> Hi guys,
> I am sorry to resurrect this topic, but I got stuck for weeks now.
>
> I would like to provide an embedded Tomcat 7 instance in my JavaSE 1.6 
> application (diploma thesis). This instance should run the 
> Manager-Application for easy War-Deployment via ANT.
>
> With help of this mailing-list I managed to create a privilged context 
> which hosts the HTMLManagerServlet and the ManagerServlet.
> Both show up correctly when browsing:
> http://localhost:8080/manager/html/
> http://localhost:8080/manager/text/
>
> I guess the Deployer is running too => 
> stdHost.addLifecycleListener(new HostConfig());
>
> Problem 1:
> ANT Script & ManagerServlet(Text): It is possible to 
> deploy/undeploy/start/stop a Webapplication via ANT.
> When deploying a WAR-file via Ant the file will be uploaded to webapps 
> folder and expanded afterwards. The ANT-script terminates successful 
> without warning.
> When browsing the HTMLManagerServlet the freshly deployed webapp is 
> shown correctly in the Application list.
> => ContextPath is correct and even the DisplayName is shown correctly.
> It is possible to Start/Stop/Repload/Undeploy this freshly deployed 
> webapp(browser/ant). But it is not possible to browse this webapp, I 
> just got 404 pages.
>
> Problem 2:
> HTMLManagerServlet won't upload WAR-file when selecting a WAR-file not 
> located on the server.
> Message: FAIL - File upload failed, no file
>
> Folders:
> C:\Users\darky\AppData\Local\Temp\tc7embedded
> C:\Users\darky\AppData\Local\Temp\tc7embedded\work
> C:\Users\darky\AppData\Local\Temp\tc7embedded\webapps
>
> Code: http://pastie.org/2600008
>
> Any help is appreciated! Thanks in advance!
> Cheers Darky


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


Tomcat 7 Embedded: Manager

Posted by Dark Before Dawn <da...@gmail.com>.
Hi guys,
I am sorry to resurrect this topic, but I got stuck for weeks now.

I would like to provide an embedded Tomcat 7 instance in my JavaSE 1.6 
application (diploma thesis). This instance should run the 
Manager-Application for easy War-Deployment via ANT.

With help of this mailing-list I managed to create a privilged context 
which hosts the HTMLManagerServlet and the ManagerServlet.
Both show up correctly when browsing:
http://localhost:8080/manager/html/
http://localhost:8080/manager/text/

I guess the Deployer is running too => stdHost.addLifecycleListener(new 
HostConfig());

Problem 1:
ANT Script & ManagerServlet(Text): It is possible to 
deploy/undeploy/start/stop a Webapplication via ANT.
When deploying a WAR-file via Ant the file will be uploaded to webapps 
folder and expanded afterwards. The ANT-script terminates successful 
without warning.
When browsing the HTMLManagerServlet the freshly deployed webapp is 
shown correctly in the Application list.
=> ContextPath is correct and even the DisplayName is shown correctly.
It is possible to Start/Stop/Repload/Undeploy this freshly deployed 
webapp(browser/ant). But it is not possible to browse this webapp, I 
just got 404 pages.

Problem 2:
HTMLManagerServlet won't upload WAR-file when selecting a WAR-file not 
located on the server.
Message: FAIL - File upload failed, no file

Folders:
C:\Users\darky\AppData\Local\Temp\tc7embedded
C:\Users\darky\AppData\Local\Temp\tc7embedded\work
C:\Users\darky\AppData\Local\Temp\tc7embedded\webapps

Code: http://pastie.org/2600008

Any help is appreciated! Thanks in advance!
Cheers Darky

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


Re: Tomcat 7 Embedded: Manager

Posted by Dark Before Dawn <da...@gmail.com>.
Hi Pid,
I wonder where the war-files are uploaded to? When uploading a war-file 
via HTMLManagerServlet a new error message will be shown:

 > MESSAGE: FAIL - File upload failed, no file

Do I need to enable file uploads somewhere? Is there a way to enable the 
Deployer via code or by adding new JARs?

Cheers and thanks in davance
Darky

Am 03.07.2011 13:33, schrieb Pid:
> On 01/07/2011 20:49, Dark Before Dawn wrote:
>> Hi Pid, hi Cuck!
>> thanks for your help. Your suggestions fixed the naming issues :) thanks!
>>
>> But the error still occurs.
>>
>> FAIL - Encountered exception javax.management.InstanceNotFoundException: Tomcat:type=Deployer,host=localhost
> The Deployer isn't in the list of MBeans visible in your JConsole
> screenshot, which is probably why you can't connect to it.
>
> I don't know why that is, but presumably the embedded code doesn't
> enable it.
>
>
>> I noticed an empty javax.management.ObjectName[0] Array, when browsing Servlet via jconsole. This could be in correlation to the exception above.
> The two things are not related.  The empty array refers to child objects
> of the servlet (should there be any? no...), not the webapp.
>
>
> p
>
>> See screenshots for further reference.
>>
>> If this is over we definitively need to grab some beer, I am buying :)
>>
>>
>>
>>
>> Am 01.07.2011 17:54, schrieb Pid:
>>> On 01/07/2011 12:44, Dark Before Dawn wrote:
>>>> Hi Pid,
>>>> i guess the problem is that the manager-servlet's context is "mounted"
>>>> at root and the ServletMapping points to /manager.
>>>>
>>>>> server.addContext("", baseDirectory);
>>>>> ctx.addServletMapping("/manager/*", manager-servlet);
>>>> So all relative paths will point to root
>>> That's easy to change, no?
>>>
>>>   server.addContext("/manager", baseDirectory);
>>>   ctx.addServletMapping("/text/*", manager-servlet);
>>>
>>> Note the additional '*' in the security collection:
>>>
>>>   collection.addPattern("/text/*");
>>>
>>> (The role usually assigned for the text manager servlet is "manager-script")
>>>
>>>
>>> p
>>>
>>>
>>>> ie:
>>>>
>>>> localhost/manager/html vs localhost/html
>>>>
>>>> I don't know what I am exactly searching for at jconsole, so here is a overview :)
>>>> Thnx and cheers
>>>> Darky
>>>>
>>>>
>>>>
>>>>
>>>> Am 01.07.2011 12:46, schrieb Pid:
>>>>> On 01/07/2011 10:40, Dark Before Dawn wrote:
>>>>>> Hi again,
>>>>>> this is realy driving me nuts for weeks :)
>>>>>> FAIL - Encountered exception javax.management.InstanceNotFoundException:
>>>>>> Tomcat:type=Deployer,host=localhost
>>>>> 1. Connect to your running instance with JConsole*.
>>>>> 2. Examine the MBeans published by the instance.
>>>>> 3. Confirm that you are connecting to the correct MBean.
>>>>>
>>>>>
>>>>> I wouldn't expect:
>>>>>
>>>>>   "Tomcat:type=Deployer,host=localhost"
>>>>>
>>>>> to work.
>>>>>
>>>>>
>>>>> p
>>>>>
>>>>>
>>>>> * or VisualVM with the JConsole plugin enabled.
>>>>>
>


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


Re: Tomcat 7 Embedded: Manager

Posted by Pid <pi...@pidster.com>.
On 01/07/2011 20:49, Dark Before Dawn wrote:
> Hi Pid, hi Cuck!
> thanks for your help. Your suggestions fixed the naming issues :) thanks!
> 
> But the error still occurs.
> 
> FAIL - Encountered exception javax.management.InstanceNotFoundException: Tomcat:type=Deployer,host=localhost

The Deployer isn't in the list of MBeans visible in your JConsole
screenshot, which is probably why you can't connect to it.

I don't know why that is, but presumably the embedded code doesn't
enable it.


> I noticed an empty javax.management.ObjectName[0] Array, when browsing Servlet via jconsole. This could be in correlation to the exception above.

The two things are not related.  The empty array refers to child objects
of the servlet (should there be any? no...), not the webapp.


p

> See screenshots for further reference.
> 
> If this is over we definitively need to grab some beer, I am buying :)
> 
> 
> 
> 
> Am 01.07.2011 17:54, schrieb Pid:
>> On 01/07/2011 12:44, Dark Before Dawn wrote:
>>> Hi Pid,
>>> i guess the problem is that the manager-servlet's context is "mounted"
>>> at root and the ServletMapping points to /manager.
>>>
>>>> server.addContext("", baseDirectory);
>>>> ctx.addServletMapping("/manager/*", manager-servlet);
>>> So all relative paths will point to root
>> That's easy to change, no?
>>
>>  server.addContext("/manager", baseDirectory);
>>  ctx.addServletMapping("/text/*", manager-servlet);
>>
>> Note the additional '*' in the security collection:
>>
>>  collection.addPattern("/text/*");
>>
>> (The role usually assigned for the text manager servlet is "manager-script")
>>
>>
>> p
>>
>>
>>> ie:
>>>
>>> localhost/manager/html vs localhost/html
>>>
>>> I don't know what I am exactly searching for at jconsole, so here is a overview :)
>>> Thnx and cheers
>>> Darky
>>>
>>>
>>>
>>>
>>> Am 01.07.2011 12:46, schrieb Pid:
>>>> On 01/07/2011 10:40, Dark Before Dawn wrote:
>>>>> Hi again,
>>>>> this is realy driving me nuts for weeks :)
>>>>> FAIL - Encountered exception javax.management.InstanceNotFoundException:
>>>>> Tomcat:type=Deployer,host=localhost
>>>> 1. Connect to your running instance with JConsole*.
>>>> 2. Examine the MBeans published by the instance.
>>>> 3. Confirm that you are connecting to the correct MBean.
>>>>
>>>>
>>>> I wouldn't expect:
>>>>
>>>>  "Tomcat:type=Deployer,host=localhost"
>>>>
>>>> to work.
>>>>
>>>>
>>>> p
>>>>
>>>>
>>>> * or VisualVM with the JConsole plugin enabled.
>>>>
>>
> 



Re: Tomcat 7 Embedded: Manager

Posted by Dark Before Dawn <da...@gmail.com>.
Hi Pid, hi Cuck!
thanks for your help. Your suggestions fixed the naming issues :) thanks!

But the error still occurs.

FAIL - Encountered exception javax.management.InstanceNotFoundException: Tomcat:type=Deployer,host=localhost

I noticed an empty javax.management.ObjectName[0] Array, when browsing Servlet via jconsole. This could be in correlation to the exception above.
See screenshots for further reference.

If this is over we definitively need to grab some beer, I am buying :)




Am 01.07.2011 17:54, schrieb Pid:
> On 01/07/2011 12:44, Dark Before Dawn wrote:
>> Hi Pid,
>> i guess the problem is that the manager-servlet's context is "mounted"
>> at root and the ServletMapping points to /manager.
>>
>>> server.addContext("", baseDirectory);
>>> ctx.addServletMapping("/manager/*", manager-servlet);
>> So all relative paths will point to root
> That's easy to change, no?
>
>   server.addContext("/manager", baseDirectory);
>   ctx.addServletMapping("/text/*", manager-servlet);
>
> Note the additional '*' in the security collection:
>
>   collection.addPattern("/text/*");
>
> (The role usually assigned for the text manager servlet is "manager-script")
>
>
> p
>
>
>> ie:
>>
>> localhost/manager/html vs localhost/html
>>
>> I don't know what I am exactly searching for at jconsole, so here is a overview :)
>> Thnx and cheers
>> Darky
>>
>>
>>
>>
>> Am 01.07.2011 12:46, schrieb Pid:
>>> On 01/07/2011 10:40, Dark Before Dawn wrote:
>>>> Hi again,
>>>> this is realy driving me nuts for weeks :)
>>>> FAIL - Encountered exception javax.management.InstanceNotFoundException:
>>>> Tomcat:type=Deployer,host=localhost
>>> 1. Connect to your running instance with JConsole*.
>>> 2. Examine the MBeans published by the instance.
>>> 3. Confirm that you are connecting to the correct MBean.
>>>
>>>
>>> I wouldn't expect:
>>>
>>>   "Tomcat:type=Deployer,host=localhost"
>>>
>>> to work.
>>>
>>>
>>> p
>>>
>>>
>>> * or VisualVM with the JConsole plugin enabled.
>>>
>


Re: Tomcat 7 Embedded: Manager

Posted by Pid <pi...@pidster.com>.
On 01/07/2011 12:44, Dark Before Dawn wrote:
> Hi Pid,
> i guess the problem is that the manager-servlet's context is "mounted"
> at root and the ServletMapping points to /manager.
> 
>> server.addContext("", baseDirectory);
>> ctx.addServletMapping("/manager/*", manager-servlet);
> 
> So all relative paths will point to root

That's easy to change, no?

 server.addContext("/manager", baseDirectory);
 ctx.addServletMapping("/text/*", manager-servlet);

Note the additional '*' in the security collection:

 collection.addPattern("/text/*");

(The role usually assigned for the text manager servlet is "manager-script")


p


> ie:
> 
> localhost/manager/html vs localhost/html
> 
> I don't know what I am exactly searching for at jconsole, so here is a overview :)
> Thnx and cheers
> Darky
> 
> 
> 
> 
> Am 01.07.2011 12:46, schrieb Pid:
>> On 01/07/2011 10:40, Dark Before Dawn wrote:
>>> Hi again,
>>> this is realy driving me nuts for weeks :)
>>
>>> FAIL - Encountered exception javax.management.InstanceNotFoundException:
>>> Tomcat:type=Deployer,host=localhost
>> 1. Connect to your running instance with JConsole*.
>> 2. Examine the MBeans published by the instance.
>> 3. Confirm that you are connecting to the correct MBean.
>>
>>
>> I wouldn't expect:
>>
>>  "Tomcat:type=Deployer,host=localhost"
>>
>> to work.
>>
>>
>> p
>>
>>
>> * or VisualVM with the JConsole plugin enabled.
>>
> 



RE: Tomcat 7 Embedded: Manager

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Dark Before Dawn [mailto:dark.before.dawn@gmail.com] 
> Subject: Re: Tomcat 7 Embedded: Manager

> i guess the problem is that the manager-servlet's context is 
> "mounted" at root

I think right there we have a conceptual problem, or at least a terminology one.  Webapps aren't "mounted" in the sense things are in httpd; every webapp in a servlet container is independent of the other webapps, and each webapp has _one_ unique URI path to select the webapp; normally, the path is also used as the deployment location (docBase, in Tomcat terminology).  The exception is the default webapp, which must be deployed as ROOT - case sensitive - in Tomcat, and has an empty path; it is selected only when no other webapp paths can be matched to the request URI.

Servlet mappings exist _within_ a webapp, and do not include the webapp path, so that the same webapp can be deployed under different paths as needed without changing the deployment descriptor.  Consequently, mappings for servlets within the manager webapp are of the form "/html/*" and "/text/*" rather than "/manager/html/*" and "/manager/text/*".

 - 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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 7 Embedded: Manager

Posted by Dark Before Dawn <da...@gmail.com>.
Hi Pid,
i guess the problem is that the manager-servlet's context is "mounted" 
at root and the ServletMapping points to /manager.

 > server.addContext("", baseDirectory);

 > ctx.addServletMapping("/manager/*", manager-servlet);

So all relative paths will point to root

ie:

localhost/manager/html vs localhost/html

I don't know what I am exactly searching for at jconsole, so here is a overview :)
Thnx and cheers
Darky




Am 01.07.2011 12:46, schrieb Pid:
> On 01/07/2011 10:40, Dark Before Dawn wrote:
>> Hi again,
>> this is realy driving me nuts for weeks :)
>
>> FAIL - Encountered exception javax.management.InstanceNotFoundException:
>> Tomcat:type=Deployer,host=localhost
> 1. Connect to your running instance with JConsole*.
> 2. Examine the MBeans published by the instance.
> 3. Confirm that you are connecting to the correct MBean.
>
>
> I wouldn't expect:
>
>   "Tomcat:type=Deployer,host=localhost"
>
> to work.
>
>
> p
>
>
> * or VisualVM with the JConsole plugin enabled.
>


Re: Tomcat 7 Embedded: Manager

Posted by Pid <pi...@pidster.com>.
On 01/07/2011 10:40, Dark Before Dawn wrote:
> Hi again,
> this is realy driving me nuts for weeks :)


> FAIL - Encountered exception javax.management.InstanceNotFoundException:
> Tomcat:type=Deployer,host=localhost

1. Connect to your running instance with JConsole*.
2. Examine the MBeans published by the instance.
3. Confirm that you are connecting to the correct MBean.


I wouldn't expect:

 "Tomcat:type=Deployer,host=localhost"

to work.


p


* or VisualVM with the JConsole plugin enabled.