CodeSource by Liberty 8.5.5.5

I am trying to deploy dropwizard ( dw ) application using wizard-in-a-box ( wiab ) in IBM Liberty profile 8.5.5.5, but I am running into som issues with the class io.dropwizard.util.JarLocation

. wiab will try to get the location of the Listener class that wraps the dw application, but it will not, since the object is CodeSource

in class << 22> null

.

klass.getProtectionDomain().getCodeSource().getLocation()

      

However, I tried to deploy Tomcat 8 and the latest beta version of Liberty profile v9 and they both work fine.

Both server.xml files look different on Liberty servers in terms of features.

<?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>

      

I tried deploying normal war and exploded war inside IntelliJ and also using the dropin folder with the pre-built war. V9 beta will play well, but not 8.5.5.5.

This is the Listener class that the dw app brings over:

@WebListener
public class MoshpitWebApplication extends WebApplication<MoshpitConfiguration> {
    private static final Logger LOGGER = LoggerFactory.getLogger(MoshpitWebApplication.class);

    public MoshpitWebApplication() {
        super(new MoshpitApplication(), "/configuration/moshpit.yml");
    }
}

      

and this is my dw application 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));
    }
}

      

Update:

This seems to be a common issue with Liberty 8.5.5.5. Tried deploying a completely different application and I observed the same behavior. For application classes CodeSource

null

.

+3


source to share


1 answer


The Liberty profile does not currently install a CodeSource class for application classes. As you noticed, this is being addressed in the current beta and will be covered when 8.5.5.6 is released on June 26th.



+2


source