Tag Archives: jar

[Solved] IDEA jar Pack Error: java.lang.NoSuchMethodError: org.yaml.snakeyaml.nodes.ScalarNode.getScalarStyle

It is said on the Internet that it is a jar package conflict, so I intend to open the dense Maven dependency graph through the dependencies of idea to find clues.

As a result, the direct persuasion was too complicated;

17:22:00.943 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.NoSuchMethodError: org.yaml.snakeyaml.nodes.ScalarNode.getScalarStyle()Lorg/yaml/snakeyaml/DumperOptions$ScalarStyle;
	at org.springframework.boot.env.OriginTrackedYamlLoader$KeyScalarNode.<init>(OriginTrackedYamlLoader.java:124)
	at org.springframework.boot.env.OriginTrackedYamlLoader$KeyScalarNode.get(OriginTrackedYamlLoader.java:135)
	at org.springframework.boot.env.OriginTrackedYamlLoader$KeyScalarNode.get(OriginTrackedYamlLoader.java:130)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)

Later, by clicking the code link in the console error prompt, you can directly choose to go to the jar package to see the code, and immediately find the two jar packages to do things again.

found a conflict between the selenium-server-standale-3.141.59.jar and the core package in Springboot.

This is still in vue’s node_modules

/Users/dairy/StudioProjects/mogu_blog_v2/vue_mogu_web/node_modules/selenium-server/lib/runner/selenium-server-standale-3.141.59.jar

delete it and this error will be solved.

[Solved] SpringBoot Project Package to jar Error: ClassNotFound…

After the springboot project is packaged as a jar, it is reported to find the main method, classnotfound

Add the following plug-in to the POM of the modules that report the error.

    <build>
       <plugins>
           <!-- If you don't add this parameter to the jar package, it will report that the main method was not found. -->
           <plugin>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-maven-plugin</artifactId>
               <version>2.4.1</version>
               <configuration>
                   <includeSystemScope>true</includeSystemScope>
                   <mainClass>cn.vantee.EurekaServerStarter7001</mainClass>
               </configuration>
               <executions>
                   <execution>
                       <goals>
                           <goal>repackage</goal>
                       </goals>
                   </execution>
               </executions>
           </plugin>
       </plugins>
    </build>

[Solved] JVM Error: Failed to write core dump. Core dumps have been disabled.(jar was Forced to Exit)

JVM reports an error: failed to write core dump. Core dumps have been disabled

In the high concurrency big data scenario, the Linux server reports an error fork: retry: the resource is temporarily unavailable
the JVM will generate an HS_err_Pid74299.log log log files like this

By default, the core file size of the Linux service is set to 0. This parameter needs to be adjusted, but this parameter does not solve the problem;

The root cause of the problem is that the maximum number of open files and the maximum number of processes of the running application of the server are relatively small, and the default is 4096

The following configuration needs to be modified:

vi /etc/security/limits.conf

* soft nofile 327680
* hard nofile 327680
hdfs soft nproc 131072
hdfs hard nproc 131072
mapred soft nproc 131072
mapred hard nproc 131072
hbase soft nproc 131072
hbase hard nproc 131072
zookeeper soft nproc 131072
zookeeper hard nproc 131072
hive soft nproc 131072
hive hard nproc 131072
root soft nproc 131072
root hard nproc 131072

What if Maven warehouse has a jar package or reports an error?

This usually occurs when jars cannot be downloaded automatically

1、 Download other files outside the jar package and put them in the corresponding path of the warehouse:

 

Click View all to download other files and put them in the warehouse

 

2、 In this way, the corresponding jar package files of the warehouse will be complete. If the error is still reported, please check whether one is missing_Remote.repositories file

 

No, just copy one under another jar file and modify it accordingly: fastdfs-client-java-1.27-release corresponds to your jar package name

#NOTE: This is an Aether internal implementation file, its format can be changed without prior notice.
#Sat Dec 22 16:08:05 CST 2018
fastdfs-client-java-1.27-RELEASE.jar>central=
fastdfs-client-java-1.27-RELEASE.pom>central=

