Re: ant install build.xml:372: java.net.ProtocolException: Server redirected too many times (20)

2019-12-20 Thread Zahid Rahman
>any suggestions would be welcome.
Thank you.

I have dome some play around and I found
if the tomcat-user.xml has

**


**
Then with url http://localhost:8080/manager gives 403 Access Denied error
page.

if the tomcat-user.xml only has


**

then url http://localhost:8080/manager shows the Tomcat Web Application
Manager
page without asking me to login.

As you know syntax is unforgiving It must be exact. The change I would
suggest is this :-
At the url http://localhost:8080/manager initially a 403 access denied page
was displayed
with instructions on how to rectify it. So I did.
BUT  with url http://localhost:8080/manager/text
the 403 access denied page does not  show how to add a second  element,
manager-script to manager-gui.
  
  **
  

So first I made some guesses which didn't work based my common sense, my
common sense was doing it.
then I had to google to find  the syntax for adding second  , third , so
elements.
CHANGE@I believe the 403 page should show how to add a second element
syntax.














On Fri, 20 Dec 2019 at 14:21, Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Zahid,
>
> On 12/19/19 16:36, Zahid Rahman wrote:
> > *SUCCESSS...*
> >
> > Buildfile: /home/kub18/myapp/build.xml Trying to override old
> > definition of task javac Trying to override old definition of
> > datatype resources
> >
> > prepare:
> >
> > compile:
> >
> > install: [deploy] OK - Deployed application at context path
> > [/myapp]
> >
> > BUILD SUCCESSFUL Total time: 0 seconds
>
> Glad you got it working. If you think there are some changes to the
> documentation that would be helpful, any suggestions would be welcome.
>
> > with these changes  in tomcat-users.xml  > rolename="manager-gui"/>   > rolename="manager-jmx"/>   > rolename="admin-gui"/>   > username="admin" password="admin"
> > roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui
> ,admin-script"/>
>
> That's
> >
> all of the privileges, which may be considered more than
> necessary. Only the "manager-script" role should be necessary for the
> ant task.
>
> The manager-gui would be necessary to login to /manager and not just
> to use the services provided by /manager/text
>
> - -chris
>
> > On Thu, 19 Dec 2019 at 20:20, Zahid Rahman  > > wrote:
> >
> > I updated tomcat-users.xml  and I am able to login at
> > http://localhost:8080/manager with tomcat & s3cret but at the url
> > http://localhost:8080/manager/text
> >
> >
> > 403 Access Denied
> >
> > You are not authorized to view this page.
> >
> > By default the Manager is only accessible from a browser running
> > on the same machine as Tomcat. If you wish to modify this
> > restriction, you'll need to edit the Manager's context.xml file.
> >
> > If you have already configured the Manager application to allow
> > access and you have used your browsers back button, used a saved
> > book-mark or similar then you may have triggered the cross-site
> > request forgery (CSRF) protection that has been enabled for the
> > HTML interface of the Manager application. You will need to reset
> > this protection by returning to the main Manager page
> > . Once you return to this
> > page, you will be able to continue using the Manager application's
> > HTML interface normally. If you continue to see this access denied
> > message, check that you have the necessary permissions to access
> > this application.
> >
> > If you have not changed any configuration files, please examine
> > the file conf/tomcat-users.xml in your installation. That file
> > must contain the credentials to let you use this webapp.
> >
> > For example, to add the manager-gui role to a user named tomcat
> > with a password of s3cret, add the following to the config file
> > listed above.
> >
> >   > password="s3cret" roles="manager-gui"/>
> >
> > Note that for Tomcat 7 onwards, the roles required to use the
> > manager application were changed from the single manager role to
> > the following four roles. You will need to assign the role(s)
> > required for the functionality you wish to access.
> >
> > * manager-gui - allows access to the HTML GUI and the status pages
> > * manager-script - allows access to the text interface and the
> > status pages * manager-jmx - allows access to the JMX proxy and the
> > status pages * manager-status - allows access to the status pages
> > only
> >
> > The HTML interface is protected against CSRF but the text and JMX
> > interfaces are not. To maintain the CSRF protection:
> >
> > * Users with the manager-gui role should not be granted either the
> > manager-script or manager-jmx roles. * If the text or jmx
> > interfaces are accessed through a browser (e.g. for testing since
> > these interfaces are intended for tools not humans) then the
> > browser must be closed afterwards to terminate the session.
> >
> > For more information - please see 

