yacy / yacy_search_server

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
http://yacy.net
Other
3.38k stars 425 forks source link

javax.servlet.ServletException: /usr/share/java/yacy/htroot/ConfigBasic.html #544

Closed 0xFEEDC0DE64 closed 10 months ago

0xFEEDC0DE64 commented 1 year ago

I just compiled yacy using the archlinux AUR, and I get an exception when I click at the top bar to get into the administration:

http://localhost:8090/ConfigBasic.html

Ops!

Message: /usr/share/java/yacy/htroot/ConfigBasic.html
javax.servlet.ServletException: /usr/share/java/yacy/htroot/ConfigBasic.html
    at net.yacy.http.servlets.YaCyDefaultServlet.handleTemplate(YaCyDefaultServlet.java:886)
    at net.yacy.http.servlets.YaCyDefaultServlet.doGet(YaCyDefaultServlet.java:307)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:550)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:763)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1435)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1350)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:234)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at net.yacy.http.CrashProtectionHandler.handle(CrashProtectionHandler.java:33)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at org.eclipse.jetty.server.Server.handle(Server.java:516)
    at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388)
    at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
    at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:383)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:882)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1036)
    at java.base/java.lang.Thread.run(Thread.java:1589)

Is this somehow expected or did I do somthing wrong during compiling?

Orbiter commented 1 year ago

no this is not expected. There must be something terribly wrong. This is where servlets are executed and I cannot remember that this ever happened...

How did you compile YaCy? Please provide some context.

0xFEEDC0DE64 commented 1 year ago

https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=yacy-git#n30

the source code is cloned directly from github and compiled with ant clean all dist

0xFEEDC0DE64 commented 1 year ago

I get these exceptions on a lot of pages, but some pages work, so its not completely broken.

What is the exact exception here? do java exceptions have some message text or anything to display? Just showing the failed template is too little info for me to debug this any further.

smokingwheels commented 1 year ago

@0xFEEDC0DE64 Try setting the admin password first. yacy/bin/passwd.sh I had this on new clone with remote install today. The default first time you go to admin you must configure yacy's mode to operate in. Not sure if it is why localhost is giving that error.

exprez135 commented 1 year ago

Just want to add in—this also happened to me today, after building myself. Setting the admin password via bin/passwd.sh did work, but I would expect the default to be allowing access via localhost without this (and in the past, that was my experience).

okybaca commented 1 year ago

This is a long-persisting issue, mentioned also in #409, #427, #483 and in the forum.

Happens with latest version built out from github as well.

Heavily discouraging for new users. Admin password is described as optional in the docs. Creation of password is not enforced. Definitely, the first try to access Administration cannot end up in a exception.

Either the passwordless login should be disabled at all and error message with the instructions to set up the password should be printed, or the ConfigBasic should be accessible without it and without exception.

smokingwheels commented 1 year ago

I had it twice when I cloned recently. You have to set Yacy's mode 1 of 3 before the config page goes away.

I used a Terminal Browser called links2 to set configuration. I did try another but it did not work.

sudo apt install links2 links2 http://localhost:8090

dchmelik commented 10 months ago

I have same problem with yacy_v1.924_20210209_10069.tar.gz. Isn't there a new normally-numbered stable version not more than two years old?

okybaca commented 10 months ago

Unfortunately not. I made an unofficial release of my fork at version 1.926. There should be a fresh-built current development release at https://release.yacy.net. Both of them are unix versions only, afaik.

Orbiter commented 10 months ago

I tried to reconstruct the bug but failed to do so. I also inspected the code and found that only a mysterious misalignment (Switchboard not initialized at the time of the servlet call) could cause this. To be able to fix this I first must find out how to experience the same failure. Can you please give me detailed instructions on how to get to this bug situation?

okybaca commented 10 months ago
  1. fresh build out of guthub (unix)
  2. first run using startYACY.sh with no password set
  3. after browsing to ip address of the instance and clicking the 'administration' button, admin interface is shown for a second, then error is printed out in the browser: " Ops!