maven21047; <23601;

[Solved] Jar Convert to Dex Error: bad class file magic (cafebabe) or version

When doing dynamic loading, one step is to convert jar into DEX, using the DX tool. Before, it was normal for the project to generate jar package on eclipse and convert it to DX. However, recently, the project was migrated to Android studio and the jar generated reported bad class file magic (cafebabe) or Version (0033.0000) error in converting DX

After a search on the Internet, the reason is that the JDK version of the jar package is different from that of the DX JDK. The solution is also given to reduce the java file version

javac -source 1.6 -target 1.6 xx.Java

But it doesn’t apply to me, because I have hundreds of java files that need to be reduced, and the JDK version on Android studio is the latest 1.8. Therefore, it is speculated that there will be a solution starting from the JDK used by DX. My DX tool was downloaded from the Internet. Before, I only knew how to use it. I didn’t know what was in it. The zip package only contained dx.bat and dex.jar. There is a sentence in dx.bat:

set jarfile=dx.jar

Moreover, the following command is to call DX. Jar. Since only JDK1.8 is installed on the computer, the Java version obtained through the environment variable must also be this. The only possibility is that DX. Jar is too old. Find the latest version of DX replacement in build tools in the SDK directory, test it, normal

And then we found the same solution on stack overflow

The Java – jar *. Jar prompt in CMD is unable to access jarfile *. Jar or windows can’t double-click to run jar file. What should I do

Front end developers must read! Starting from scratch, teach you to build a low code website platform in stages>>>

1. Switch to the directory of the target file, and then run Java – jar

2. After confirming the installation of Java virtual machine, double-click the jar file to be run or right-click the jar file, and select “open mode” → “select default program” in the pop-up menu

3. In the “open mode” setting window, click the check box before the option “always use the selected program to open this file”, and then click the “Browse” button next to it

4. Select the installation folder of Java virtual machine. If Java 7 is installed, the installation folder is generally “C:: program files?Java?Jre7?Bin” (please find the specific folder yourself). Find the javaw.exe file and click the “open” button

5、

At this time, it has been set to use the javaw.exe application to open the jar file, but in fact, there is no response when double clicking the jar file. This is because the open file parameter is not set

Enter “regedit” in the search box of the windows start menu, right-click the file regedit found above, and select “run as administrator” in the pop-up menu

6. In the registry editor, find “HKEY”_ CLASSES_ In the file open command, add the parameter “- jar” (without quotation marks), and the modified value is similar to: “C: program files, Java: jre7, Bin: javaw. Exe” – jar% 1 “(only need to add – jar parameter, no need to modify other information). Save and exit the registry editor

Intellij Pack the jar file error: “java.lang.SecurityException: Invalid signature file digest for Manifest main attrib

Here are the steps to use IntelliJ to package jar files, and then there will be errors encountered when running jar files

Packaging is complete

==========================================================================

Problems in running jar:

1. Main class not found. Open jar package, add main class: package name. Class name in manifest.mf file

Note: there is a space in front of the package name, and the class name has no. Java or. Class suffix. Finally, be sure to return to the next line. Position the cursor on a blank line

Open

2、java.lang.SecurityException: Invalid signature file digest for Manifest main attributes

Open meta-inf directory and delete *. SF, *. DSA, *. RSA files. Some packages should be signed, causing an error (parent test is feasible on December 15, 2019)

Some problems encountered in packaging with meaven

Start packaging with the following code

<build>
        <!-- mvn assembly:assembly -Dmaven.test.skip=true -->
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2-beta-5</version>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>com.fxc.rpc.impl.member.MemberProvider</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>assembly</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

As a result, an error occurred that the spring namespace could not be found

org.xml.sax.SAXParseException: schema_reference.4: 无法读取方案文档 'http://www.springframework.org/schema/beans/spring-beans.xsd', 原因为 1) 无法找到文档; 2) 无法读取文档; 3) 文档的根元素不是 <xsd:schema>。