Re: Exception while starting tomcat version 9.0.29

2019-12-20 Thread Kushagra Bindal
Thanks Olaf.. It worked..

On Fri, Dec 20, 2019 at 6:51 PM Olaf Kock  wrote:

>
> On 20.12.19 13:28, Kushagra Bindal wrote:
> > Hi,
> >
> > We are working on upgrading our tomcat version from 8.5.24 to 9.0.29. In
> > this process, while starting one of our services we found that while
> > starting catalina.out is having some exception.
> >
> > Note: This exception we are getting before start of tomcat.
> >
> > 20-Dec-2019 09:52:09.144 WARNING [main]
> > org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance
> > org.apache.catalina.UserDatabase is not a valid class name/type for this
> > JNDI factory.
> > 20-Dec-2019 09:52:09.145 SEVERE [main]
> > org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans
> > Unexpected error creating MBeans
> > java.lang.NullPointerException
> > at
> >
> org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:129)
> > at
> >
> org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
> > ...
> > 20-Dec-2019 09:52:09.148 SEVERE [main]
> > org.apache.catalina.realm.CombinedRealm.startInternal Failed to start
> > [org.apache.catalina.realm.UserDatabaseRealm] realm
> > org.apache.catalina.LifecycleException: No UserDatabase component
> > found under key [UserDatabase]
> > ...
> >
> > Below is the server.xml file details.
> >
> >
> >
> --
> >
> > ...
> >  >   type="org.apache.catalina.UserDatabase"
> >   description="User database that can be updated and saved"
> >   factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
> >
> url="jdbc:postgresql://<>:5444/<>?targetServerType=mastercurrentSchema=common"
> >   pathname="conf/tomcat-users.xml" />
> >   
> > ...
> >
> >
> Phew, that server.xml would have been so much more readable if you'd
> removed all the commented xml before posting.
>
> Anyway, I've shortened the log and server.xml in my quote to what I
> assume is the cause for the error message. The stock server.xml contains
> a MemoryUserDatabaseFactory, while it looks like your declaration is for
> a generic JDBC connection.
>
>type="org.apache.catalina.UserDatabase"
>   description="User database that can be updated and saved"
>   factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
>   pathname="conf/tomcat-users.xml" />
>
> From the top of my head I can't give you the right class name to use,
> but knowing this cause might put you on the right track.
>
> Olaf
>
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

-- 
Regards,
Kushagra Bindal
+91-9013792807


Re: ant install build.xml:372: java.net.ProtocolException: Server redirected too many times (20)

2019-12-20 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Zahid,

On 12/19/19 16:36, Zahid Rahman wrote:
> *SUCCESSS...*
> 
> Buildfile: /home/kub18/myapp/build.xml Trying to override old
> definition of task javac Trying to override old definition of
> datatype resources
> 
> prepare:
> 
> compile:
> 
> install: [deploy] OK - Deployed application at context path
> [/myapp]
> 
> BUILD SUCCESSFUL Total time: 0 seconds

Glad you got it working. If you think there are some changes to the
documentation that would be helpful, any suggestions would be welcome.

> with these changes  in tomcat-users.xml  rolename="manager-gui"/>   rolename="manager-jmx"/>   rolename="admin-gui"/>   username="admin" password="admin" 
> roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui
,admin-script"/>

That's
> 
all of the privileges, which may be considered more than
necessary. Only the "manager-script" role should be necessary for the
ant task.

