Projects tigase _server server-core Issues #955
Improve error message shown when specified data source is not available (#955)
Andrzej Wójcik (Tigase) opened 7 years ago

When we specify that repository should use data source which is not available (or not configured), there is an error being thrown which does not mention that data source is missing. Instead it suggests that bean was not initialized due to unknown error.

=====================
Could not initialize bean repository (class: class
tigase.update.db.UpdateStatsSDRepoBean), skipping injection of this bean
RootCause:
  -> tigase.kernel.KernelException: Unknown bean 'instance'.
     [tigase.kernel.core.Kernel.getInstance(Kernel.java:301)]
=====================


2018-06-13 16:23:59.348 [qtp993343057-57]  Kernel.injectDependencies()
         CONFIG:   Could not initialize bean repository (class: class
tigase.update.db.UpdateStatsSDRepoBean), skipping injection of this bean
tigase.kernel.KernelException: Unknown bean 'instance'.
       at tigase.kernel.core.Kernel.getInstance(Kernel.java:301)
       at
tigase.db.beans.SDRepositoryBean.initialize(SDRepositoryBean.java:119)
       at tigase.kernel.core.Kernel.initBean(Kernel.java:139)
       at tigase.kernel.core.Kernel.injectDependencies(Kernel.java:1213)
       at tigase.kernel.core.Kernel.injectDependency(Kernel.java:821)
       at
tigase.kernel.core.Kernel$DelayedDependenciesInjection.inject(Kernel.java:1489)
       at
tigase.kernel.core.Kernel.finishDependecyDelayedInjection(Kernel.java:537)
       at tigase.kernel.core.Kernel.initBean(Kernel.java:131)
       at tigase.kernel.core.Kernel.getInstance(Kernel.java:938)
       at tigase.kernel.core.Kernel.getInstance(Kernel.java:274)
       at tigase.kernel.core.Kernel$getInstance$0.call(Unknown Source)
       at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
       at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
       at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
       at
tigase.http.modules.rest.HandlersLoader.loadHandler(HandlersLoader.groovy:48)
       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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
       at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
       at
org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:384)
       at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
       at
org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
       at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:182)
       at
tigase.http.modules.rest.HandlersLoader$_loadHandlers_closure1.doCall(HandlersLoader.groovy:64)
       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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
       at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)

It would be better to inform a user about missing data source and name of the data source which cannot be found.

Andrzej Wójcik (Tigase) commented 7 years ago

Issue originally reported by %wojtek by email.

Andrzej Wójcik (Tigase) commented 7 years ago

I've improved error being reported. Now you will have something like this:

=====================
Could not initialize bean default (class: class tigase.pubsub.repository.PubSubDAOPool$PubSubDAOConfigBean), skipping injection of this bean
RootCause:
   -> java.lang.RuntimeException: There is no data source named 'test2'
      [tigase.db.beans.MDRepositoryBean$MDRepositoryConfigBean.initialize(MDRepositoryBean.java:337)]
=====================

and from that it is clear that there is a data source named test2 which is missing and it was used in the configuration of the PubSubDAO.

issue 1 of 1
Type
Task
Priority
Normal
Assignee
RedmineID
7743
Version
tigase-server-8.0.0
Spent time
12h 30m
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#955
Please wait...
Page is in error, reload to recover