java.lang.IllegalAccessException: class com.sleepycat.je.utilint.JVMSystemUtils cannot access class sun.management.BaseOperatingSystemImp - illegalstateexception

java.lang.IllegalAccessException: class com.sleepycat.je.utilint.JVMSystemUtils cannot access class sun.management.BaseOperatingSystemImpl (in module java.management) because module java.management does
not export sun.management to unnamed module
Is there a workarround for this error? I could not find any solution to this problem.
I have all the dependencies. But i could not understand what seems to be the issue here.

Related

Object can be used as class name even though a predefined Object class exists

i have created a class X in com.x package, since X class is there it didn't allowed me to create a class with name 'X' again.
now, i created a package java.lang and created a Object class with main method
its created, how it is allowing to create a class with same name and same package which is already exists.
when i try to execute it has thrown the below error
Error: Main method not found in class java.lang.Object, please define the main method as:
public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application
why is it happening? i know its pointing to predefined Object class and it didn't find main method.
thanks.

Does Haxe pickup on typedefs in interfaces and classes?

If I declare a typedef in a class or interface, can classes that import/implement the class/interface use the typedef?
You import a module, which can have a list of typedefs and direct definitions in it(and MUST have one definition with the same name as module). If definition isn't marked as private, it will be imported in your scope and you will be able to use it(with or without namespace).

One class in same package does not bind to JAXB context

Using JAXBContext.newInstance("com.jaxbgen") to bind classes in this package.
And then use this context to create mashaller.
It's so strange that one entity class xxx in this package could not mashaller, and throw JAXBException nor any of its super class is known to this context.
And the other works well.
I try to use JAXBContext.newInstance(xxx.class) to initial the context, it works well.
But I need to use package name to mashaller all classed in this package.
Could anyone help me on it?
When the package name is used to create a JAXBContext the JAXB impl does one of the following:
Looks for a class called ObjectFactory and then transitively pulls in all reference ed classes.
Looks for a text file called jaxb.index which contains a carriage return separated list of short class names (not package qualified). These classes and all referenced classes are the processed.

Groovy Grape dealing with dependency resolution

I am trying to use org.xhtmlrenderer:core-renderer:R8pre2 in a groovy script, but I get a Linkage error:
Caught: java.lang.LinkageError: loader constraint violation in interface
itable initialization: when resolving method
"org.apache.xerces.dom.NodeImpl.getOwnerDocument()Lorg/w3c/dom/Document;"
the class loader (instance of org/codehaus/groovy/tools/RootLoader) of the
current class, org/apache/xerces/dom/NodeImpl, and the class loader (instance of
<bootloader>) for interface org/w3c/dom/Node have different Class objects for
the type getOwnerDocument used in the signature
I've already googled a lot and found a lot of answer like these:
Dealing with "Xerces hell" in Java/Maven?
XercesImpl in conflict with JavaSE 6's internal xerces implementation. Both are needed... what can be done?
So, one solution could be to use javas endorsed mechanism to resolve the conflict, but I would like to make my script independent from such a "workaround". The script should run out of the box.
Next thing I was giving a try was to exclude the right dependency like this
#Grapes([
#Grab('org.xhtmlrenderer:core-renderer:R8pre2'),
#GrabExclude('xml-apis:xml-apis')
])
but didn't succeed...
Any ideas?
PS: here is the script which creates the error:
#Grapes([
#Grab('org.xhtmlrenderer:core-renderer:R8pre2'),
])
import org.w3c.dom.Document
import javax.xml.parsers.DocumentBuilder
import javax.xml.parsers.DocumentBuilderFactory
def dbf = DocumentBuilderFactory.newInstance()
DocumentBuilder builder = dbf.newDocumentBuilder()
Document doc = builder.parse(new ByteArrayInputStream("<html></html>".getBytes()))
Thanx to #dmahapatro, I checked my configuration and found that I dropped some jars in {usrhome}/.groovy a long time ago. Removed these and now everything work like a charm...

Error - None of the constructors found with 'Orchard.Environment.AutofacUtil.DynamicProxy2.ConstructorFinderWrapper'

I have a custom module, Module1. In this module, I am referencing another custom module, Module2. Everything was working fine last week.
I did a fresh re-install of Orchard this morning. Since then, I have been getting this error.
None of the constructors found with 'Orchard.Environment.AutofacUtil.DynamicProxy2.ConstructorFinderWrapper' on type 'Module1' can be invoked with the available services and parameters: Cannot resolve parameter 'Module2' of constructor 'Void .ctor(...)'.
Any idea how to fix this error?
Thanks.
That means that an implementation of some interface could not be found. Several thing can have happened: a module may have failed to compile, or you forgot to make an interface derive from IDependency.
I know the post is quite old now, but just to link any possible mistake that could cause the described problem... here is my mistake.
I simply forgot to enable the referenced module from the dashboard.
Of course that didn't prevent me to add a project reference and module dependency, having the code compiling perfectly .
The point is, my referenced module doesn't contain any content type definition. It is just a module conceived to collect some functionality and common utilities. That's why I forgot to enable it.
Cheers.
You can get this error if you manually enabled your modules.
If so, fix it by deleting App_Data\cache.dat and then recycle the app pool.
I had the same issue. It seems that I referenced the concrete class and not the interface in my constructor.
public OrderService(
IRepository<Order> orderRepository,
ProductService productService,
ProductCategoryService productCategoryService
)
Instead of
public OrderService(
IRepository<Order> orderRepository,
IProductService productService,
IProductCategoryService productCategoryService
)
checklist is:
Interface derive from IDependency
Implementation derive from Interface
Constructor references the Interface
Build All and check if all referenced modules compile
Enable module in Admin panel
example:
public class myController : Controller{
private readonly IMyService _myService;
public myController(
IMyService myService
) {
_myService = myService;
}
}
public interface IMyService : IDependency
{
int GetOne();
}
public class MyService: IMyService
{
public MyService()
{ // init code }
public int GetOne()
{ return 1; }
}

Resources