The manager-gui would be necessary to login to /manager and not just
to use the services provided by /manager/text

- -chris

> On Thu, 19 Dec 2019 at 20:20, Zahid Rahman  > wrote:
> 
> I updated tomcat-users.xml  and I am able to login at 
> http://localhost:8080/manager with tomcat & s3cret but at the url
> http://localhost:8080/manager/text
> 
> 
> 403 Access Denied
> 
> You are not authorized to view this page.
> 
> By default the Manager is only accessible from a browser running
> on the same machine as Tomcat. If you wish to modify this
> restriction, you'll need to edit the Manager's context.xml file.
> 
> If you have already configured the Manager application to allow 
> access and you have used your browsers back button, used a saved 
> book-mark or similar then you may have triggered the cross-site 
> request forgery (CSRF) protection that has been enabled for the
> HTML interface of the Manager application. You will need to reset
> this protection by returning to the main Manager page 
> . Once you return to this
> page, you will be able to continue using the Manager application's
> HTML interface normally. If you continue to see this access denied 
> message, check that you have the necessary permissions to access 
> this application.
> 
> If you have not changed any configuration files, please examine
> the file conf/tomcat-users.xml in your installation. That file
> must contain the credentials to let you use this webapp.
> 
> For example, to add the manager-gui role to a user named tomcat
> with a password of s3cret, add the following to the config file
> listed above.
> 
>   password="s3cret" roles="manager-gui"/>
> 
> Note that for Tomcat 7 onwards, the roles required to use the 
> manager application were changed from the single manager role to
> the following four roles. You will need to assign the role(s)
> required for the functionality you wish to access.
> 
> * manager-gui - allows access to the HTML GUI and the status pages 
> * manager-script - allows access to the text interface and the 
> status pages * manager-jmx - allows access to the JMX proxy and the
> status pages * manager-status - allows access to the status pages
> only
> 
> The HTML interface is protected against CSRF but the text and JMX 
> interfaces are not. To maintain the CSRF protection:
> 
> * Users with the manager-gui role should not be granted either the 
> manager-script or manager-jmx roles. * If the text or jmx
> interfaces are accessed through a browser (e.g. for testing since
> these interfaces are intended for tools not humans) then the
> browser must be closed afterwards to terminate the session.
> 
> For more information - please see the Manager App How-To 
> .
> 
> 
> 
> On Thu, 19 Dec 2019 at 19:51, Christopher Schultz 
>  > wrote:
> 
> Zahid,
> 
> On 12/19/19 14:47, Zahid Rahman wrote:
>> CVS is working fine.
> 
> LOL okay
> 
>> build.properties # Context path to install this application on 
>> app.path=/myapp
> 
>> # Tomcat installation directory 
>> catalina.home=/home/kub18/apache-tomcat-9.0.30
> 
>> # Manager webapp username and password
> manager.username=myusername
>> manager.password=mypassword
> 
> Is your manager available at this URL:
> 
> http://localhost:8080/manager/text
> 
> ??
> 
> Try using your web browser to see if it works.
> 
> -chris
> 
>> On Thu, 19 Dec 2019 at 18:48, Christopher Schultz 
>>  
>>  >> wrote:
> 
>> Zahid,
> 
>> On 12/19/19 12:57, Zahid Rahman wrote:
>>> I'm religiously following  the instructions.
> 
>> :) Are you using CVS as your revision-control system?
> 
>> Someone brought that to our attention recently; that page is 
>> sorely out of date, unfortunately.
> 
>>> The build script is the template provided. I have  made only
>>> one change. Added one tag following  

Re: Exception while starting tomcat version 9.0.29

2019-12-20 Thread Olaf Kock


