logging into manager webapp in tomcat 7 shows error - apache

Installed tomcat7 on my ubunut 12.04 LTS machine, tomcat installed successfully, but when i am trying to login into manager webapp it asks for username and password, on entering it also it doesn't log me in. It gives me 401 unauthorized error page.
here is my tomcat-users.xml
<?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>
<!--
NOTE: By default, no user is included in the "manager-gui" role required
to operate the "/manager/html" web application. If you wish to use this app,
you must define such a user - the username and password are arbitrary.
-->
<!--
NOTE: The sample user and role entries below are wrapped in a comment
and thus are ignored when reading this file. Do not forget to remove
<!.. ..> that surrounds them.
-->
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcatadmin" password="123#tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>
<role rolename="manager-gui"/>
<user username="tomcat" password="s3cret" roles="manager-gui"/>
</tomcat-users>

Thats not an error, its a state. You are simply not passing the right credentials. Add a user and some roles (see here) to the tomcat-users.xml, restart Tomcat and retry.

Related

JNDI lookup error for name: java:comp/env/jdbc/DynaPropDB

Am getting below error while starting the liberty server:
[ERROR ]
com.it.properties.PropertyResourceException for user [UnKnown] self logged on Jan 23, 2019 12:43:12 PM.
Exception instance reference code [13EE91EC-BCA0-49C1-7ABC-5F537ABC5F53].
I have DynaPropAdminWeb Access for the application
Correctly placed lookup-name and binding-name in web.xml file and ibm-web-bnd.xml file
It would be helpful if you provide the relevant web.xml, ibm-web-bnd.xml, and server.xml config snippets for the resource reference and data source. Absent that, taking your word that the deployment descriptor and binding file are correct, then the problem will be in the server config, either in incorrectly specifying the dataSource/jdbcDriver/library or with feature enablement. A common mistake in Liberty is forgetting to enable the jndi-1.0 feature (which is needed for JNDI lookups) alongside the jdbc-4.x feature. In case that is the problem, here is an example,
<server>
<featureManager>
<feature>jdbc-4.2</feature>
<feature>jndi-1.0</feature>
<feature>servlet-4.0</feature>
</featureManager>
<dataSource jndiName="jdbc/DynaPropDB">
<jdbcDriver libraryRef="jdbcLib"/>
<properties serverName="localhost" portNumber="1234" databaseName="exampleDB"/>
</dataSource>
<library id="jdbcLib">
<file name="C:/drivers/jdbc/myJdbcDriver.jar"/>
</library>
</server>
Also, here is a link to a knowledge center page with configuration examples for various commonly-used databases.

access tomcat manager from different host

I have installed tomcat 8 in a linux server.
From another host browser I was able to open the tomcat admin console but not able to open /manager/html.
I have made the changes in tomcat-users.xml and manager.xml and context.html.
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-gui"/>
<role rolename="manager-status"/>
<user username="tomcat" password=“password123" roles="manager-gui"/>
In /opt/tomcat8/apache-tomcat-8.5.8/webapps/host-manager
the changes were made in manager.xml
<Context docBase="${catalina.home}/webapps/manager"
privileged="true" antiResourceLocking="false" >
<Valve className="org.apache.catalina.valves.RemoteHostValve" allow="(*.).abc.corp.company.com"/
>
</Context>
I was getting the pop up to enter credentials to log into manager/html but the credentials were not getting validated and I am getting 401 unauthorized error.
Please throw some light.
Thanks
(Maybe a shot to the air, but...)
Check your tomcat-users.xml format: The double-quote after password= is a typographical quote, not a standard quote.

Openfire setup page

I'm trying to install Openfire 4.0.2 . My problem is that after restarting Openfire and pressing Admin Console I always see Setup Page. What should I do to fix it?
This is my openfire.xml file
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file stores bootstrap properties needed by Openfire.
Property names must be in the format: "prop.name.is.blah=value"
That will be stored as:
<prop>
<name>
<is>
<blah>value</blah>
</is>
</name>
</prop>
Most properties are stored in the Openfire database. A
property viewer and editor is included in the admin console.
-->
<!-- root element, all properties must be under this element -->
<jive>
<adminConsole>
<!-- Disable either port by setting the value to -1 -->
<port>7090</port>
<securePort>7091</securePort>
</adminConsole>
<locale>en</locale>
<!-- Network settings. By default, Openfire will bind to all network interfaces.
Alternatively, you can specify a specific network interfaces that the server
will listen on. For example, 127.0.0.1. This setting is generally only useful
on multi-homed servers. -->
<!--
<network>
<interface>127.0.0.1</interface>
</network>
-->
<!-- SPDY Protocol is npn.
(note: npn does not work with Java 8)
add -Xbootclasspath/p:/OPENFIRE_HOME/lib/npn-boot.jar to .vmoptions file -->
<!--
<spdy>
<protocol>npn</protocol>
</spdy>
-->
<!-- XEP-0198 properties -->
<stream>
<management>
<!-- Whether stream management is offered to clients by server. -->
<active>true</active>
<!-- Number of stanzas sent to client before a stream management
acknowledgement request is made. -->
<requestFrequency>5</requestFrequency>
</management>
</stream>
</jive>
Thank you.
In a file like this you miss the database part, so probably you never finished the setup really.
However there are 2 flags you must add:
in openfire.xml <setup>true</setup>
as child of <jive> tag
and in ofProperty table of database
INSERT INTO OFPROPERTY (NAME,PROPVALUE) VALUES ('setup','true');
The answer is, you have to uninstall Openfire and after delete Openfire folder which is situated in C:/ProgramFiles(x86)/ and reinstall Openfire.
The setup procedure of Openfire will, if it runs successfully, modify the content of the openfire.xml file. The most typical reason for this to fail is a file permission problem. Make sure that the user that is executing Openfire is allowed to read & write all files under the Openfire home folder.

