java.lang.NoClassDefFoundError:使用dropwizard时的io / dropwizard / jetty / RequestLogFactory(java.lang.N

编程入门 行业动态 更新时间:2024-10-28 16:18:38
java.lang.NoClassDefFoundError:使用dropwizard时的io / dropwizard / jetty / RequestLogFactory(java.lang.NoClassDefFoundError: io/dropwizard/jetty/RequestLogFactory when using dropwizard)

当我从Hibernate更改为JDBI并尝试启动我的应用程序时,出现以下错误

java.lang.NoClassDefFoundError:io / dropwizard / jetty / RequestLogFactory

堆栈跟踪说,这个问题的原因在我的配置类中,在类定义中。 但我不知道出了什么问题。 有谁有这个问题?

MyConfiguration.java

import com.fasterxml.jackson.annotation.JsonProperty; import io.dropwizard.Configuration; import io.dropwizard.db.DataSourceFactory; import org.hibernate.validator.constraints.NotEmpty; import javax.validation.constraints.NotNull; public class MyConfiguration extends Configuration { @JsonProperty @NotNull private DataSourceFactory database; @JsonProperty @NotEmpty private String someString; public DataSourceFactory getDataSourceFactory() { return database; } public String getSomeString() { return someString; } }

编辑我正在使用dropwizard 1.0.0和RequestLogFactory既不在给定的包中,也没有Intellij找不到该类。

When I changed from Hibernate to JDBI, and tried to launch my application, error below occured

java.lang.NoClassDefFoundError: io/dropwizard/jetty/RequestLogFactory

Stack trace says, that the cause of this problem is in my configuration class, at the class definition. But i have no idea what's wrong. Anyone had this problem?

MyConfiguration.java

import com.fasterxml.jackson.annotation.JsonProperty; import io.dropwizard.Configuration; import io.dropwizard.db.DataSourceFactory; import org.hibernate.validator.constraints.NotEmpty; import javax.validation.constraints.NotNull; public class MyConfiguration extends Configuration { @JsonProperty @NotNull private DataSourceFactory database; @JsonProperty @NotEmpty private String someString; public DataSourceFactory getDataSourceFactory() { return database; } public String getSomeString() { return someString; } }

EDIT I'm using dropwizard 1.0.0 and RequestLogFactory is neither in the given package nor Intellij couldn't find that class.

最满意答案

您没有直接使用RequestLogFactory,但它似乎是您要导入的类之一,并且您的类路径中需要存在jar,以便导入这些类以在运行时正常工作。 您应该追踪需要包含在包含RequestLogFactory类的类路径中的jar。

You aren't using the RequestLogFactory directly, but it seems one of the classes you're importing is and that jar needs to be present on your classpath for these classes you're importing to work appropriately at runtime. You should track down the jar which you need to include on your classpath that includes the RequestLogFactory class.

更多推荐

本文发布于:2023-07-28 23:33:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1310196.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:NoClassDefFoundError   lang   java   dropwizard   RequestLogFactory

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!