On 20.12.19 13:28, Kushagra Bindal wrote:
> Hi,
>
> We are working on upgrading our tomcat version from 8.5.24 to 9.0.29. In
> this process, while starting one of our services we found that while
> starting catalina.out is having some exception.
>
> Note: This exception we are getting before start of tomcat.
>
> 20-Dec-2019 09:52:09.144 WARNING [main]
> org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance
> org.apache.catalina.UserDatabase is not a valid class name/type for this
> JNDI factory.
> 20-Dec-2019 09:52:09.145 SEVERE [main]
> org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans
> Unexpected error creating MBeans
> java.lang.NullPointerException
> at
> org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:129)
> at
> org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
> ...
> 20-Dec-2019 09:52:09.148 SEVERE [main]
> org.apache.catalina.realm.CombinedRealm.startInternal Failed to start
> [org.apache.catalina.realm.UserDatabaseRealm] realm
> org.apache.catalina.LifecycleException: No UserDatabase component
> found under key [UserDatabase]
> ...
>
> Below is the server.xml file details.
>
>
> --
>
> ...
>type="org.apache.catalina.UserDatabase"
>   description="User database that can be updated and saved"
>   factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
>  
> url="jdbc:postgresql://<>:5444/<>?targetServerType=mastercurrentSchema=common"
>   pathname="conf/tomcat-users.xml" />
>   
> ...
>
>
Phew, that server.xml would have been so much more readable if you'd
removed all the commented xml before posting.

Anyway, I've shortened the log and server.xml in my quote to what I
assume is the cause for the error message. The stock server.xml contains
a MemoryUserDatabaseFactory, while it looks like your declaration is for
a generic JDBC connection.

    

>From the top of my head I can't give you the right class name to use,
but knowing this cause might put you on the right track.

Olaf




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



Exception while starting tomcat version 9.0.29

2019-12-20 Thread Kushagra Bindal
Hi,

We are working on upgrading our tomcat version from 8.5.24 to 9.0.29. In
this process, while starting one of our services we found that while
starting catalina.out is having some exception.

Note: This exception we are getting before start of tomcat.

20-Dec-2019 09:52:08.516 INFO [main]
org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based
Apache Tomcat Native library which allows optimal performance in production
environments was not found on the java.library.path:
[/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
20-Dec-2019 09:52:09.099 INFO [main]
org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler
["http-nio-8080"]
20-Dec-2019 09:52:09.125 INFO [main]
org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler
["ajp-nio-8009"]
20-Dec-2019 09:52:09.127 INFO [main]
org.apache.catalina.startup.Catalina.load Server initialization in [1,231]
milliseconds
20-Dec-2019 09:52:09.144 WARNING [main]
org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance
org.apache.catalina.UserDatabase is not a valid class name/type for this
JNDI factory.
20-Dec-2019 09:52:09.145 SEVERE [main]
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans
Unexpected error creating MBeans
java.lang.NullPointerException
at
org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:129)
at
org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
at
org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:34)
at
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:127)
at
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:101)
at
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:76)
at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at
org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
at
org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
at
org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:923)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at
org.apache.catalina.startup.Catalina.start(Catalina.java:633)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)
at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474)
20-Dec-2019 09:52:09.146 INFO [main]
org.apache.catalina.core.StandardService.startInternal Starting service
[Catalina]
20-Dec-2019 09:52:09.146 INFO [main]
org.apache.catalina.core.StandardEngine.startInternal Starting Servlet
engine: []
20-Dec-2019 09:52:09.148 SEVERE [main]
org.apache.catalina.realm.CombinedRealm.startInternal Failed to start
[org.apache.catalina.realm.UserDatabaseRealm] realm
org.apache.catalina.LifecycleException: No UserDatabase component
found under key [UserDatabase]
at
org.apache.catalina.realm.UserDatabaseRealm.startInternal(UserDatabaseRealm.java:215)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at
org.apache.catalina.realm.CombinedRealm.startInternal(CombinedRealm.java:245)
at
org.apache.catalina.realm.LockOutRealm.startInternal(LockOutRealm.java:115)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902)
at
org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at
org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at
org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at
org.apache.catalina.startup.Catalina.start(Catalina.java:633)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at