-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initialisation error #6
Comments
Similar issue for me: java.lang.ExceptionInInitializerError:
|
It's not a swagger issue: |
Check your application.conf |
Hello actually it is, if you look to my stacktrace it is not "triggered" by Ebean or any other exception. This happens in the PlayApiScanner. |
@pycloux in your case it's not a full stacktrace, also Play 2.4 is using dependency injection and in such case any error in initialization will put swagger on top of stacktrace. |
I think I found the error. I suspect that the root error of @szuzul is actually the same. |
So here is the conclusion (which explains the error from @szuzul). So the solution would pobably be either to:
Here is what I have done with your code (I included it into my application to modify it): controllers.collect {
case className: String if {
try {
Logger("swagger").info("Loading class: %s.".format(className))
!className.indexOf("controllers.api.core").equals(-1) && SwaggerContext.loadClass(className).getAnnotation(classOf[Api]) != null
} catch {
case ex: Exception => {
Logger("swagger").error("Problem loading class: %s. %s: %s".format(className, ex.getClass.getName, ex.getMessage))
false}
case ex: Throwable => {
Logger("swagger").error("Problem loading class: %s. %s: %s".format(className, ex.getClass.getName, ex.getMessage))
false}
throw ex
}
} =>
Logger("swagger").info("Found API controller: %s".format(className))
SwaggerContext.loadClass(className)
} First I added a Throwable catch (just to log such kind of issue which are not Exceptions). |
@pycloux It's not my code ;). Maybe you could create PR and @matiwinnetou would be so kind to include something like that in distribution? It should solve problems with finding source of problem and blaming for errors that are not caused by swagger |
Hi Im getting exception when trying to use the module for play 2.4. (Java application) compilation passed successfully but when i run the app I get:
Caused by: java.lang.ExceptionInInitializerError: null
at java.lang.Class.forName0(Native Method) ~[na:1.8.0_45]
at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_45]
at com.wordnik.swagger.core.SwaggerContext$.loadClass(SwaggerContext.scala:21) ~[swagger-core_2.11-1.3.12.jar:1.3.12]
at pl.matisoft.swagger.PlayApiScanner$$anonfun$classes$1.applyOrElse(PlayApiScanner.scala:52) ~[swagger-play24_2.11-1.4.jar:1.4]
at pl.matisoft.swagger.PlayApiScanner$$anonfun$classes$1.applyOrElse(PlayApiScanner.scala:49) ~[swagger-play24_2.11-1.4.jar:1.4]
at scala.collection.immutable.List.collect(List.scala:295) ~[scala-library-2.11.6.jar:na]
at pl.matisoft.swagger.PlayApiScanner.classes(PlayApiScanner.scala:49) ~[swagger-play24_2.11-1.4.jar:1.4]
at play.modules.swagger.ApiListingCache$$anonfun$listing$1$$anonfun$apply$2$$anonfun$apply$3.apply(ApiListingCache.scala:34) ~[swagger-play24_2.11-1.4.jar:1.4]
at play.modules.swagger.ApiListingCache$$anonfun$listing$1$$anonfun$apply$2$$anonfun$apply$3.apply(ApiListingCache.scala:32) ~[swagger-play24_2.11-1.4.jar:1.4]
at scala.Option.map(Option.scala:146) ~[scala-library-2.11.6.jar:na]
Caused by: java.lang.RuntimeException: DataSource user is null?
at com.avaje.ebeaninternal.server.lib.sql.DataSourcePool.(DataSourcePool.java:204) ~[avaje-ebeanorm-4.6.2.jar:na]
at com.avaje.ebeaninternal.server.core.DefaultContainer.getDataSourceFromConfig(DefaultContainer.java:325) ~[avaje-ebeanorm-4.6.2.jar:na]
at com.avaje.ebeaninternal.server.core.DefaultContainer.setDataSource(DefaultContainer.java:291) ~[avaje-ebeanorm-4.6.2.jar:na]
at com.avaje.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:99) ~[avaje-ebeanorm-4.6.2.jar:na]
at com.avaje.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:73) ~[avaje-ebeanorm-4.6.2.jar:na]
at com.avaje.ebeaninternal.server.core.DefaultContainer.createServer(DefaultContainer.java:38) ~[avaje-ebeanorm-4.6.2.jar:na]
at com.avaje.ebean.EbeanServerFactory.create(EbeanServerFactory.java:54) ~[avaje-ebeanorm-4.6.2.jar:na]
at com.avaje.ebean.Ebean$ServerManager.getWithCreate(Ebean.java:210) ~[avaje-ebeanorm-4.6.2.jar:na]
at com.avaje.ebean.Ebean$ServerManager.get(Ebean.java:197) ~[avaje-ebeanorm-4.6.2.jar:na]
at com.avaje.ebean.Ebean$ServerManager.access$200(Ebean.java:133) ~[avaje-ebeanorm-4.6.2.jar:na]
Any Idea ?
The text was updated successfully, but these errors were encountered: