在AjaxEventBehavior上调用时,Wicket JDBC dao NotSerializableException单击

时间:2015-08-15 00:55:28

标签: java wicket serializable

所以我在点击时写入数据库时​​出现问题。点击:我正在调用API,抓取数据,并写入数据库表。

我收到NotSerializableException异常,我相信这是因为我在点击中调用dao:

        proImage.add(new AjaxEventBehavior("click") {

                private static final long serialVersionUID = 1L;

                @Override
                protected void onEvent(AjaxRequestTarget target) {
                    try {
                         updateGamesPlayed(player.getSummonerId());

                    } catch (RiotApiException e) {
                        e.printStackTrace();
                    }
                }
            });

我的DAO应该可序列化吗?我以前遇到过这样的问题,但实际上并没有找到任何遗漏的东西" Serializable"。

这是堆栈跟踪:

20:42:08.639 [qtp17407842-12] ERROR org.apache.wicket.serialize.java.JavaSerializer - Error serializing object class com.riot.itemsets.HomePage [object=[Page class = com.riot.itemsets.HomePage, id = 0, render count = 1]]
org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream$ObjectCheckException: The object type is not Serializable!
A problem occurred while checking object with type: com.riot.itemsets.dao.ProGamesDaoJdbc
Field hierarchy is:
  0 [class=com.riot.itemsets.HomePage, path=0]
    private java.lang.Object org.apache.wicket.MarkupContainer.children [class=org.apache.wicket.MarkupContainer$ChildList]
      private java.lang.Object[] org.apache.wicket.MarkupContainer$ChildList.childs [class=[Ljava.lang.Object;]
        private java.lang.Object[] org.apache.wicket.MarkupContainer$ChildList.childs[0] [class=com.riot.itemsets.RegionPanel, path=0:regionPanel0]
          private java.lang.Object org.apache.wicket.MarkupContainer.children [class=org.apache.wicket.MarkupContainer$ChildList]
            private java.lang.Object[] org.apache.wicket.MarkupContainer$ChildList.childs [class=[Ljava.lang.Object;]
              private java.lang.Object[] org.apache.wicket.MarkupContainer$ChildList.childs[0][1] [class=com.riot.itemsets.TeamPanel, path=0:regionPanel0:teamPanel0]
                private java.lang.Object org.apache.wicket.MarkupContainer.children [class=org.apache.wicket.MarkupContainer$ChildList]
                  private java.lang.Object[] org.apache.wicket.MarkupContainer$ChildList.childs [class=[Ljava.lang.Object;]
                    private java.lang.Object[] org.apache.wicket.MarkupContainer$ChildList.childs[0][1] [class=com.riot.itemsets.PlayerPanel, path=0:regionPanel0:teamPanel0:playerPanel0]
                      private com.riot.itemsets.dao.ProGamesDaoJdbc com.riot.itemsets.PlayerPanel.proGamesDao [class=com.riot.itemsets.dao.ProGamesDaoJdbc] <----- field that is causing the problem
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.internalCheck(CheckingObjectOutputStream.java:364) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.check(CheckingObjectOutputStream.java:343) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.checkFields(CheckingObjectOutputStream.java:606) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.internalCheck(CheckingObjectOutputStream.java:542) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.check(CheckingObjectOutputStream.java:343) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.internalCheck(CheckingObjectOutputStream.java:405) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.check(CheckingObjectOutputStream.java:343) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.checkFields(CheckingObjectOutputStream.java:606) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.internalCheck(CheckingObjectOutputStream.java:542) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.check(CheckingObjectOutputStream.java:343) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.checkFields(CheckingObjectOutputStream.java:606) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.internalCheck(CheckingObjectOutputStream.java:542) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.check(CheckingObjectOutputStream.java:343) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.internalCheck(CheckingObjectOutputStream.java:405) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.check(CheckingObjectOutputStream.java:343) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.checkFields(CheckingObjectOutputStream.java:606) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.internalCheck(CheckingObjectOutputStream.java:542) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.check(CheckingObjectOutputStream.java:343) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.checkFields(CheckingObjectOutputStream.java:606) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.internalCheck(CheckingObjectOutputStream.java:542) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.check(CheckingObjectOutputStream.java:343) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.internalCheck(CheckingObjectOutputStream.java:405) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.check(CheckingObjectOutputStream.java:343) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.checkFields(CheckingObjectOutputStream.java:606) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.internalCheck(CheckingObjectOutputStream.java:542) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.check(CheckingObjectOutputStream.java:343) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.checkFields(CheckingObjectOutputStream.java:606) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.internalCheck(CheckingObjectOutputStream.java:542) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.check(CheckingObjectOutputStream.java:343) ~[wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream.writeObjectOverride(CheckingObjectOutputStream.java:674) ~[wicket-core-7.0.0.jar:7.0.0]
    at java.io.ObjectOutputStream.writeObject(Unknown Source) ~[?:1.8.0_25]
    at org.apache.wicket.serialize.java.JavaSerializer$SerializationCheckerObjectOutputStream.writeObjectOverride(JavaSerializer.java:271) ~[wicket-core-7.0.0.jar:7.0.0]
    at java.io.ObjectOutputStream.writeObject(Unknown Source) ~[?:1.8.0_25]
    at org.apache.wicket.serialize.java.JavaSerializer.serialize(JavaSerializer.java:78) [wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.pageStore.AbstractPageStore.serializePage(AbstractPageStore.java:133) [wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.pageStore.DefaultPageStore.createSerializedPage(DefaultPageStore.java:281) [wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.pageStore.DefaultPageStore.storePage(DefaultPageStore.java:61) [wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.page.PageStoreManager$PersistentRequestAdapter.storeTouchedPages(PageStoreManager.java:403) [wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.page.RequestAdapter.commitRequest(RequestAdapter.java:193) [wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.page.AbstractPageManager.commitRequest(AbstractPageManager.java:76) [wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.page.PageManagerDecorator.commitRequest(PageManagerDecorator.java:74) [wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.page.PageAccessSynchronizer$2.commitRequest(PageAccessSynchronizer.java:270) [wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.Application$3.onDetach(Application.java:1755) [wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.request.cycle.RequestCycleListenerCollection$3.notify(RequestCycleListenerCollection.java:105) [wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.request.cycle.RequestCycleListenerCollection$3.notify(RequestCycleListenerCollection.java:101) [wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.util.listener.ListenerCollection$1.notify(ListenerCollection.java:120) [wicket-util-7.0.0.jar:7.0.0]
    at org.apache.wicket.util.listener.ListenerCollection.reversedNotify(ListenerCollection.java:144) [wicket-util-7.0.0.jar:7.0.0]
    at org.apache.wicket.util.listener.ListenerCollection.reversedNotifyIgnoringExceptions(ListenerCollection.java:113) [wicket-util-7.0.0.jar:7.0.0]
    at org.apache.wicket.request.cycle.RequestCycleListenerCollection.onDetach(RequestCycleListenerCollection.java:100) [wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.request.cycle.RequestCycle.onDetach(RequestCycle.java:645) [wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.request.cycle.RequestCycle.detach(RequestCycle.java:594) [wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:297) [wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261) [wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:203) [wicket-core-7.0.0.jar:7.0.0]
    at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:284) [wicket-core-7.0.0.jar:7.0.0]
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) [org.eclipse.jetty.servlet_9.2.9.v20150224.jar:9.2.9.v20150224]
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) [org.eclipse.jetty.servlet_9.2.9.v20150224.jar:9.2.9.v20150224]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [org.eclipse.jetty.server_9.2.9.v20150224.jar:9.2.9.v20150224]
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) [org.eclipse.jetty.security_9.2.9.v20150224.jar:9.2.9.v20150224]
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) [org.eclipse.jetty.server_9.2.9.v20150224.jar:9.2.9.v20150224]
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) [org.eclipse.jetty.server_9.2.9.v20150224.jar:9.2.9.v20150224]
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) [org.eclipse.jetty.servlet_9.2.9.v20150224.jar:9.2.9.v20150224]
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [org.eclipse.jetty.server_9.2.9.v20150224.jar:9.2.9.v20150224]
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) [org.eclipse.jetty.server_9.2.9.v20150224.jar:9.2.9.v20150224]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [org.eclipse.jetty.server_9.2.9.v20150224.jar:9.2.9.v20150224]
    at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52) [org.eclipse.jetty.server_9.2.9.v20150224.jar:9.2.9.v20150224]
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [org.eclipse.jetty.server_9.2.9.v20150224.jar:9.2.9.v20150224]
    at org.eclipse.jetty.server.Server.handle(Server.java:497) [org.eclipse.jetty.server_9.2.9.v20150224.jar:9.2.9.v20150224]
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) [org.eclipse.jetty.server_9.2.9.v20150224.jar:9.2.9.v20150224]
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) [org.eclipse.jetty.server_9.2.9.v20150224.jar:9.2.9.v20150224]
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) [org.eclipse.jetty.io_9.2.9.v20150224.jar:9.2.9.v20150224]
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) [org.eclipse.jetty.util_9.2.9.v20150224.jar:9.2.9.v20150224]
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) [org.eclipse.jetty.util_9.2.9.v20150224.jar:9.2.9.v20150224]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_25]
Caused by: java.io.NotSerializableException: com.riot.itemsets.dao.ProGamesDaoJdbc
    at java.io.ObjectOutputStream.writeObject0(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeSerialData(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeObject0(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeArray(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeObject0(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeSerialData(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeObject0(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeSerialData(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeObject0(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeArray(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeObject0(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeSerialData(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeObject0(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeSerialData(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeObject0(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeArray(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeObject0(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeSerialData(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeObject0(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeSerialData(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeObject0(Unknown Source) ~[?:1.8.0_25]
    at java.io.ObjectOutputStream.writeObject(Unknown Source) ~[?:1.8.0_25]
    at org.apache.wicket.serialize.java.JavaSerializer$SerializationCheckerObjectOutputStream.writeObjectOverride(JavaSerializer.java:260) ~[wicket-core-7.0.0.jar:7.0.0]
    ... 42 more

这是DAO的开头:

public class ProGamesDaoJdbc implements ProGamesDao{

private JdbcTemplate jdbcTemplateObject;

  private class GamesMapper implements RowMapper<Games>{

      @Override
      public Games mapRow(ResultSet rs, int rowNum) throws SQLException {
        Games game = new Games();
        game.setGameId(rs.getLong("gameid"));
        game.setWinner((rs.getInt("winner") == 1));
        game.setLane(rs.getString("lane"));
        game.setItem0(rs.getString("item0"));
        game.setItem1(rs.getString("item1"));
        game.setItem2(rs.getString("item2"));
        game.setItem3(rs.getString("item3"));
        game.setItem4(rs.getString("item4"));
        game.setItem5(rs.getString("item5"));
        game.setItem6(rs.getString("item6"));
        game.setGoldSpent(rs.getLong("goldspent"));
        game.setChampId(rs.getInt("champid"));
        game.setChampName(rs.getString("champname"));
        game.setChampImage(rs.getString("champimage"));
        game.setEnemyChampId(rs.getInt("enemychampid"));
        game.setEnemyChampName(rs.getString("enemychampname"));
        game.setEnemyChampImage(rs.getString("enemychampimage"));
        game.setSummonerId(rs.getLong("summonerid"));
        return game;
      } 
  }

  @Override
  public void setDataSource(DataSource dataSource) {
        this.jdbcTemplateObject = new JdbcTemplate(dataSource);
  }


  @Override
  public void create(Games game) {
      ...
      ...
  }
  ....
  ....
  ....
}

0 个答案:

没有答案