Search code examples
javamavenjarweblogicpom.xml

Error running Maven project: Unsupported protocol: t3


I have a Maven project for monitoring of weblogic servers through JMX. In the maven POM.xml, I specify the dependency for wlfullclient.jar through scope tag due to previous errors.

  <dependency>
    <groupId>weblogic</groupId>
    <artifactId>wlfullclient</artifactId>
        <scope>system</scope>
    <systemPath>${basedir}/libs/wlfullclient-11.1.1.4.0.jar</systemPath>
    <version>11.1.1.4.0</version>
  </dependency>

It builds successfully, however, when running the jar file, I get this error:

java.net.MalformedURLException: Unsupported protocol: t3
at javax.management.remote.JMXConnectorFactory.newJMXConnector(Unknown Source)
at javax.management.remote.JMXConnectorFactory.connect(Unknown Source)

I looked into the MANIFEST file in the built jar file, and noticed it lists all jars in the classpath, except this wlfullclient.jar one (and when I add it and update the manifest, it works).

Why is this happening? And how to fix it so it won't miss this classpath in the generated jar file?

UPDATES: these are all my dependencies in POM.xml:

  <dependency>
    <groupId>weblogic</groupId>
    <artifactId>wlfullclient</artifactId>
        <scope>system</scope>
    <systemPath>${basedir}/libs/wlfullclient-11.1.1.4.0.jar</systemPath>
    <version>11.1.1.4.0</version>
  </dependency>

  <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.24</version>
  </dependency>
  <dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>1.2.1</version>
  </dependency>
  <dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-core</artifactId>
    <version>1.2.1</version>
  </dependency>
  <dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.8</version>
  </dependency> 
    </dependencies>

And here is the MANIFEST.MF in the jar:

Manifest-Version: 1.0
Built-By: myname
Build-Jdk: 1.7.0_80
Class-Path: libs/slf4j-api-1.7.24.jar libs/logback-classic-1.2.1.jar l
 ibs/logback-core-1.2.1.jar libs/mysql-connector-java-5.1.8.jar
Created-By: Apache Maven 3.3.3
Main-Class: main.WLStatusData
Archiver-Version: Plexus Archiver

Solution

  • As Ivan has pointed, this is the expected behavior of using system scope. You can learn more here about it (Dependency Scope section). To include your library jar into the result file you need to install it into your local maven repository with the command mvn install:install-file, more details here and use it as a simple dependency (without system scope and system path)