Message: /usr/home/yacy/yacy/htroot/ConfigBasic.html javax.servlet.ServletException: /usr/home/yacy/yacy/htroot/ConfigBasic.html at net.yacy.http.servlets.YaCyDefaultServlet.handleTemplate(YaCyDefaultServlet.java:886) at net.yacy.http.servlets.YaCyDefaultServlet.doGet(YaCyDefaultServlet.java:307) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:554) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:772) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:571) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:234) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) at net.yacy.http.CrashProtectionHandler.handle(CrashProtectionHandler.java:33) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) at org.eclipse.jetty.server.Server.handle(Server.java:516) at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487) at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) at java.base/java.lang.Thread.run(Thread.java:829) "

In the log, error recorded: " ConcurrentLog * java.lang.reflect.InvocationTargetException java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at net.yacy.http.servlets.YaCyDefaultServlet.invokeServlet(YaCyDefaultServlet.java:663) at net.yacy.http.servlets.YaCyDefaultServlet.handleTemplate(YaCyDefaultServlet.java:857) at net.yacy.http.servlets.YaCyDefaultServlet.doGet(YaCyDefaultServlet.java:307) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:554) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:772) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:571) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:234) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) at org.eclipse.jetty.server.Server.handle(Server.java:516) at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487) at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: java.lang.IllegalArgumentException: User is not authenticated at net.yacy.data.TransactionManager.getTransactionToken(TransactionManager.java:137) at net.yacy.data.TransactionManager.getTransactionToken(TransactionManager.java:115) at net.yacy.htroot.ConfigBasic.respond(ConfigBasic.java:80) ... 40 more "

Reported in the forum in recent days, as well. So I suppose, it's a behavior of default instalation. Documentation provides no working clue how to set the password, as described in #602.

Orbiter commented 10 months ago

I guess this is done on a headless remote server, not localhost?

okybaca commented 10 months ago

Oh, for me, yes, definitely.

Orbiter commented 10 months ago

ok so far I was able to reconstruct the error. The fix above is not a complete solution, just a first step. It resolves the "ups" Exception but it does not lead to a proper usage situation:

Working on that now..

okybaca commented 10 months ago

great, orbiter! maybe the prompt for the password could be advised or included in 'use case and account'? or a big red message in system status, if the password is default? otherwise i can imagine a lot of new instances would have 'yacy' password and evil robots would quickly learn that...

Orbiter commented 10 months ago

yes, well with https://github.com/yacy/yacy_search_server/commit/dc6f218520bc158cacece6887aba2b766260dc20 the default password is now actually set to "yacy", I believed I already made this the default but it wasn't.

That resolves the second bullet point from the short list above. The first bullet point is caused by the missing transaction token, which is now not created due to the fix 544. I must re-think if those transaction tokens actually make sense. They had been introduced in https://github.com/yacy/yacy_search_server/commit/cde237b68763c542da20038e5f62bea341ae1d37

About

maybe the prompt for the password could be advised or included in 'use case and account'? or a big red message in system status, if the password is default?

You mean a warning message, yes could be done.

otherwise i can imagine a lot of new instances would have 'yacy' password and evil robots would quickly learn that...

Well yes, but this is the same problem that every other server application has. Lets go with the warning message.

Orbiter commented 10 months ago

Ok, now with commits https://github.com/yacy/yacy_search_server/commit/4da320bebfca4412a17cd7587ae1c16780ff210b https://github.com/yacy/yacy_search_server/commit/2c60ff14bb275580aa94119e898b7df7ae023356 and https://github.com/yacy/yacy_search_server/commit/4308aa5415c0c2aadbada8ac083c71cfb0001d1b I believe to have the issue with the default password fixed. It was a bit complex, because I had also to remove the concept of no-password-is-default-password.

I also included the "big red message".

okybaca commented 10 months ago

Great, @Orbiter, thanks for solving! Tested and everything works as intended! Another nasty bug solved, hooray!