Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

I've noted previously that the JWSC Ant Task fails to build Java sources above 1.5 source version due to a hardcoded "1.5" value in one of the Jar files. That was happening for the 12.1.2 version of the Ant task, it also appears to be a problem in the 12.1.2 Maven plugin as well as the 12.1.3 Maven plugin.

So if you're using this plugin...
 Maven Plugin
<groupId>com.oracle.weblogic</groupId>
<artifactId>weblogic-maven-plugin</artifactId>
<version>12.1.3-0-0</version>


...and you're trying to compile Java source code that has 1.6 or 1.7 features e.g. diamond operator or try-with-resources, your compilation will fail.

Hang on you say, there is an Oracle Patch #19942919 that addresses this exact issue. I tried that and ironically the patch itself throws a NullPointerException...
 Exception Stacktrace
[ERROR] Failed to execute goal com.oracle.weblogic:weblogic-maven-plugin:12.1.3-0-0:ws-jwsc (jwsc) on project MyCoolWS: ws-jwsc goal failed: java.lang.NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.oracle.weblogic:weblogic-maven-plugin:12.1.3-0-0:ws-jwsc (jwsc) on project DocXRegistryWS: ws-jwsc goal failed:
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
...
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: ws-jwsc goal failed:
at weblogic.tools.maven.plugins.webservices.JwscMojo.execute(JwscMojo.java:150)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: java.lang.NullPointerException
at weblogic.wsee.tools.anttasks.JwscTask.execute(JwscTask.java:249)
at weblogic.tools.maven.plugins.webservices.JwscMojo.execute(JwscMojo.java:148)
... 22 more
Caused by: java.lang.NullPointerException
at weblogic.wsee.tools.anttasks.JwscTask.initialize(JwscTask.java:289)
at weblogic.wsee.tools.anttasks.JwscTask.execute(JwscTask.java:234)
... 23 more


So what's the solution? Well in fact there are two ways around this.



Solution 1
1. Follow the steps in my previous article.
2. Package the modified .class file into a Jar file.
3. Install the Jar file into your Maven repository.
4. Add the installed Jar file as a dependency INSIDE THE MAVEN WEBLOGIC PLUGIN so that it overwrites the default .class file for JamUtils.

e.g. (based on Maven Documentation. Replace with whatever you used for the groupId, artifactId and version in step 3.
 Plugin Dependency
<plugin>
<groupId>com.oracle.weblogic</groupId>
<artifactId>weblogic-maven-plugin</artifactId>
<version>12.1.3-0-0</version>
<executions>
...
</executions>
<dependencies>
<dependency>
<groupId>net.igorkromin</groupId>
<artifactId>JamUtilsHack</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</plugin>


Solution 2
Upgrade to the 12.2.1 version of the plugin. This is probably an easier feat, but you will need to download the 12.2.1 version of WebLogic to get the plugin. Follow these instructions to set up the plugin.

Either solution works, of course Solution 1 is not official and would not be supported.

-i

A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.