mvn archetype:create SHA-256 MessageDigest not available - maven-3

This is my first time to try maven. My os in linuxmint.I have install maven successful.
mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /home/gzx/danale/environment/apache-maven-3.3.9
Java version: 1.8.0_111, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0_111/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-53-generic", arch: "amd64", family: "unix"
But when I have used mvn archetype:create
mvn archetype:create -DgroupId=org.sonatype.mavenbook.ch03 -DartifactId=simple -DpackageName=org.sonatype.mavenbook
it showed a strange error.
[WARNING] Error injecting: org.sonatype.plexus.components.cipher.DefaultPlexusCipher
com.google.inject.ProvisionException: Unable to provision, see the following errors:Error injecting constructor, org.sonatype.plexus.components.cipher.PlexusCipherException: java.security.NoSuchAlgorithmException: SHA-256 MessageDigest not available
at org.sonatype.plexus.components.cipher.DefaultPlexusCipher.(Unknown Source)
while locating org.sonatype.plexus.components.cipher.DefaultPlexusCipher
It was so strange, how should I do?

I think maybe you have already figured your problem. But I got this bug yesterday and I fixed it today. I should write my solution down. Maybe someone will fall this trap.
Actually this problem is because Java cannot find the class "SHA-256 MessageDigest". But it is provided by JRE default. It should be found automatically.
If you access your JAVA_HOME, you may find a file whose name is jsse.pack in JAVA_HOME/jre/lib, and there is not a file named jsse.jar. That is the problem. Type
unpack200 jsse.pack jsse.jar
(unpack200 will be recognized as soon as you have set your Java path)
and the problem should be soloved.
Note:
Some JDK's have jsse.rar not jsse.pack, therefore, running "unpack200 jsse.rar jsse.jar" command will get the desired result, and will not delete the "jsse.rar" file (in case of *.pack files, they get replaced by the *.jar files).

Related

Probable bug in java compiler for openjdk8, how to report and get it fixed?

I've prepared docker image that demonstrate the problem:
https://drive.google.com/uc?id=1i04_dVL0Rp5rxXCMuHaS4LYREkZjAAW1&export=download
This image is basically alpine:3.11 + apk add openjdk8 maven + my maven project containing sample minimal java class that shows problem
Which you can try with following commands:
# docker load -i bugexample.img
# docker run -w /root/bug-example --name bugtest bugexample /bin/ash build-until-sha-different.sh
If you are lucky enough (sometimes require several attempts) you will get following output:
Found! Sha1 of two subsequent otherwise identical builds are different!
--- 1.sha1
+++ 2.sha1
## -1,3 +1,3 ##
d8d46555c93da579adefc629f1764965a5493edb com/SimpleBug$1.class
75007242aab1e1877d24124d432cb246a79476a8 com/SimpleBug$SimpleBugBuilder.class
-23e8d0ea909b95a7955e0ec0adb4d12ae2193dd1 com/SimpleBug.class
+6a303d69d3f382b23ca04caee4102ee1cd7151e3 com/SimpleBug.class
The core issue with this build is that it produce different bytecode almost each time it get build even though nothing else (neither environment, nor code itself) had changed.
When I do compare these different class files I see that they differ in one single byte:
# cmp -lb 1_SimpleBug.class 2_SimpleBug.class
4053 66 6 65 5
Digging deeper into class file structure I've found that this difference come from stackmapframe constant pool pointers (StackMapTable attribute -> stack_map_frame entry with tag Object_variable_info -> cpool_index)
1_SimpleBug.class
#35 = Utf8 supSetStringParameter10
#36 = Utf8 Lcom/google/common/base/Supplier;
2_SimpleBug.class
#35 = Utf8 supSetStringParameter10
#36 = Utf8 Lcom/google/common/base/Supplier;
So one file points to #35 and another to #36. I don't think this is correct behavior.
I would like to sumbit this to a proper issue tracker but I don't know how to do that since all related JDK trackers are for devs only.
# java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (IcedTea 3.15.0) (Alpine 8.242.08-r0)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)
# mvn -version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/share/java/maven-3
Java version: 1.8.0_242, vendor: IcedTea, runtime: /usr/lib/jvm/java-1.8-openjdk/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-1050-kvm", arch: "amd64", family: "unix"
And here is archive with java project:
https://drive.google.com/uc?id=1ZBdRzUk00QtpkGGnKAzipMjMtcnkKGN4&export=download
Well... The Mountain in Labour...
All of this was for nothing. Maven was main culprit. First time I ran my build it downloads lots of stuff that maven require (apart from my project dependencies) and then start compilation in same jvm. Second time build runs there is no need to download so compilation starts immediately. I don't know exactly why but first invocation of compiler is somehow affected by state of the jvm and this cause it to produce slightly different bytecode.
Solution was to add <fork>true<fork> to my pom.xml file and build now is totally reproducible... though takes ~2x more time :)
I still believe that this should not happen even if initial compilation happened inside maven jvm, and it may still be topic for improvement in javac but this "workaround" is acceptable.

