Liberty Profile 8.5.5.5 上的代码源
CodeSource on Liberty Profile 8.5.5.5
我正在尝试在 IBM Liberty Profile 8.5.5.5 上部署 dropwizard (dw) application using wizard-in-a-box (wiab),但我在 io.dropwizard.util.JarLocation
class。 wiab 将尝试获取 Listener class 包装 dw 应用程序的位置,但由于 class' ProtectionDomain
中的 CodeSource
对象是 null
.
klass.getProtectionDomain().getCodeSource().getLocation()
但是,我尝试在 Tomcat 8 和最新的 Liberty Profile v9 beta 上进行部署,它们都运行良好。
Liberty 服务器上的两个 server.xml 文件在功能方面看起来完全一样。
<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">
<!-- Enable features -->
<featureManager>
<feature>servlet-3.1</feature>
<feature>jsp-2.3</feature>
<feature>el-3.0</feature>
<feature>websocket-1.1</feature>
<feature>localConnector-1.0</feature>
</featureManager>
<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<httpEndpoint id="defaultHttpEndpoint" httpPort="9080" httpsPort="9443" />
<applicationMonitor updateTrigger="mbean" />
<application id="moshpit_war_war_exploded" location="D:\code\moshpit\moshpit-war\target\moshpit" name="moshpit_war_war_exploded" type="war" context-root="/" />
</server>
我已经尝试从 IntelliJ 内部部署普通的 war 和展开的 war,以及使用带有预建 war 的 dropin 文件夹。 v9 beta 版本可以玩,但不是 8.5.5.5。
这是包装 dw 应用程序的侦听器 class:
@WebListener
public class MoshpitWebApplication extends WebApplication<MoshpitConfiguration> {
private static final Logger LOGGER = LoggerFactory.getLogger(MoshpitWebApplication.class);
public MoshpitWebApplication() {
super(new MoshpitApplication(), "/configuration/moshpit.yml");
}
}
这是我的 dw 应用程序 class
public class MoshpitApplication extends Application<MoshpitConfiguration> {
public MoshpitApplication() {
}
public static void main(String[] args) throws Exception {
new MoshpitApplication().run(args);
}
@Override
public String getName() {
return "moshpit";
}
@Override
public void initialize(Bootstrap<MoshpitConfiguration> bootstrap) {
bootstrap.setConfigurationSourceProvider(new FileConfigurationSourceProvider());
// nothing to do yet
}
@Override
public void run(MoshpitConfiguration configuration, Environment environment) throws Exception {
final Template template = configuration.buildTemplate();
environment.healthChecks().register("template", new TemplateHealthCheck(template));
environment.jersey().register(new HelloWorldResource(template));
}
}
更新:
这似乎是 Liberty 8.5.5.5 的普遍问题。尝试部署一个完全不同的应用程序,我观察到相同的行为。 CodeSource
是 null
应用程序 classes.
Liberty 配置文件当前没有为应用程序 类 设置代码源。如您所见,此问题已在当前测试版中解决,并将在 6 月 26 日发布 8.5.5.6 时解决。
我正在尝试在 IBM Liberty Profile 8.5.5.5 上部署 dropwizard (dw) application using wizard-in-a-box (wiab),但我在 io.dropwizard.util.JarLocation
class。 wiab 将尝试获取 Listener class 包装 dw 应用程序的位置,但由于 class' ProtectionDomain
中的 CodeSource
对象是 null
.
klass.getProtectionDomain().getCodeSource().getLocation()
但是,我尝试在 Tomcat 8 和最新的 Liberty Profile v9 beta 上进行部署,它们都运行良好。
Liberty 服务器上的两个 server.xml 文件在功能方面看起来完全一样。
<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">
<!-- Enable features -->
<featureManager>
<feature>servlet-3.1</feature>
<feature>jsp-2.3</feature>
<feature>el-3.0</feature>
<feature>websocket-1.1</feature>
<feature>localConnector-1.0</feature>
</featureManager>
<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<httpEndpoint id="defaultHttpEndpoint" httpPort="9080" httpsPort="9443" />
<applicationMonitor updateTrigger="mbean" />
<application id="moshpit_war_war_exploded" location="D:\code\moshpit\moshpit-war\target\moshpit" name="moshpit_war_war_exploded" type="war" context-root="/" />
</server>
我已经尝试从 IntelliJ 内部部署普通的 war 和展开的 war,以及使用带有预建 war 的 dropin 文件夹。 v9 beta 版本可以玩,但不是 8.5.5.5。
这是包装 dw 应用程序的侦听器 class:
@WebListener
public class MoshpitWebApplication extends WebApplication<MoshpitConfiguration> {
private static final Logger LOGGER = LoggerFactory.getLogger(MoshpitWebApplication.class);
public MoshpitWebApplication() {
super(new MoshpitApplication(), "/configuration/moshpit.yml");
}
}
这是我的 dw 应用程序 class
public class MoshpitApplication extends Application<MoshpitConfiguration> {
public MoshpitApplication() {
}
public static void main(String[] args) throws Exception {
new MoshpitApplication().run(args);
}
@Override
public String getName() {
return "moshpit";
}
@Override
public void initialize(Bootstrap<MoshpitConfiguration> bootstrap) {
bootstrap.setConfigurationSourceProvider(new FileConfigurationSourceProvider());
// nothing to do yet
}
@Override
public void run(MoshpitConfiguration configuration, Environment environment) throws Exception {
final Template template = configuration.buildTemplate();
environment.healthChecks().register("template", new TemplateHealthCheck(template));
environment.jersey().register(new HelloWorldResource(template));
}
}
更新:
这似乎是 Liberty 8.5.5.5 的普遍问题。尝试部署一个完全不同的应用程序,我观察到相同的行为。 CodeSource
是 null
应用程序 classes.
Liberty 配置文件当前没有为应用程序 类 设置代码源。如您所见,此问题已在当前测试版中解决,并将在 6 月 26 日发布 8.5.5.6 时解决。