How to properly configure WAS Liberty server.xml basicRegistry with MobileFirst Server and AdminCenter

I'm trying to install the latest version of MobileFirst Server 7.1 onto WAS Liberty 8.5.5.9 and am having difficulty enabling login for the installed WARs. This is a brand new installation. adminCenter-1.0 was installed before installing MobileFirst Server.
This page describes the root issue, but there appears to be something missing from the instructions. The instructions as written don't make sense to me in that in one sentence it says to "move" content added by the installation process, but in another sentence in that same paragraph says to "delete" it from server.xml.
As I've interpreted the instructions, I now have two basicRegistry elements with different ids as follows:
<basicRegistry id="basic" realm="BasicRealm">
<user name="admin" password="adminpwd" />
</basicRegistry>
<!-- Declare the user registry for the Application Center. -->
<basicRegistry id="applicationcenter-registry" realm="ApplicationCenter">
<!-- The users defined here are members of group "appcentergroup", thus have role "appcenteradmin", and can therefore perform administrative tasks through the Application Center console. -->
<user name="appcenteradmin" password="admin"/>
<user name="demo" password="demo"/>
<group name="appcentergroup">
<member name="appcenteradmin"/>
<member name="demo"/>
</group>
</basicRegistry>
But what I don't see is how to tie the new applicationcenter-registry to the MobileFirst Application Center. And sure enough, this configuration doesn't allow me to log into the WAS adminCenter, or the MobileFirst Application Center. It also generates the message that you'd expect:
There are multiple available UserRegistry implementation services; the system cannot determine which to use.
What is the proper server.xml configuration that will allow me to log in to both of these applications?
Thanks,
John
Within the server.xml, you can only have one basicRegistry. The documentation basically tells you to copy the content inside the <basicRegistry id="applicationcenter-registry" realm="ApplicationCenter">
to your <basicRegistry id="basic" realm="BasicRealm">
Then remove <basicRegistry id="applicationcenter-registry" realm="ApplicationCenter">
so you only have one basicRegistry, your own
<basicRegistry id="basic" realm="BasicRealm">, in the server.xml.
Check your server log to see if there is any error. If there is error related to the database, make sure your database is accessible and it has been started with root/admin right.
I believe the instructions are saying you should do this:
<basicRegistry id="basic" realm="BasicRealm">
<user name="admin" password="adminpwd" />
<!-- Declare the user registry for the Application Center. -->
<!-- The users defined here are members of group "appcentergroup", thus have role "appcenteradmin", and can therefore perform administrative tasks through the Application Center console. -->
<user name="appcenteradmin" password="admin"/>
<user name="demo" password="demo"/>
<group name="appcentergroup">
<member name="appcenteradmin"/>
<member name="demo"/>
</group>
</basicRegistry>
i.e., you should have a single <basicRegistry>, and it should contain your original users/groups (if any) and the users/groups for Application Center.

Tomcat 8 Basic auth

i am trying to implement BASIC auth in Apache Tomcat, but encounter a strange problem.
when i access the http://localhost:8080. The box is show allow to enter username and password, the problem is it seens can not auth success, the box show again and again.
below is my setting:
/WEB-INF/web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>test</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<security-constraint>
<web-resource-collection>
<web-resource-name></web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>manager</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>my realm</realm-name>
</login-config>
</web-app>
apache-tomcat-8.0.14/conf/tomcat-users.xml
<?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>
<!--
NOTE: By default, no user is included in the "manager-gui" role required
to operate the "/manager/html" web application. If you wish to use this app,
you must define such a user - the username and password are arbitrary.
-->
<!--
NOTE: The sample user and role entries below are wrapped in a comment
and thus are ignored when reading this file. Do not forget to remove
<!.. ..> that surrounds them.
-->
<!--
<role rolename="tomcat"/>
<role rolename="role1"/>
-->
<role rolename="manager" />
<!--
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>
-->
<user username="manager" password="manager" roles="manager"/>
</tomcat-users>
this is my project structure
WebContent/index.jsp
just a welcome file.
what did i do wrong? or what did i miss? i have searched much for this but still can not find a solution.
i am new to stackoverflow, hope my question is clear, and some body can help!
If you are using Eclipse integrated Tomcat, then configure tomcat-users.xml file that you can see in left navigation panel of your project. Servers --> Tomcat --> tomcat-users.xml
Remove my realm from your web.xml if you have not configured a realm called 'my realm' or set my-realm value as 'default'.