Project

General

Profile

jwt-planner example

Added by Olaf van der Meer over 5 years ago

Hi,

I am discovering the jwt examples and cannot get the jwt-planner example running.

I get this error on the servers console when accessing the page in the browser:

java.lang.NoClassDefFoundError: com/google/gson/JsonParseException
    at eu.webtoolkit.jwt.WPaintedWidget.<init>(WPaintedWidget.java:158)
    at eu.webtoolkit.jwt.examples.planner.captcha.ShapesWidget.<init>(ShapesWidget.java:49)
    at eu.webtoolkit.jwt.examples.planner.captcha.ShapesCaptchaWidget.<init>(ShapesCaptchaWidget.java:33)
    at eu.webtoolkit.jwt.examples.planner.LoginWidget.<init>(LoginWidget.java:61)
    at eu.webtoolkit.jwt.examples.planner.PlannerApplication.<init>(PlannerApplication.java:55)
    at eu.webtoolkit.jwt.examples.planner.PlannerMain.createApplication(PlannerMain.java:14)
    at eu.webtoolkit.jwt.WtServlet.doCreateApplication(WtServlet.java:307)
    at eu.webtoolkit.jwt.WebSession.start(WebSession.java:2276)
    at eu.webtoolkit.jwt.WebSession.handleRequest(WebSession.java:1606)
    at eu.webtoolkit.jwt.WtServlet.doHandleRequest(WtServlet.java:377)
    at eu.webtoolkit.jwt.ServletApi.handleRequest(ServletApi.java:27)
    at eu.webtoolkit.jwt.ServletApi3.doHandleRequest(ServletApi3.java:155)
    at eu.webtoolkit.jwt.WtServlet.handleRequest(WtServlet.java:264)
    at eu.webtoolkit.jwt.WtServlet.doGet(WtServlet.java:272)
    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:852)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
    at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:206)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.Server.handle(Server.java:530)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
    at java.lang.Thread.run(Thread.java:748)
Caused by: 
java.lang.ClassNotFoundException: com.google.gson.JsonParseException
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:503)
    at runjettyrun.ProjectClassLoader.loadClass(ProjectClassLoader.java:92)
    at eu.webtoolkit.jwt.WPaintedWidget.<init>(WPaintedWidget.java:158)
    at eu.webtoolkit.jwt.examples.planner.captcha.ShapesWidget.<init>(ShapesWidget.java:49)
    at eu.webtoolkit.jwt.examples.planner.captcha.ShapesCaptchaWidget.<init>(ShapesCaptchaWidget.java:33)
    at eu.webtoolkit.jwt.examples.planner.LoginWidget.<init>(LoginWidget.java:61)
    at eu.webtoolkit.jwt.examples.planner.PlannerApplication.<init>(PlannerApplication.java:55)
    at eu.webtoolkit.jwt.examples.planner.PlannerMain.createApplication(PlannerMain.java:14)
    at eu.webtoolkit.jwt.WtServlet.doCreateApplication(WtServlet.java:307)
    at eu.webtoolkit.jwt.WebSession.start(WebSession.java:2276)
    at eu.webtoolkit.jwt.WebSession.handleRequest(WebSession.java:1606)
    at eu.webtoolkit.jwt.WtServlet.doHandleRequest(WtServlet.java:377)
    at eu.webtoolkit.jwt.ServletApi.handleRequest(ServletApi.java:27)
    at eu.webtoolkit.jwt.ServletApi3.doHandleRequest(ServletApi3.java:155)
    at eu.webtoolkit.jwt.WtServlet.handleRequest(WtServlet.java:264)
    at eu.webtoolkit.jwt.WtServlet.doGet(WtServlet.java:272)
    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:852)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
    at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:206)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.Server.handle(Server.java:530)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
    at java.lang.Thread.run(Thread.java:748)