error while reading extension file 'intellij_info_bundled.bzl'

we are trying to create a Scala project which uses Spark also but we are facing issue Encountered error while reading extension file 'intellij_info_bundled.bzl': no such package '#intellij_aspect//': No WORKSPACE file found in C:/users//_bazel_user/i45wuf6d/external/intellij_aspect. Is it has something missing in Intellij?
Scala file
package src.main.scala
object HelloWorld extends App {
def main(args: Array[String]) {
println("Hello, world!")
}
}
Build file
package(default_visibility = ["//visibility:public"])
load("#io_bazel_rules_scala//scala:scala.bzl", "scala_library", "scala_test")
scala_library(
name = "hello-world",
srcs = glob(["src/main/scala/*.scala"]),
)
scala_test(
name = "Hello_test",
srcs = glob(["src/main/scala/*.scala"]),
size = "small", # Expect this test to run quickly
)
Work Space
workspace(name = "scala_example")
rules_scala_version="7522c866450cf7810eda443e91ff44d2a2286ba1" # update this as needed
http_archive(
name = "io_bazel_rules_scala",
url = "https://github.com/bazelbuild/rules_scala/archive/%s.zip"%rules_scala_version,
type = "zip",
strip_prefix= "rules_scala-%s" % rules_scala_version
)
load("#io_bazel_rules_scala//scala:scala.bzl", "scala_repositories")
scala_repositories()`enter code here`
# register default scala toolchain
load("#io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains")
scala_register_toolchains()
Command and Error from console
Command: C:\ProgramData\chocolatey\bin\bazel.exe build --tool_tag=ijwb:IDEA:community --keep_going --curses=no --color=yes --experimental_ui=no --progress_in_terminal_title=no --aspects=#intellij_aspect//:intellij_info_bundled.bzl%intellij_info_aspect --override_repository=intellij_aspect=C:\Users\ADMIN.IdeaIC2017.3\config\plugins\ijwb\aspect --output_groups=intellij-compile-java,intellij-compile-py -- //...:all
INFO: Loading complete. Analyzing...
ERROR: Encountered error while reading extension file 'intellij_info_bundled.bzl': no such package '#intellij_aspect//': No WORKSPACE file found in C:/users/admin/appdata/local/temp/_bazel_sandhya/criyrv6d/external/intellij_aspect.
INFO: Found 3 targets...
WARNING: failed to create one or more convenience symlinks for prefix 'bazel-':
cannot create symbolic link bazel-out -> C:/users/admin/appdata/local/temp/_bazel_sandhya/criyrv6d/execroot/scala_example/bazel-out: Cannot create junction (name=C:\users\admin\scalaprojects\example1\bazel-out, target=C:\users\admin\appdata\local\temp_bazel_sandhya\criyrv6d\execroot\scala_example\bazel-out): ERROR: src/main/native/windows/file-jni.cc(86): nativeCreateJunction(C:\users\admin\scalaprojects\example1\bazel-out, C:\users\admin\appdata\local\temp_bazel_sandhya\criyrv6d\execroot\scala_example\bazel-out): ERROR: src/main/native/windows/file.cc(128): CreateJunction(\?\C:\users\admin\scalaprojects\example1\bazel-out): Cannot create a file when that file already exists.
cannot create symbolic link bazel-out -> C:/users/admin/appdata/local/temp/_bazel_sandhya/criyrv6d/execroot/scala_example/bazel-out: Cannot create junction (name=C:\users\admin\scalaprojects\example1\bazel-out, target=C:\users\admin\appdata\local\temp_bazel_sandhya\criyrv6d\execroot\scala_example\bazel-out): ERROR: src/main/native/windows/file-jni.cc(86): nativeCreateJunction(C:\users\admin\scalaprojects\example1\bazel-out, C:\users\admin\appdata\local\temp_bazel_sandhya\criyrv6d\execroot\scala_example\bazel-out): ERROR: src/main/native/windows/file.cc(128): CreateJunction(\?\C:\users\admin\scalaprojects\example1\bazel-out): Cannot create a file when that file already exists.
.
INFO: Building...
ERROR: command succeeded, but not all targets were analyzed.
INFO: Elapsed time: 18.108s, Critical Path: 0.05s
Make failed
This is a sample Helloworld program only
In general, like #Ittai, I would suggest you open an issue in the intellij plugin github repo.
Unfortunately, your version of the plugin is no longer supported. I, too, previously ran into an issue with an older version of the plugin and was recommended to upgrade to the latest version. Which resolved the specific issue I was facing.
When reporting the issue make sure to include the following bits of information:
intellij build number
plugin version number
rules_scala version
operating system (it seems your using Windows, while most users use unix based systems)
bazel release number
how you have opened the intellij project (BUILD file, WORKSPACE, .blazeproject)
Additionally, to verify this is in fact an issue with the plugin, I would also suggest you try to reproduce this issue on a Unix based system. It seems you are using Intellij
compile on Windows. This may be Windows specific issue with aspects not being recognized.
When attempting to reproduce, make sure to clone your repository in a separate directory, close the intellij project, and reopen the project

