I'm trying to use Stanford CoreNLP (which is a Java project) in C#.
I found this Nuget package which contains CoreNLP converted to .NET using IKVM, and it's working fine, however I need to do some modifications on the java project as well.
I downloaded CoreNLP from Github, I can build the CoreNLP JAR from Ant, and it's also running fine in eclipse, however I'm having problems in converting JAR to DLL. Based on some build-log that I found in google, I'm doing this:
ikvmc.exe -version:2.1 ..\lib\joda-time.jar -out:joda-time.dll
ikvmc.exe -r:joda-time.dll -version:0.4.7 ..\lib\jollyday-0.4.7.jar -out:jollyday.dll
ikvmc.exe -version:0.23 ..\lib\ejml-0.23.jar -out:ejml-0.23.dll
ikvmc.exe -version:1.2.10 ..\lib\xom-1.2.10.jar -out:xom.dll
ikvmc.exe -version:1.0 ..\lib\javax.json.jar -out:javax.json.dll
ikvmc.exe -r:joda-time.dll -r:jollyday.dll -r:ejml-0.23.dll -r:xom.dll -r:javax.json.dll -version:3.5.0 ..\javanlp-core.jar -out:javanlp-core.dll
All I get from the following conversions are a few warnings about referenced classed that can't be found:
warning IKVMC0100: Class "org.apache.xerces.parsers.SAXParser" not found
warning IKVMC0100: Class "junit.framework.TestCase" not found
warning IKVMC0100: Class "org.apache.xerces.impl.Version" not found
...
warning IKVMC0100: Class "junit.framework.TestCase" not found
warning IKVMC0100: Class "javax.servlet.http.HttpServlet" not found
warning IKVMC0100: Class "javax.servlet.Filter" not found
warning IKVMC0100: Class "com.google.protobuf.Descriptors$FileDescriptor$InternalDescriptorAssigner" not found
warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage$Builder" not found
warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage" not found
warning IKVMC0100: Class "com.google.protobuf.MessageOrBuilder" not found
warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage$ExtendableBuilder" not found
warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage$ExtendableMessage" not found
warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage$ExtendableMessageOrBuilder" not found
warning IKVMC0100: Class "com.google.protobuf.Internal$EnumLiteMap" not found
warning IKVMC0100: Class "com.google.protobuf.ProtocolMessageEnum" not found
warning IKVMC0100: Class "junit.framework.TestSuite" not found
warning IKVMC0100: Class "junit.framework.Assert" not found
warning IKVMC0100: Class "com.apple.eawt.ApplicationAdapter" not found
warning IKVMC0100: Class "org.junit.Assert" not found
warning IKVMC0100: Class "org.apache.lucene.analysis.core.KeywordAnalyzer" not found
warning IKVMC0100: Class "org.apache.lucene.index.IndexWriterConfig" not found
warning IKVMC0100: Class "org.apache.lucene.util.Version" not found
warning IKVMC0100: Class "org.apache.lucene.store.FSDirectory" not found
warning IKVMC0100: Class "org.apache.lucene.index.DirectoryReader" not found
warning IKVMC0100: Class "org.apache.lucene.search.IndexSearcher" not found
warning IKVMC0100: Class "org.apache.lucene.search.BooleanQuery" not found
warning IKVMC0100: Class "org.apache.lucene.search.BooleanClause" not found
warning IKVMC0100: Class "org.apache.lucene.search.TermQuery" not found
warning IKVMC0100: Class "org.apache.lucene.index.Term" not found
warning IKVMC0100: Class "org.apache.lucene.search.BooleanClause$Occur" not found
warning IKVMC0100: Class "org.apache.lucene.search.TopDocs" not found
warning IKVMC0100: Class "org.apache.lucene.search.ScoreDoc" not found
warning IKVMC0100: Class "org.apache.lucene.document.Document" not found
warning IKVMC0100: Class "org.apache.lucene.index.IndexWriter" not found
warning IKVMC0100: Class "org.apache.lucene.queryparser.classic.ParseException" not found
warning IKVMC0100: Class "org.apache.lucene.document.StringField" not found
warning IKVMC0100: Class "org.apache.lucene.document.Field$Store" not found
warning IKVMC0100: Class "org.apache.lucene.document.Field" not found
warning IKVMC0100: Class "org.apache.lucene.search.Query" not found
warning IKVMC0100: Class "org.apache.lucene.store.Directory" not found
warning IKVMC0100: Class "org.apache.lucene.index.CheckIndex" not found
warning IKVMC0100: Class "org.apache.lucene.index.CheckIndex$Status" not found
warning IKVMC0100: Class "org.apache.lucene.store.NIOFSDirectory" not found
warning IKVMC0100: Class "org.apache.lucene.util.BytesRef" not found
warning IKVMC0100: Class "org.apache.lucene.index.IndexReader" not found
warning IKVMC0100: Class "com.google.protobuf.Descriptors$FileDescriptor" not found
warning IKVMC0100: Class "com.google.protobuf.Descriptors$Descriptor" not found
warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage$FieldAccessorTable" not found
warning IKVMC0100: Class "com.google.protobuf.Descriptors" not found
warning IKVMC0100: Class "junit.framework.AssertionFailedError" not found
warning IKVMC0100: Class "org.apache.lucene.document.FieldType" not found
P.S.: I also tried converting protobuf.jar, but didn't help with the problem described below.
Problem is: when I replace the Nuget references for my freshly-compiled references (6 dlls), it compiles fine (finds all references), but throws this MissingMethodException: Additional information: Method not found: 'Void edu.stanford.nlp.pipeline.StanfordCoreNLP..ctor(java.util.Properties)'.
Can anyone shed some light?
I guess I figured it out. Here is what fixed:
Removed Nuget Package IKVM 8.0.5449.1
Installed Nuget Package IKVM 8.0.5449.0 (which was the version I was using for converting my JAR files)
Clean and rebuild.
If I understand correctly, the ikvmc.exe I used to convert my JAR files must be the same version of the referenced runtime DLLs.
Related
I am using weblogic version 12c 12.1.3 and I have updated the log4j jar version to log4j-api:2.17.1 log4j-core:2.17.1, but at the time of deployment in weblogic I am getting this error :-
weblogic.application.ModuleException: java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of weblogic/utils/classloaders/ChangeAwareClassLoader) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for the method's defining class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature
at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:216)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:211)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
Truncated. see log file for complete stacktrace
Caused By: java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of weblogic/utils/classloaders/ChangeAwareClassLoader) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for the method's defining class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:273)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254)
Any solution on this ?
I have this in my weblogic.xml file. Not sure if this will fix your problem but worth a try...
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
...
<container-descriptor>
<prefer-application-packages>
<package-name>org.slf4j.*</package-name>
<package-name>org.springframework.*</package-name>
</prefer-application-packages>
<prefer-application-resources>
<resource-name>org/slf4j/impl/StaticLoggerBinder.class</resource-name>
</prefer-application-resources>
</container-descriptor>
</weblogic-web-app>
You need to check maven dependencies. It is highly probable to have an indirect dependency for old slf4j-api
Error: Could not find or load main class org.elasticsearch.tools.java_version_checker.JavaVersionChecker
Caused by: java.lang.ClassNotFoundException: org.elasticsearch.tools.java_version_checker.JavaVersionChecker
When i run bin/elasticsearch command on my terminal i got this error.
Don't know how to fix this issue.
Please help us to resolve the below issue.
The following is the issue we are facing, when we are building the interface via Maven command(mvn clean package).
Can you please try to help on this issue?
java.lang.RuntimeException:
org.mule.api.config.ConfigurationException: Configuration problem:
Failed to import bean definitions from URL location
[classpath:common-config.xml]
Offending resource: URL [file:C:/AnypointStudio/projectname/src/test/munit/new-test-suite.xml];
nested exception is
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Unable to locate NamespaceHandler for namespace
[http://www.mulesoft.org/schema/mule/spring-security]
Offending resource: class path resource [common-config.xml] (org.mule.api.lifecycle.InitialisationException)
at org.mule.munit.runner.mule.SuiteRunner.(SuiteRunner.java:59)
at org.mule.munit.runner.mule.SuiteRunner.(SuiteRunner.java:45)
at org.mule.munit.remote.RemoteRunner.runTestSuite(RemoteRunner.java:75)
at org.mule.munit.remote.RemoteRunner.run(RemoteRunner.java:55)
at org.mule.munit.remote.RemoteRunner.main(RemoteRunner.java:39)
Caused by: org.mule.api.config.ConfigurationException: Configuration problem: Failed to import bean definitions from URL
location
Offending resource: URL [file:/C: Projectname/new-test-suite.xml]; nested exception is
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Unable to locate NamespaceHandler for namespace
[http://www.mulesoft.org/schema/mule/spring-security]
I got the solution by adding jersey dependency in pom.xml
Thanks for your time , who look into issue
I have some JUnit (4.10) tests configure using Spring (3.1.3) like this:
#RunWith(SpringJUnit4ClassRunner.class)
#ContextConfiguration(classes=TestConfig.class)
public class MyTest {...}
These run fine from within Eclipse, but with Maven (surefire) from the command-line it fails to find the TestConfig class. I used to have the same configuration using xml based configuration and that worked fine in both cases. I have verified that TestConfig.class is in the expected location in test-classes. I also tried to move it to classes in case the context loader didn't look in test-classes, but no luck. Any ideas?
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)
...
Caused by: java.io.FileNotFoundException: class path resource [com/test/TestConfig.class] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:157)
at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:49)
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:101)
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:76)
at org.springframework.context.annotation.ConfigurationClassParser.findAllAnnotationAttributes(ConfigurationClassParser.java:282)
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:225)
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:148)
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:134)
Update
I had <forkMode>never</forkMode> for the maven-surefire-plugin.
Setting <forkMode>once</forkMode> (default) made the problem go away.
i am deploying application(spring-hibernate) in tomcat6 but it is giving error-
ERROR org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to load bean class: com.myPackage.myProject.calendar.bpo.BusinessDirectoryBPOImpl; nested exception is java.io.FileNotFoundException: class path resource [com/myPackage/framework/bpo/BaseBPOImpl.class] cannot be opened because it does not exist
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:180)
......
all jar files are already in \WEB-INF\lib*.jar.
am i missing any class file or any jar file.
how to solve this error.
Thanks
Yugal
com.myPackage.myProject.calendar.bpo.BusinessDirectoryBPOImpl is looking for
com/myPackage/framework/bpo/BaseBPOImpl.class
which it cannot find.
Check for sure if this specific class is present under WEB-INF\lib in a jar or WEB-INF\classes as a class file.