Suppressed: 
    |java.lang.ClassNotFoundException: com.google.gson.JsonParseException
    |   at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    |   at org.eclipse.jetty.webapp.WebAppClassLoader.findClass(WebAppClassLoader.java:636)
    |   at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:527)
    |   at runjettyrun.ProjectClassLoader.loadClass(ProjectClassLoader.java:92)
    |   at eu.webtoolkit.jwt.WPaintedWidget.<init>(WPaintedWidget.java:158)
    |   at eu.webtoolkit.jwt.examples.planner.captcha.ShapesWidget.<init>(ShapesWidget.java:49)
    |   at eu.webtoolkit.jwt.examples.planner.captcha.ShapesCaptchaWidget.<init>(ShapesCaptchaWidget.java:33)
    |   at eu.webtoolkit.jwt.examples.planner.LoginWidget.<init>(LoginWidget.java:61)
    |   at eu.webtoolkit.jwt.examples.planner.PlannerApplication.<init>(PlannerApplication.java:55)
    |   at eu.webtoolkit.jwt.examples.planner.PlannerMain.createApplication(PlannerMain.java:14)
    |   at eu.webtoolkit.jwt.WtServlet.doCreateApplication(WtServlet.java:307)
    |   at eu.webtoolkit.jwt.WebSession.start(WebSession.java:2276)
    |   at eu.webtoolkit.jwt.WebSession.handleRequest(WebSession.java:1606)
    |   at eu.webtoolkit.jwt.WtServlet.doHandleRequest(WtServlet.java:377)
    |   at eu.webtoolkit.jwt.ServletApi.handleRequest(ServletApi.java:27)
    |   at eu.webtoolkit.jwt.ServletApi3.doHandleRequest(ServletApi3.java:155)
    |   at eu.webtoolkit.jwt.WtServlet.handleRequest(WtServlet.java:264)
    |   at eu.webtoolkit.jwt.WtServlet.doGet(WtServlet.java:272)
    |   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:852)
    |   at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
    |   at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:206)
    |   at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
    |   at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
    |   at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    |   at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
    |   at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    |   at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
    |   at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
    |   at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
    |   at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
    |   at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
    |   at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
    |   at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
    |   at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
    |   at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
    |   at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    |   at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    |   at org.eclipse.jetty.server.Server.handle(Server.java:530)
    |   at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347)
    |   at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256)
    |   at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
    |   at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
    |   at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
    |   at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
    |   at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
    |   at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
    |   at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382)
    |   at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
    |   at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
    |   at java.lang.Thread.run(Thread.java:748)

In the README.md is written: In order to use it, you will need to setup a postgresql database.

I don't know how to do that. Can you provide me some more info how to do that and where should the database be located?

Thanks.


Replies (3)

RE: jwt-planner example - Added by Olaf van der Meer over 5 years ago

I already tried to add gson to the build.xml

it was:

  <target name="build">
    <ant dir="${jwt.dir}" target="all" inheritAll="false"/>

    <mkdir dir="${jwt-lib.dir}"/>
    <copy todir="${jwt-lib.dir}">
      <fileset dir="${jwt.dir}/dist" />
      <fileset dir="${jwt.dir}/lib" 
           includes="*.jar servlet-api/*.jar"/>
    </copy>

I copied gson/*jar from the jwt-charts/build.xml and add it like this:

  <target name="build">
    <ant dir="${jwt.dir}" target="all" inheritAll="false"/>

    <mkdir dir="${jwt-lib.dir}"/>
    <copy todir="${jwt-lib.dir}">
      <fileset dir="${jwt.dir}/dist" />
      <fileset dir="${jwt.dir}/lib" 
           includes="*.jar servlet-api/*.jar gson/*.jar"/>
    </copy>

RE: jwt-planner example - Added by Olaf van der Meer over 5 years ago

Hi,

I am getting a bit further now. I have copied the gson2-0.jar to the WEB-INF/lib manually and start the webserver using Run-Jetty-run.

Now I get a login screen. After trying to login an error occurs about unable to connect to the postgresql database. It is logical, beacause I did not settup it yet.

I have tried to install a postgresql database server to setup the database, but I can't on my Windows 10.

https://www.enterprisedb.com/services-support/edb-supported-products-and-platforms

Is there another way to archeive this?

Thanks.

RE: jwt-planner example - Added by Wim Dumon over 5 years ago

Hello,

Postgres does run on windows, and you can download it from here:

https://www.postgresql.org/

Wim.

    (1-3/3)