I having the below code in static method of my main class -
appContext = new ClassPathXmlApplicationContext(new String[] {
"classpath*:/META-INF/spring.xml",
"classpath*:contractbatchupdate-application-context.xml"
});
All the dependencies are specified by Maven. I am trying to run this class in eclipse as a java application and it is throwing the below error. I can see the jar file in the repository that is specified in the path listed in the error.
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [jar:file:/C:/Users/892893/.m2/repository/com/test/contract/Contract-Client/1.0-SNAPSHOT/Contract-Client-1.0-SNAPSHOT.jar!/META-INF/spring.xml]; nested exception is javax.xml.parsers.FactoryConfigurationError: Provider weblogic.xml.jaxp.RegistryDocumentBuilderFactory not found
You might see it in Maven, but the class loader doesn't see it in the CLASSPATH. Believe the exception - check your assumptions. That JAR isn't in the CLASSPATH.
Open up your .classpath file and check if the jar has gotten into your Project . You could also check this in Java-build-path --> Libraries in your eclipse . See your dependency has gotten into the .M2 folder . Check these all out . If the Jar dependency is in the pom and not in your classpath , do a mvn clean eclipse:eclipse, refresh classpath , do a eclipse - project-clean(Build automatically checked) and try .
Related
I am trying to build my quarkus project but it is giving me below expectation, as I am new to it I am not getting exactly what is the problem. Please help me out, I have tried many thing like excluding but nothing works.
2021-02-22 17:36:59,100 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.arc.deployment.ArcProcessor#registerBeans threw an exception: java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
at java.base/sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:336)
at java.base/sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:269)
at java.base/java.util.jar.JarVerifier.processEntry(JarVerifier.java:273)
at java.base/java.util.jar.JarVerifier.update(JarVerifier.java:230)
at java.base/java.util.jar.JarFile.initializeVerifier(JarFile.java:759)
at java.base/java.util.jar.JarFile.getInputStream(JarFile.java:840)
at io.quarkus.bootstrap.classloading.JarClassPathElement$1$1$1.apply(JarClassPathElement.java:123)
at io.quarkus.bootstrap.classloading.JarClassPathElement$1$1$1.apply(JarClassPathElement.java:118)
at io.quarkus.bootstrap.classloading.JarClassPathElement.withJarFile(JarClassPathElement.java:161)
at io.quarkus.bootstrap.classloading.JarClassPathElement.access$100(JarClassPathElement.java:35)
at io.quarkus.bootstrap.classloading.JarClassPathElement$1$1.getData(JarClassPathElement.java:118)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.getResourceAsStream(QuarkusClassLoader.java:332)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.getResourceAsStream(QuarkusClassLoader.java:353)
at io.quarkus.arc.processor.BeanArchives.index(BeanArchives.java:259)
That sounds like you have a signed jar in your dependencies. When this jar is packed in your jar, java cannot verify it. You have to exclude this jar and use it via classpath.
Maybe you also find some useful information in this post: Invalid signature file digest for Manifest main attributes exception while trying to run jar file
For running JTable in Java Swing at Eclips 2020-06, imported rs2xml.jar file. But after that, while running the program, the following error is occurring.
Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for E:\Progrm Learning\JAVA\Student\rs2xml.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: JDOMAbout$Author.class found in top-level directory (unnamed package not allowed in module)
rs2xml.jar contains a class in the default package which is not allowed when using JPMS.
In Project > Properties: Java Build Path, tab Libraries move rs2xml.jar from the Modulepath to the Classpath and in the project, in the source folder, in the default package delete your module-info.java file to not use JPMS.
The answer provided by #howlger works but if after deleting your module-info.java file your
src file gives error then you could start a new project and while creating new project select don't create module-info
Nice question.
rs2xml.jar contains a class in the default package which is not allowed when using JPMS.
In Project > Properties: Java Build Path > Libraries, move rs2xml.jar from the Modulepath to the Classpath.
Then in the project, in the source folder, and in the default package delete your module-info.java file in order to not use JPMS.
I have an issue when I use maven for installing an external jar from SAP.I'm using springboot and I've gotten 2 scenarios with no success.
1- Using maven dependency directly from folder I get an exception and the jar is not added in BOOT-INF/lib folder. But on eclipse the jar is added in Maven Dependency
<dependency>
<groupId>com.sap.conn.jco</groupId>
<artifactId>sapjco3</artifactId>
<version>3.0.19</version>
<scope>system</scope>
<systemPath>/home/eder/workspace/obsekium/TesteSelenium/sapjco3.jar</systemPath>
</dependency>
Caused by: java.lang.NoClassDefFoundError: com/sap/conn/jco/ext/DestinationDataProvider
2- Using "mvn install:install-file" Maven changes jar's name and it causes an exception
Factory method 'sapConector' threw exception; nested exception is java.lang.ExceptionInInitializerError: JCo initialization failed with java.lang.ExceptionInInitializerError: Illegal JCo archive "sapjco3-3.0.19-3.0.19.jar". It is not allowed to rename or repackage the original archive "sapjco3.jar".
How do I solve this issue?
You can try to use the following dependency and check whether it works.
<dependency>
<groupId>com.sap.jco</groupId>
<artifactId>sapjco</artifactId>
<version>3.0.14</version>
</dependency>
You can find the details from the following link.
https://mvnrepository.com/artifact/com.sap.jco/sapjco/3.0.14
If you want, you can download the jar file and you can set the dependency as system path in maven.
Can you please help me with following error I'm facing in WAS9 environment:
In order to resolve the import
org.apache.cxf.binding.soap.SoapHeader
I added the following dependencies in my pom.xml:
cxf-api-2.7.7
cxf-rt-bindings-soap-2.7.7
But when I'm trying to run my application, I'm getting the following error.
Default Executor-thread-7] ([ ]) Controllerclass - org.apache.cxf.bus.extension.ExtensionException
at org.apache.cxf.bus.extension.Extension.load(Extension.java:222)
at org.apache.cxf.bus.extension.ExtensionManagerImpl.loadAndRegister(ExtensionManagerImpl.java:199)
at org.apache.cxf.bus.extension.ExtensionManagerImpl.initialize(ExtensionManagerImpl.java:118)
at org.apache.cxf.bus.extension.ExtensionManagerBus.doInitializeInternal(ExtensionManagerBus.java:147)
at org.apache.cxf.bus.CXFBusImpl.initialize(CXFBusImpl.java:191)
at com.ibm.ws.jaxws.bus.LibertyApplicationBusFactory.createBus(LibertyApplicationBusFactory.java:119)
at com.ibm.ws.jaxws.bus.LibertyApplicationBusFactory.createClientScopedBus(LibertyApplicationBusFactory.java:86)
at com.ibm.ws.jaxws.metadata.JaxWsClientMetaData.<init>(JaxWsClientMetaData.java:28)
at com.ibm.ws.jaxws.metadata.JaxWsModuleMetaData.getClientMetaData(JaxWsModuleMetaData.java:123)
at com.ibm.ws.jaxws.support.JaxWsMetaDataManager.getJaxWsClientMetaData(JaxWsMetaDataManager.java:84)
at com.ibm.ws.jaxws.support.JaxWsMetaDataManager.getJaxWsClientMetaData(JaxWsMetaDataManager.java:123)
at com.ibm.ws.jaxws.client.LibertyProviderImpl.createServiceDelegate(LibertyProviderImpl.java:56)
at javax.xml.ws.Service.<init>(Service.java:57)
Caused by: java.lang.InstantiationException:org.apache.cxf.bus.osgi.OSGIBusListener
at java.lang.Class.newInstance(Class.java:427)
at org.apache.cxf.bus.extension.Extension.load(Extension.java:218)
Caused by: java.lang.NoSuchMethodException:org.apache.cxf.bus.osgi.OSGIBusListener.<init>()
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.newInstance(Class.java:412)
The server where your WAS9 has been deployed has different version of the above jar file. You need to have same version of jar files both in your eclipse where you have developed your codes and the server where you are deploying the war or ear.
mavan dependency file pom.xml is used during your project compilation. It might add the jar in your binary under lib folder as well. But WAS9 might considering the one which is in server's CLASSPATH. Hence check your class path and replace that jar with the one which you have mentioned in your pom.xml file. Hope that will fix your issue.
We can eliminate this exception by adding webProfile-7.0 in our server.xml, but how ever this is not working with javaee-7.0 not sure, if one knows about how to handle this in javaee-7.0 please share your approach.
Summary: I have a very basic Java 1.8 and Spring 4.0.5 project, I'm using Maven 3.2.3 to manage it. Maven exec cannot seem to see my Spring context, even though it appears to me that it is in the classpath.
My spring context is in
<project root>/src/main/resources/spring/ch2-beans.xml
and I load it using:
ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("/spring/ch2-beans.xml");
after a "mvn clean compile" I see
<project root>/target/classes/spring/ch2-beans.xml
and when I run:
mvn -X exec:java -Dexec.mainClass="com.wiley.beginning.spring.ch2.Main"
I see the following debug output which makes me think the classpath is indeed correct:
[DEBUG] Collected project classpath [/Users/me/Documents/workspace/BeginningSpring/chapter2/spring-book-ch2/target/classes]
[DEBUG] Adding to classpath : file:/Users/me/Documents/workspace/BeginningSpring/chapter2/spring-book-ch2/target/classes/
Yet I get the following error:
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [spring/ch2-beans.xml]; nested exception is java.io.FileNotFoundException: class path resource [spring/ch2-beans.xml] cannot be opened because it does not exist
Can anyone point me in the direction of sorting this out? What I've posted above is the result of many different attempts to solve this, and I'm stumped by the error when it certainly appears that the file path should be in the classpath, so perhaps this is something that has changed since I last coded (a while ago..). Thanks!
Update..
Thinking that it might be some classpath issue with exec:java I ran the same code inside a unit test, executed within maven. Same error. I've also tried loading the xml file as "classpath:/spring/ch2-beans.xml", did not fix it.
There was a hyphen in the file name of the Spring configuration I was trying to load, and it appears that the classloader won't accept that. Hyphens are illegal in identifier names in Java, apparently this applies also to external resources.
Once I removed the hyphen from the xml file name, it was found.
On a related note, I'm pretty annoyed with the "Beginning Spring" book example which uses these hyphenated names.