Can't get neo4j to start - conf/log4j.properties

I've just used homebrew to successfully install the latest neo4j (Community Edition 2.1.4) on my MacBook Pro - however, I've been unable to get the server to start.
My question seems similar to this though that question remains unresolved (and the suggestions haven't worked for me).
Just quickly: I have previously successfully installed and booted the trial of the Enterprise Edition (over a year ago) and I've since removed it. Pure speculation but I'm guessing that my issues could be related to this.
When I run neo4j start
I get
Using additional JVM arguments: -server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties -Djava.util.logging.config.file=conf/logging.properties -Dlog4j.configuration=file:conf/log4j.properties -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Dneo4j.ext.udc.source=homebrew -Djava.awt.headless=true
Starting Neo4j Server...WARNING: not changing user
process [1368]... waiting for server to be ready.. Failed to start within 120 seconds.
Neo4j Server may have failed to start, please check the logs.
Then I inspect with neo4j console and get
WARNING: Max 256 open files allowed, minimum of 40 000 recommended. See the Neo4j manual.
Starting Neo4j Server console-mode...
Using additional JVM arguments: -server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties -Djava.util.logging.config.file=conf/logging.properties -Dlog4j.configuration=file:conf/log4j.properties -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Dneo4j.ext.udc.source=homebrew -Djava.awt.headless=true
log4j:ERROR Could not read configuration file from URL [file:conf/log4j.properties].
java.io.FileNotFoundException: conf/log4j.properties (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at java.io.FileInputStream.<init>(FileInputStream.java:101)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
at java.net.URL.openStream(URL.java:1037)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:459)
at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:471)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:125)
at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:73)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:243)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:156)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:685)
at org.apache.commons.configuration.AbstractFileConfiguration.<init>(AbstractFileConfiguration.java:121)
at org.apache.commons.configuration.AbstractFileConfiguration.<init>(AbstractFileConfiguration.java:154)
at org.apache.commons.configuration.PropertiesConfiguration.<init>(PropertiesConfiguration.java:252)
at org.neo4j.server.configuration.PropertyFileConfigurator.loadPropertiesConfig(PropertyFileConfigurator.java:147)
at org.neo4j.server.configuration.PropertyFileConfigurator.<init>(PropertyFileConfigurator.java:67)
at org.neo4j.server.Bootstrapper.createConfigurator(Bootstrapper.java:220)
at org.neo4j.server.Bootstrapper.start(Bootstrapper.java:98)
at org.neo4j.server.Bootstrapper.main(Bootstrapper.java:62)
log4j:ERROR Ignoring configuration file [file:conf/log4j.properties].
Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.debug(SLF4JLocationAwareLog.java:133)
at org.apache.commons.configuration.ConfigurationUtils.locate(ConfigurationUtils.java:447)
at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:213)
at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:197)
at org.apache.commons.configuration.AbstractFileConfiguration.<init>(AbstractFileConfiguration.java:162)
at org.apache.commons.configuration.PropertiesConfiguration.<init>(PropertiesConfiguration.java:252)
at org.neo4j.server.configuration.PropertyFileConfigurator.loadPropertiesConfig(PropertyFileConfigurator.java:147)
at org.neo4j.server.configuration.PropertyFileConfigurator.<init>(PropertyFileConfigurator.java:67)
at org.neo4j.server.Bootstrapper.createConfigurator(Bootstrapper.java:220)
at org.neo4j.server.Bootstrapper.start(Bootstrapper.java:98)
at org.neo4j.server.Bootstrapper.main(Bootstrapper.java:62)
It seems conf/log4j.properties isn't created at all. I've then copied the contents of that file from my brothers successful installation which seems to remedy the first error though the second error persists with the same result when I try to start the server again.
I've also tried to install via direct download and get the same result.
Other details:
>> java -version
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
>> sw_vers
ProductName: Mac OS X
ProductVersion: 10.9.4
BuildVersion: 13E28
I'm aware of the Max open files warning though don't believe that to be the issue.
Help would be much appreciated. Thanks in advance.
I've had some success – or, at least, I've got neo4j working now on my machine.
Following the suggestion in this google thread I removed slf4j-api-1.5.8.jar and slf4j-log4j12-1.5.8.jar from /Library/Java/Extensions and the server now boots.
I have no idea if this will have unexpected negative consequences but it definitely seems to solve my problem. Moving on.

