Java Liberty Profile上的代码源8.5.5.5
我试图在IBM Liberty Profile 8.5.5.5上使用(wiab)部署(dw)应用程序,但在Java Liberty Profile上的代码源8.5.5.5,java,websphere,dropwizard,websphere-liberty,Java,Websphere,Dropwizard,Websphere Liberty,我试图在IBM Liberty Profile 8.5.5.5上使用(wiab)部署(dw)应用程序,但在io.dropwizard.util.JarLocation类中遇到了som问题。wiab将尝试获取包装dw应用程序的侦听器类的位置,但由于类“ProtectionDomain中的CodeSource对象为null,因此无法获取该位置 klass.getProtectionDomain().getCodeSource().getLocation() 然而,我已经尝试在Tomcat8和最新的
io.dropwizard.util.JarLocation
类中遇到了som问题。wiab将尝试获取包装dw应用程序的侦听器类的位置,但由于类“ProtectionDomain
中的CodeSource
对象为null
,因此无法获取该位置
klass.getProtectionDomain().getCodeSource().getLocation()
然而,我已经尝试在Tomcat8和最新的Liberty Profile v9测试版上部署,它们都工作得很好
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>
servlet-3.1
jsp-2.3
el-3.0
websocket-1.1
localConnector-1.0
我尝试从IntelliJ内部部署普通战争和爆炸战争,并使用dropin文件夹和预构建战争。v9测试版会玩得很好,但不是8.5.5.5
这是包装dw应用程序的侦听器类:
@WebListener
public class MoshpitWebApplication extends WebApplication<MoshpitConfiguration> {
private static final Logger LOGGER = LoggerFactory.getLogger(MoshpitWebApplication.class);
public MoshpitWebApplication() {
super(new MoshpitApplication(), "/configuration/moshpit.yml");
}
}
@WebListener
公共类MoshpitWebApplication扩展了WebApplication{
私有静态最终记录器Logger=LoggerFactory.getLogger(MoshpitWebApplication.class);
公共MoshpitWebApplication(){
super(新的MoshpitApplication(),“/configuration/moshpit.yml”);
}
}
这是我的dw应用程序类
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));
}
}
公共类MoshpitApplication扩展应用程序{
公共MoshpitApplication(){
}
公共静态void main(字符串[]args)引发异常{
新建MoshpitApplication().run(args);
}
@凌驾
公共字符串getName(){
返回“moshpit”;
}
@凌驾
公共无效初始化(引导引导引导){
setConfigurationSourceProvider(新文件配置SourceProvider());
//还没什么要做的
}
@凌驾
公共无效运行(MoshpitConfiguration配置,环境)引发异常{
最终模板模板=configuration.buildTemplate();
register(“template”,新模板healthcheck(template));
environment.jersey().register(新HelloWorldResource(模板));
}
}
更新:
这似乎是Liberty 8.5.5.5的一个普遍问题。尝试部署一个完全不同的应用程序,我观察到了相同的行为。应用程序类的
CodeSource
为null
。Liberty配置文件当前未为应用程序类设置代码源。正如您所注意到的,这在当前的测试版中得到了解决,并将在6月26日发布8.5.5.6时得到解决。谢谢!这是个好消息!从8.5.5.6开始,代码源代码现在已经设置好了,它不会有APAR,因为它是作为JavaEE7支持的一部分完成的。