09

IntramartDialectAutoSelector が NullPointerException

だいたいこんなような例外が出る

java.lang.NullPointerException
    at jp.co.intra_mart.mirage.ext.dialect.IntramartDialectAutoSelector.getDialect(IntramartDialectAutoSelector.java:25)
    at jp.co.intra_mart.mirage.ext.dialect.IntramartDialectAutoSelector.getTenantDatabaseDialect(IntramartDialectAutoSelector.java:13)
    at jp.co.intra_mart.mirage.ext.session.IntramartDatabaseManagerSession.getTenantDatabaseSqlManager(IntramartDatabaseManagerSession.java:173)
    at jp.co.intra_mart.mirage.ext.dao.DAOFactory.getTenantDatabaseDAO(DAOFactory.java:96)
    at jp.co.intra_mart.system.service.provider.updater.TenantSetupInformationDelegateImpl.getTenantImUpdateSchemaDAO(TenantSetupInformationDelegateImpl.java:586)
    at jp.co.intra_mart.system.service.provider.updater.TenantSetupInformationDelegateImpl.existTable(TenantSetupInformationDelegateImpl.java:454)
    at jp.co.intra_mart.system.service.provider.updater.TenantSetupInformationDelegateImpl.getUpdatedSchemaVersion(TenantSetupInformationDelegateImpl.java:598)
    at jp.co.intra_mart.system.service.provider.updater.TenantSetupInformationDelegateImpl.getDeployedSchemaVersion(TenantSetupInformationDelegateImpl.java:488)
    at jp.co.intra_mart.system.service.provider.updater.TenantSetupInformationDelegateImpl.completedSetup(TenantSetupInformationDelegateImpl.java:445)
    at jp.co.intra_mart.system.service.provider.updater.TenantSetupInformationDelegateImpl.needSetup(TenantSetupInformationDelegateImpl.java:364)
    at jp.co.intra_mart.system.service.provider.updater.TenantSetupInformation.needSetup(TenantSetupInformation.java:76)
    at jp.co.intra_mart.system.authz.context.impl.StandardAuthzSubjectContextBuilder.needSetup(StandardAuthzSubjectContextBuilder.java:158)
    at jp.co.intra_mart.system.authz.context.impl.StandardAuthzSubjectContextBuilder.build(StandardAuthzSubjectContextBuilder.java:45)
    at jp.co.intra_mart.system.context.impl.command.LifecycleBeginOperation.buildContext(LifecycleBeginOperation.java:96)
    at jp.co.intra_mart.system.context.impl.command.LifecycleBeginOperation.execute(LifecycleBeginOperation.java:64)
    at jp.co.intra_mart.system.context.impl.LifecycleImpl.begin(LifecycleImpl.java:82)
    at jp.co.intra_mart.system.context.web.impl.ContextFilter.doContextFilter(ContextFilter.java:114)
    at jp.co.intra_mart.system.context.web.impl.PreContextFilterChain.doFilter(PreContextFilterChain.java:47)
    at jp.co.intra_mart.system.context.web.impl.ContextFilter.doFilter(ContextFilter.java:78)
    at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89)
    at jp.co.intra_mart.foundation.security.filter.ResponseCharacterEncodingFilter.doFilter(ResponseCharacterEncodingFilter.java:90)
    at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89)
    at jp.co.intra_mart.foundation.security.filter.RequestCharacterEncodingFilter.doFilter(RequestCharacterEncodingFilter.java:47)
    at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89)
    at org.seasar.framework.container.filter.S2ContainerFilter.doFilter(S2ContainerFilter.java:79)
    at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89)
    at org.seasar.framework.container.hotdeploy.HotdeployFilter.doHotdeployFilter(HotdeployFilter.java:99)
    at org.seasar.framework.container.hotdeploy.HotdeployFilter.doFilter(HotdeployFilter.java:67)
    at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89)
    at com.caucho.server.httpcache.ProxyCacheFilterChain.doRequestCacheable(ProxyCacheFilterChain.java:252)
    at com.caucho.server.httpcache.ProxyCacheFilterChain.doFilter(ProxyCacheFilterChain.java:193)
    at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156)
    at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:289)
    at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:838)
    at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:1349)
    at com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:1305)
    at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:1289)
    at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:1197)
    at com.caucho.network.listen.TcpSocketLink.handleAcceptTaskImpl(TcpSocketLink.java:993)
    at com.caucho.network.listen.ConnectionTask.runThread(ConnectionTask.java:117)
    at com.caucho.network.listen.ConnectionTask.run(ConnectionTask.java:93)
    at com.caucho.network.listen.SocketLinkThreadLauncher.handleTasks(SocketLinkThreadLauncher.java:169)
    at com.caucho.network.listen.TcpSocketAcceptThread.run(TcpSocketAcceptThread.java:61)
    at com.caucho.env.thread2.ResinThread2.runTasks(ResinThread2.java:173)
    at com.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118)

多分 data-source-mapping-config.xml に定義されているデータソースに指定したtenant-idが実際使おうとしているテナントのIDと一致していない。

設定の誤りだけど、テナントIDがdefault以外でかつ、データベースやらストレージの情報を使いまわしているような状況でWarだけ入れ替えたとかいうときに起こりそう。