Failed to check license ilog.rules.res.xu.IlrLocalizedResourceException: error code: XU.ERROR.10700

I am trying to execute iLog jRules (Version 7.1) from Plain Java program. I am using J2SE session factory. Still I am getting below error. Can someone please enlighten ? Also what is the best and simple way to execute jRules rules from java main method ?
6/9/14 4:48 PM [SEVERE] 10700 - -.- - Failed to check license ilog.rules.res.xu.IlrLocalizedResourceException: Failed to check license, error code: XU.ERROR.10700
at ilog.rules.res.xu.util.IlrResourceExceptionHelper.createResourceException(IlrResourceExceptionHelper.java:44)
at ilog.rules.res.xu.util.IlrResourceExceptionHelper.createResourceException(IlrResourceExceptionHelper.java:78)
at ilog.rules.res.xu.spi.IlrManagedXUConnectionFactory.verifyRESLicense(IlrManagedXUConnectionFactory.java:1108)
at ilog.rules.res.xu.spi.IlrManagedXUConnectionFactory.getRulesetProvider(IlrManagedXUConnectionFactory.java:883)
at ilog.rules.res.xu.spi.IlrManagedXUConnection.getRulesetProvider(IlrManagedXUConnection.java:280)
at ilog.rules.res.xu.spi.IlrManagedXUConnection.createEngineManager(IlrManagedXUConnection.java:1659)
at ilog.rules.res.xu.spi.IlrManagedXUConnection.getEngineManager(IlrManagedXUConnection.java:1591)
at ilog.rules.res.xu.spi.IlrManagedXUConnection.getRulesetParameters(IlrManagedXUConnection.java:1508)
at ilog.rules.res.xu.cci.IlrXUConnection.getRulesetParameters(IlrXUConnection.java:499)
at ilog.rules.res.xu.cci.IlrXUInteraction.getRulesetInformation(IlrXUInteraction.java:739)
at ilog.rules.res.xu.cci.IlrXUInteraction.dispatchExecution(IlrXUInteraction.java:185)
at ilog.rules.res.xu.cci.IlrXUInteraction.execute(IlrXUInteraction.java:343)
at ilog.rules.res.xu.cci.IlrXUInteraction.execute(IlrXUInteraction.java:459)
at ilog.rules.res.xu.cci.IlrCCIClient.executeInteraction(IlrCCIClient.java:189)
at ilog.rules.res.xu.cci.IlrCCIRuleEngineClient.getRulesetArchiveProperties(IlrCCIRuleEngineClient.java:699)
at ilog.rules.res.session.util.IlrTraceHelper.<init>(IlrTraceHelper.java:111)
at ilog.rules.res.session.impl.IlrStatelessSessionBase.execute(IlrStatelessSessionBase.java:97)
at poc.PojoClientRunnerImpl.executeentpocrules(PojoClientRunnerImpl.java:88)
at poc.Main.main(Main.java:28)
Caused by: ilog.jum.client700.IluSAMAccessDeniedException: At 2014-06-09 11:18:33 GMT, SAM 3.0.0.1040: Access denied to module 'RES4J'.
If you want to inspect your access key, please do the following:
java -cp [location]sam.jar ilog.jum.client700.IluSAMAccessKey -summary
I got this issue resolved. It was because jar version mismatch. I was using jRules Studio version 7.1.1 and was executing using jRules version 7.0.0 jars .
I modified my classpath to use version 7.1.1 jars for jRules version 7.1.1 rule studio.

How can I overcome error messages at Maven Initialization time?

Today I downloaded apache-maven-3.0.5 and Installed through the following link Link
after installing, I run the following command for checking whether it's installed or not
mvn -version
it showing message like this.
C:\Users\Infratab Bangalore>mvn -version
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 19:21:
28+0530)
Maven home: P:\Software\apache-maven-3.0.5
Java version: 1.7.0_21, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_21\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
'cmd' is not recognized as an internal or external command,
operable program or batch file.
If you observe above message,I am getting one error, clearly I mentioned error in below
'cmd' is not recognized as an internal or external command,
operable program or batch file.
How can I overcome this.
Finally I got it,why I am getting this problem 'cmd' is not recognized as an internal or external command, operable program or batch file. Because the following path C:\Windows\System32 was not set in Environment variables. I found through google.I fix it.run same command again it doesn't show any error.

Resources