JDK 11 issue with javax.crypto.JceSecurity - java-11

I am getting error with JDK 11
class javax.crypto.JceSecurity (in unnamed module #0x256bb5be) cannot access class jdk.internal.util.StaticProperty (in module java.base) because module java.base does not export jdk.internal.util to unnamed module #0x256bb5be

Java 9 introduced concept of modules. Classes to be visible outside the modules, needed to be exported. You can do it on module definition or on command line.
To do it on command line, you need to use parameter
--add-exports <source-module>/<package>=<target-module>(,<target-module>)*
As you are using maven, then according to https://blog.codefx.org/tools/maven-on-java-9/
you need to create file .mvn/jvm.config in your projects folder and put options inside.
For error you are experiencing content of the file should be:
--add-exports java.base/jdk.internal.util=ALL-UNNAMED

Related

Importing Docstrings from Python modules using Sphinx and autodoc [duplicate]

I have faced a problem with Sphinx in Python. Even if I have followed the instructions from https://groups.google.com/forum/#!topic/sphinx-users/lO4CeNJQWjg I was not able to solve it.
I have Docs/source folder which contains:
conf.py
index.rst
RstFiles (the folder which contains .rst files for each module).
In conf.py I specify the abs path in the following way:
sys.path.insert(0, os.path.abspath('..'))
In index.rst I call all the modules from RstFiles folder in the following way:
.. toctree::
:maxdepth: 2
:caption: Contents:
BatchDataContainer.rst
BatchDefaultValues.rst
BatchTypes.rst
And finally, the content of each .rst file is in the following way:
BatchDataContainer
==================
.. automodule:: RstFiles.BatchDataContainer
:members:
When I run sphinx-build I get 2 main errors:
D:\hfTools\Projects\Validation-Source\Docs\source\RstFiles\BatchDataContainer.rst:
WARNING: document isn't included in any toctree
and
WARNING: autodoc: failed to import module 'BatchDataContainer' from
module 'RstFiles'; the following exception was raised: No module named
'RstFiles'
Any ideas what might be wrong cause I have tried different things already and nothing has helped?
If conf.py is located in this directory,
D:\hfTools\Projects\Validation-Source\Docs\source,
and the project's Python modules (including BatchDataContainer.py) are in
D:\hfTools\Projects\Validation-Source\Products,
then you need sys.path.insert(0, os.path.abspath('../..')) in conf.py.
The automodule directive needs to be updated as well:
.. automodule:: Products.BatchDataContainer
:members:

Can not run Clojure project with Cursive using Leiningen

I am unable to run a simple test project using the intellij plugin cursive. I am able to open a REPL without any problems and can even call functions defined in the core.clj file.
Running the project directly however yields this error message:
Error running 'new-project.core': failed to access class com.intellij.execution.impl.ProcessStreamsSynchronizer from class com.intellij.execution.impl.ConsoleViewRunningState (com.intellij.execution.impl.ProcessStreamsSynchronizer is in unnamed module of loader com.intellij.util.lang.UrlClassLoader #402f32ff; com.intellij.execution.impl.ConsoleViewRunningState is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader #c9a79eb)
Intellij run configuration here. Changing How to run it and What to run does nothing.
Starting the project via the Leiningen tab yields the same error message.
There is an issue open about it.
https://github.com/cursive-ide/cursive/issues/2350
Also I tried to do lein run Let me know if this work for you.

Grails IntelliJ run-app loader constraint violation

First of all: I have no experience with grails and groovy.
I have a legacy project based on Grails 2.4.5, and have a problem with running it from IntelliJ.
Error executing script RunApp: loader constraint violation: when resolving method "org.springsource.loaded.TypeRegistry.getReloadableType(II)Lorg/springsource/loaded/ReloadableType;" the class loader (instance of java/net/URLClassLoader) of the current class, Config, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for the method's defining class, org/springsource/loaded/TypeRegistry, have different Class objects for the type org/springsource/loaded/ReloadableType used in the signature (Use --stacktrace to see the full trace)
However when I try to run it manually by: "grails run-app" it runs without a problem.
I tried creating an empty project in IntelliJ and it compiles and runs.
I've wasted 5 hours already trying to compare empty project and mine and found no clue. What should I check?

Kotlin - Error: Could not find or load main class _DefaultPackage

I followed the Kotlin tutorial for eclipse here : Getting Started With Eclipse Luna
However, I'm running into this error:
Error: Could not find or load main class _DefaultPackage
Anyone who knows to get around this?
This was a severe bug (KT-10221) in automatic generation of Launch Configuration in plugin version 0.4.0. It was fixed in 0.5.0 so the recommendend way to workaround is to update plugin.
The source of the problem was that the plugin used an old pattern for generating name of the class for main function that had been abandoned by Kotlin compiler.
It's possible to workaround it by editing launch configuration (Eclipse Menu -> Run -> Run Configurations...) by hand and changing Main class field in Java Application group. If the file is named hello.kt with no package directive, as it is described in tutorial, than corrected string should be HelloKt.
If file has name other.kt with package my.tutorial than the Main Class should contain my.tutorial.HelloKt. You can read more about it in the section Package-Level Functions of Calling Kotlin From Java page.
I have been getting the same issue. And after putting the right compiler output path, it got resolved.
Go to Project -> Project Compiler output :
In the text box, fill this:
[Absolute Path]/{Project Name}/out
In my case I was having this problem while trying to run the program using the Application Gradle plugin. The problem was in the mainClassName property using single quotes instead of double ones
This didn't work:
mainClassName = 'demo.HelloWorldKt'
With double quotes, it works:
mainClassName = "demo.HelloWorldKt"
For me it worked after I installed the correct JDK. I first had JDK 11 but the tutorial I did was with JDK 8 so after I installed this and set it in the "installed JREs" options it found the main class without having any "mainClassName" or any other option in the build.gradle file.
For me, it worked in a fresh eclipse workspace. Possibly, the Kotlin eclipse plugin is not playing well with other plugins (in my case, PyDev).
I'm creating a Kotlin Application with JavaFX and I had this issue until I went to:
Run > Run Configurations > Java Application > Common
I unticked "Allocate console" and it fixed the issue.

Jython does not resolve python imports from bundled Lib files/folders on Weblogic 10.3.5

I am new to Jython and Python, trying to build a prototype that makes use of Python code to be called from within Java. The code I am developing works in Jetty and in standalone mode (running java -jar from the command line), but not when deployed to weblogic.
How can I make weblogic(10.3.5) server/Jython recognize the Lib folder within jython-standalone-2.5.4-rc1.jar?
My Java code uses the JythonObjectFactory to invoke python modules as outlined in the Jython book:
http://www.jython.org/jythonbook/en/1.0/JythonAndJavaIntegration.html
The Python modules are using external libraries like csv, logging etc. that are not packaged with jython.jar, hence I am using jython-standalone jar.
The java code includes an interface that would define the class type of the first invoked py module from within java. The interface and the input and output (to python modules) type classes are in a package structure as com.abc.xpackage. and the py modules exist at the root of this package. A controller layer calls the objectfactory and in turn executes the python code thus:
JythonObjectFactory calFactory = new JythonObjectFactory(CalcType.class, "Calculate", "Calculate");
CalcType engine = (CalcType)calFactory.createObject();
output = engine.execute(input);
The entire code is bundled as a jar file which would become part of a web application deployed on weblogic. The code was compiled with maven (with jython dependencies included in the repository) and runs fine on the included Jetty runtime within eclipse.
When deployed on weblogic, however, I get a "ImportError: no module named csv" error.
To analyze what is happening, I tried printing the Jython system state path on weblogic and the standalone environment/Jetty. What I found is,
on Jetty, the system path consists of the following:
C:\.m2\repo\org\python\jython\jython-standalone-2.5.3-rc1.jar\Lib, ____classpath__, ____pyclasspath__
on Weblogic, printing the system path by default shows the following:
____classpath__, ____pyclasspath__
I tried forcing the inclusion of the missing path using the code as follows:
public JythonObjectFactory(PySystemState state, Class interfaceType, String moduleName, String className) {
String pathToAppend = new File(state.getClass().getProtectionDomain().getCodeSource().getLocation().toURI().getPath()).getAbsolutePath()+"\\Lib";
state.path.insert(0, new PyString(pathToAppend));
state.path.append(new PyString(pathToAppend));
System.out.println("Jython sys path: "+state.path);
Please note, I prepended as well as appended the path in different trials. The sys path on weblogic now displays the following:
Jython sys path: ['C:\\wldomain\\wls135\\servers\\cgServer\\tmp\\app-1\\war\\WEB-INF\\lib\\jython-standalone-2.5.4-rc1.jar\\Lib', '__classpath__', '__pyclasspath__/', 'C:\\wldomain\\wls135\\servers\\cgServer\\tmp\\app-1\\war\\WEB-INF\\lib\\jython-standalone-2.5.4-rc1.jar\\Lib']
I am still getting ImportError despite this forcing of sys path. Please help why this works in a local environment, and not on weblogic, and if there is any configuration I am missing. Apologize for the rambling long post, I did not know how to explain the problem better. I will try and include any code/artifacts as needed.
Based on a comment(by Lassi) on the blog post below:
http://www.petervannes.nl/files/e1c3c56d15d25dcfd4adb5397a9ef71e-53.php
The jython issue was resolved after explicitly adding the Lib folder python.path to the weblogic startup script as a JAVA_OPTION.
In my case I added the exploded Lib folder to the domain server lib, but based on my test this works also from within the jython jar. Both the following JAVA_OPTIONS worked:
-Dpython.path=C:\wldomain\wls135\lib\Lib
-Dpython.path=C:\wldomain\wls135\lib\jython-standalone-2.5.4-rc1.jar\Lib
The programmatic way of sys.path.append worked for the local environment(jetty) but did not seem to work for weblogic.