handling tomcat out of eclipse

M

marcelino

Hi java communitiy,

using the sysdeo tomcat-plugin and I could start and restart the
tomcat out of eclipse already. But I had to reinstall the tomcat.
Since I ve done that tomcat denies my access in tomcat-users.xml. What
I tried is, I applied a tomcat manager app-user with name and passwd
of the current user and I also added a user tag in the xml-file with
the same user and applied a role with the username. But still got the
same error message. Guess I edited something wrong.
If somebody has a hint I would be very thankful.

thanks in advance

marcelino
 
M

Markos Charatzas

Hello,

Make sure that tomcat-users.xml under /conf within the tomcat directory
looks similar to this

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="role1" password="tomcat" roles="role1"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
</tomcat-users>

and add your own <user> tag specifying a username, password and a role.

Also, in web.xml within the WEB-INF directory of your project add the
following:

<security-constraint>
<web-resource-collection>
<web-resource-name>[Name you
like]</web-resource-name>
<url-pattern>/servlet/[ServletName]</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>

<auth-constraint>
<role-name>[the rolename you specified in
tomcat-users for the user you entered]</role-name>
</auth-constraint>
</security-constraint>

<login-config>
<auth-method>BASIC</auth-method>
<realm-name>[Any name you like. E.g. Hello
World!]</realm-name>
</login-config>

<security-role>
<role-name>[the rolename you specified in tomcat-users
for the user you entered]</role-name>
</security-role>


Markos Charatzas
 
M

marcelino

Hi again and thanks so far,

your hints were very helpful!
My tomcat-user.xml looks like below with one additional user and the
two role- tags (admin, manager):

<user username="mbert" password="wasser"
roles="manager,admin,role1,tomcat"/>

I can handle tomcat in shell but out of eclipse the access is still
denied:

GlobalResourcesLifecycleListener: Exception processing Global JNDI
Resources
javax.naming.NamingException:
/opt/jakarta/tomcat/conf/tomcat-users.xml.new (Permission denied)
at org.apache.naming.NamingContext.lookup(NamingContext.java:844)
etc.

Also I have an authentication- error when I try to refresh the
server.xml out of eclipse.

marcelino


Markos Charatzas said:
Hello,

Make sure that tomcat-users.xml under /conf within the tomcat directory
looks similar to this

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="role1" password="tomcat" roles="role1"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
</tomcat-users>

and add your own <user> tag specifying a username, password and a role.

Also, in web.xml within the WEB-INF directory of your project add the
following:

<security-constraint>
<web-resource-collection>
<web-resource-name>[Name you
like]</web-resource-name>
<url-pattern>/servlet/[ServletName]</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>

<auth-constraint>
<role-name>[the rolename you specified in
tomcat-users for the user you entered]</role-name>
</auth-constraint>
</security-constraint>

<login-config>
<auth-method>BASIC</auth-method>
<realm-name>[Any name you like. E.g. Hello
World!]</realm-name>
</login-config>

<security-role>
<role-name>[the rolename you specified in tomcat-users
for the user you entered]</role-name>
</security-role>


Markos Charatzas
Hi java communitiy,

using the sysdeo tomcat-plugin and I could start and restart the
tomcat out of eclipse already. But I had to reinstall the tomcat.
Since I ve done that tomcat denies my access in tomcat-users.xml. What
I tried is, I applied a tomcat manager app-user with name and passwd
of the current user and I also added a user tag in the xml-file with
the same user and applied a role with the username. But still got the
same error message. Guess I edited something wrong.
If somebody has a hint I would be very thankful.

thanks in advance

marcelino
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,919
Messages
2,570,037
Members
46,444
Latest member
MadeleineH

Latest Threads

Top