Error occurred during initialization of boot layer - Eclips 2020-06 - java

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.

Related

quarkus dev build failes with customized outputDirectory in pom.xml of dependend module

I started with a quarkus multi maven-module project and encountered the following problem when starting quarkus in the dev mode (mvn quarkus:dev) to support hot reload for depended modules' classes:
A module "my-app" configures its' build output path via the
<project><build><outputDirectory>build</outputDirectory> in the pom.xml. The module is build successfully, and the output exists in path my-app/build instead of the default target/classes.
Then the build of another module "momsServerQuarkus", which depends on the "my-app", and which uses quarkus-maven-plugin, fails with error:
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:2.11.0.Final:dev (default-cli) on project momsServerQuarkus: Failed to run: Hot reloadable dependency de.kwsoft.moms:my-app:6.14.0-SNAPSHOT has not been compiled yet (the classes directory S:\trunk\moms\my-app\target\build does not exist)
As visible in the error message, the <outputDirectory>build</outputDirectory>is read correctly from the my-apps' pom.xml, but is appended to the default output path "target" instead of the projects root folder. I played also variables, e.g. <outputDirectory>${basedir}/build</outputDirectory>, but the variable is not resolved by the quarkus-maven-plugin.
Does anyone know how this could be solved, or whether this could be a bug?
Thank you in advance.

IntelliJ showing extra name in the project structure

I am using IntelliJ IDEA 2020.1.4. when I create a module or import a module it is adding extra details in the project details. The extra name appears in the artifact while creating a project from Spring boot Initializer.
I am using Gradle, in the Gradle the name are seems fine:
If the module name does not match the project name - the module name is displayed in the brackets. While the other name - is the name of the directory of the module root.

Sonar properties files

I have a project that has the following package structure
src/main/proj
-com.company.package
-appName
-morepackages
-appVersion2
-morepackages
sonar-runner.properties
sonarBuild.sh
sonar-runner-project2.properties
sonarBuildProject2.sh
As it stands, with the default properties file i can run the sonar report and it will generate a review for the whole project
sonar.projectKey=KEY
sonar.projectName=PROJNAME
sonar.projectVersion=1.0
sonar.host.url=someurl
#Path for sonar sources
sonar.sources=src/main/java
#Path for libraries
sonar.libraries=target/lib/*.jar
#Path for binaries
sonar.binaries=target/classes
#--------Default database
sonar.jdbc.url=someurl
sonar.jdbc.driver=com.mysql.jdbc.Driver
#----- Global database settings
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
#----- Default directory layout
sonar.java.source=1.6
sonar.java.target=1.6
sonar.sourceEncoding=UTF-8
Ideally however I would like to separate the two reports so i have one for the original package and one for the appVersion2 package. Now - as mentioned above I have created a separate properties file for each. Should i just point sonar.sources to the respective packages for each job to analyse or is there a better way to do this all in one property file?
Thanks
EDIT
My multi module attempt properties file looks as follows
sonar.projectKey=rootkey
sonar.projectName=rootname
sonar.projectVersion=1.0
sonar.host.url=rooturl
sonar.sources=src/main/java/
sonar.libraries=target/lib/*.jar
sonar.modules=module1,module2
sonar.sourceEncoding=UTF-8
#----- Global database settings
sonar.jdbc.username=user
sonar.jdbc.password=pass
sonar.java.source=1.7
sonar.java.target=1.7
#--------Default database
sonar.jdbc.url=url
sonar.jdbc.driver=com.mysql.jdbc.Driver
module1.sonar.projectName=proja
module2.sonar.projectName=projb
module1.sonar.projectKey=projakey
module2.sonar.projectKey=projbkey
#Path for sonar sources
module1.sonar.sources=src/main/java/app1code
module2.sonar.sources=src/main/java/app2code
#Path for binaries
module1.sonar.binaries=target/classes/app1binaries
module2.sonar.binaries=target/classes/app2binaries
I get an error in the output saying....
Exception in thread "main" org.sonar.runner.RunnerException: org.sonar.runner.RunnerException: The base directory of the module 'module1' does not exist: patthtoapp/module1
at org.sonar.runner.Runner.delegateExecution(Runner.java:288)
at org.sonar.runner.Runner.execute(Runner.java:151)
at org.sonar.runner.Main.execute(Main.java:84)
at org.sonar.runner.Main.main(Main.java:56)
Caused by: org.sonar.runner.RunnerException: The base directory of the module 'module1' does not exist: pathtoapp/module1
at org.sonar.runner.internal.batch.SonarProjectBuilder.setProjectBaseDir(SonarProjectBuilder.java:279)
at org.sonar.runner.internal.batch.SonarProjectBuilder.loadChildProject(SonarProjectBuilder.java:191)
at org.sonar.runner.internal.batch.SonarProjectBuilder.defineChildren(SonarProjectBuilder.java:169)
at org.sonar.runner.internal.batch.SonarProjectBuilder.generateProjectDefinition(SonarProjectBuilder.java:122)
at org.sonar.runner.internal.batch.Launcher.execute(Launcher.java:58)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.sonar.runner.Runner.delegateExecution(Runner.java:285)
You have to specify the projectBaseDir if the module name doesn't match you module directory.
Since both your module are located in ".", you can simply add the following to your sonar-project properties:
module1.sonar.projectBaseDir=.
module2.sonar.projectBaseDir=.
Sonar will handle your modules as components of the project:
EDIT
If both of your modules are located in the same source directory, define the same source folder for both and exclude the unwanted packages with sonar.exclusions:
module1.sonar.sources=src/main/java
module1.sonar.exclusions=app2code/**/*
module2.sonar.sources=src/main/java
module2.sonar.exclusions=app1code/**/*
More details about file exclusion
You can define a Multi-module project structure, then you can set the configuration for sonar in one properties file in the root folder of your project, (Way #1)
Do the build job on Jenkins first without Sonar configured. Then add Sonar, and run a build job again. Should fix the problem

Eclipse/Hibernate tools error: Archive classpath entry doesn't exist

I am trying to setup Hibernate tools – attaching it to the spring petclinic project. So far the problem is in classpath. My actions:
Click on hibernate on the Hibernate Configuration view
Add
postgresql-9.1.jar located in the root directory of the
spring-petclinic project
The result is the error: [Classpath]: Archive classpath entry doesn't exist [/spring-petclinic/postgresql-9.1.jar] ( see http://jboston.net/HIbernateToolsError.jpg for the image)
See also the log:
java.lang.IllegalArgumentException: Path must include project and resource name: /postgresql-9.1.jar
java.lang.IllegalArgumentException: Path must include project and resource name: /postgresql-9.1.jar
at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:2170)
at org.eclipse.core.internal.resources.Container.getFile(Container.java:208)
at org.hibernate.eclipse.console.utils.ProjectUtils.findJavaProjects(ProjectUtils.java:308)
at org.hibernate.eclipse.console.workbench.ProjectCompilerVersionChecker.validateProjectComplianceLevel(ProjectCompilerVersionChecker.java:35)
at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:37)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:100)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:106)
at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:235)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
#Craig Ringer answer helped. My workaround was as follows:
Create the user library with a postgresql jdbc jar
From the Hibernate configuration classpath tab select Advanced on the
right menu
Choose "Add library"
It looks like you've attempted to add the JDBC jar as a required project. Don't. Add it as a library dependency instead.
See this list of ways to do it - unverified, as I thankfully no longer have to use Eclipse anymore.

Issue with ClassPathXmlApplicationContext

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 .

Categories

Resources