According to the investigation, each jar of spring core and spring AOP contains a set of spring.handlers and spring.schemas files, so that they are covered in the packaging process. It is not found on the Internet how to solve this problem by using the Maven assembly plugin plug-in. Most people suggest using the Maven shade plugin plug-in. After modification, the POM code is as follows

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>1.4</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                <transformers>
                    <transformer
                        implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                        <resource>META-INF/spring.handlers</resource>
                    </transformer>
                    <transformer
                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                        <mainClass>com.fxc.rpc.impl.member.MemberProvider</mainClass>
                    </transformer>
                    <transformer
                        implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                        <resource>META-INF/spring.schemas</resource>
                    </transformer>
                </transformers>
            </configuration>
        </execution>
    </executions>
</plugin>

 

Package again, the file signature is illegal

Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes

Check again, it turns out that due to the repeated references of some packages, there are more *. SF, *. DSA, *. RSA files in the directory of meta-inf after packaging (it is said that decompressing the jar package, deleting these files, and packaging again, the error will disappear, unconfirmed). Modify pom.xml again, and finally use the following configuration file to run

mvn clean install -Dmaven.test.skip=true

Packaged successfully

 

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>1.4</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <filters>
                            <filter>
                                <artifact>*:*</artifact>
                                <excludes>
                                    <exclude>META-INF/*.SF</exclude>
                                    <exclude>META-INF/*.DSA</exclude>
                                    <exclude>META-INF/*.RSA</exclude>
                                </excludes>
                            </filter>
                        </filters>

                        <transformers>
                            <transformer
                                implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                <resource>META-INF/spring.handlers</resource>
                            </transformer>
                            <transformer
                                implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>com.fxc.rpc.impl.member.MemberProvider</mainClass>
                            </transformer>
                            <transformer
                                implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                <resource>META-INF/spring.schemas</resource>
                            </transformer>
                        </transformers>
                    </configuration>
                </execution>
            </executions>
        </plugin>

 

At this point, if you look in the target directory, you will find xxx.jar and original-xxx.jar. The latter does not contain the referenced jar package. Just run the former directly

java -jar target/xxx.jar

Success

PS: several companies’ own jars are used in the project, but they are not in the public library. When running in eclipse, I always modify the scope to system and call the local jars. However, during the packaging process, the jars of scope = system will not be entered by myself, which makes me very depressed. I have to say that these jars are installed in the local resource library

mvn install:install-file -Dfile=my-jar.jar -DgroupId=org.richard -DartifactId=my-jar -Dversion=1.0 -Dpackaging=jar

Java.lang.classnotfoundexception: com.mysql.cj.jdbc.driver can’t find jar package, path problem

Open source software supply chain lighting plan, waiting for you>>>

1. Reference connection:

   https://blog.csdn.net/huangbiao86/article/details/6428608

After tossing all morning, I found out the cause of the mistake. Ah… Tragedy

Confirm that the package has been imported into the web project directory

It turned out that Tomcat could not find the MySQL jar package. Later, I imported mysql-connector-java-5.1.7-bin.jar into Tomcat’s lib directory, and it was OK. Hey

In Java project, you only need to introduce mysql-connector-java-5.1.7-bin.jar to run java project

In Web project, when class. Forname (“OM. Mysql. JDBC. Driver”); MyEclipse doesn’t look for strings or drivers. So just copy mysql-connector-java-5.1.7-bin.jar to Tomcat’s lib directory

Run jar file under Linux system, prompt: no main manifest attribute, in xxx.jar [How to Solve]

When executing Java – jar xxx.jar com.helloworld under Linux system, you will often be prompted: no main manifest attribute, in xxx.jar

The reasons are as follows:

Normally, when Java is packaged as a jar package, you need to specify the main class item in manifest.mf to find the corresponding main class when running Java – jar xxx.jar. Because – jar means that the following jar package has a main class to run independently, you need to specify this class when you package it into a jar package

If you want to specify the class you want to run at runtime, you should use – CP/– classpath to specify it. The command is as follows:
for example: Java – CP xxx.jar com.helloworld

Packaging can also be specified in the following way to directly run the jar file Java – jar XXX. Jar

<plugins>
    <!-- When packaging the jar file, configure the manifest file and add the jar dependencies of the lib package -->
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.6</version>
        <configuration>
            <classesDirectory>target/classes/</classesDirectory>
            <archive>
                <manifest>
                    <mainClass>com.alibaba.dubbo.container.Main</mainClass>
                    <!-- Timestamped version not recorded in MANIFEST.MF file when packing -->
                    <useUniqueVersions>false</useUniqueVersions>
                    <addClasspath>true</addClasspath>
                    <classpathPrefix>crm-lib/</classpathPrefix>
                </manifest>
                <manifestEntries>
                    <Class-Path>.</Class-Path>
                </manifestEntries>
            </archive>
        </configuration>
    </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
            <execution>
                <id>copy-dependencies</id>
                <phase>package</phase>
                <goals>
                    <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                    <type>jar</type>
                    <includeTypes>jar</includeTypes>
                    <outputDirectory>
                        ${project.build.directory}/crm-lib
                    </outputDirectory>
                </configuration>
            </execution>
        </executions>
    </plugin>
</plugins>

javafx:JavaFX Scene Builder 2.0 open the fxml file containing the third party jar package and report an error caused by: java.lang.classnotfoundexception

Error:


java.io.IOException: javafx.fxml.LoadException:
/C:/User……………..test.fxml

at com.oracle.javafx.scenebuilder.kit.fxom.FXOMLoader.load(FXOMLoader.java:92)
at com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument.<init>(FXOMDocument.java:80)
at com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument.<init>(FXOMDocument.java:95)
at com.oracle.javafx.scenebuilder.kit.editor.EditorController.updateFxomDocument(EditorController.java:2370)
at com.oracle.javafx.scenebuilder.kit.editor.EditorController.setFxmlTextAndLocation(EditorController.java:655)
at com.oracle.javafx.scenebuilder.app.DocumentWindowController.loadFromFile(DocumentWindowController.java:386)
at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.performOpenFiles(SceneBuilderApp.java:579)
at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.handleOpenFilesAction(SceneBuilderApp.java:447)
at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.handleLaunch(SceneBuilderApp.java:427)
at com.oracle.javafx.scenebuilder.app.AppPlatform.requestStartGeneric(AppPlatform.java:139)
at com.oracle.javafx.scenebuilder.app.AppPlatform.requestStart(AppPlatform.java:106)
at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.start(SceneBuilderApp.java:371)
at com.sun.javafx.application.LauncherImpl$8.run(LauncherImpl.java:837)
at com.sun.javafx.application.PlatformImpl$7.run(PlatformImpl.java:335)
at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:301)
at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:298)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:298)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)
at java.lang.Thread.run(Thread.java:744)
Caused by: javafx.fxml.LoadException:
/C:/User……………..test.fxml

at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2617)
at javafx.fxml.FXMLLoader.importClass(FXMLLoader.java:2864)
at javafx.fxml.FXMLLoader.processImport(FXMLLoader.java:2708)
at javafx.fxml.FXMLLoader.processProcessingInstruction(FXMLLoader.java:2677)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2517)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2425)
at com.oracle.javafx.scenebuilder.kit.fxom.FXOMLoader.load(FXOMLoader.java:89)
… 22 more
Caused by: java.lang.ClassNotFoundException: de……………….(Third-party package files)
at java.lang.ClassLoader.findClass(ClassLoader.java:530)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at javafx.fxml.FXMLLoader.loadTypeForPackage(FXMLLoader.java:2932)
at javafx.fxml.FXMLLoader.loadType(FXMLLoader.java:2921)
at javafx.fxml.FXMLLoader.importClass(FXMLLoader.java:2862)
… 27 more


Put the third-party jar package into the JavaFX Scene Builder 2.0 installation directory as shown in the picture, and add the third-party jar package in the app.classpath= line in the package.cfg file