Tag Archives: java

[Solved] Error launching IDEA: Failed to create JVM. JVM Path…

Error launching IDEA

This error is actually a modification of the /idea64.exe.vmoptions file, but you add something he can not recognize

Solution:

The solution is very simple to \idea64.exe.vmoptions in your added delete on it!

But note that in case you really do not know what you have added, you can add a pause to the end of the idea.bat file, you can know is not recognized that sentence

Then run it, find it and go to \idea64.exe.vmoptions file to delete it.

As for how to find this file, I learned is in the idea installation path of the bin, and then after a series of operations, even with other people’s configuration directly replace the file did not work, and finally Kung Fu does not bear any responsibility, in my efforts to learn that there is an identical file in the C disk, we need to modify the C disk files

[Solved] java: Internal error in the mapping processor: java.lang.NullPointerException

1. Background description

Project background: IDEA (2020.3)+Springboot (2.1.5. RELEASE) + maven

Error content: java: Internal error in the mapping processor: java.lang.NullPointerException

2. Error cause

The cause of the error has not been found

3. Solutions

When using mapstruct, IDEA version 2020.3 gives an error when building the project: java: Internal error in the mapping processor: java.lang.NullPointerException

Solution: Modify editor configuration

Path: Setting —> Build,Execution,Deployment –> Compiler –> User-local build process VM options (overrides Shared options)

Configuration content: – Djps.track.ap dependencies=false

As shown in the figure below:

end!

kafka Environment Build and Startup Error: ERROR [KafkaServer id=1] Fatal error during KafkaServer startup. Prepare to shutdown

Solution: Modify the configuration file of server.properties as below:

Add these two items to the server.properties configuration file.

listeners=PLAINTEXT://xx.xx.xx.xx(server intranet IP address):9092
advertised.listeners=PLAINTEXT://xx.xx.xx.xx(server external IP address):9092

kafka server fail to startup error:

[2022-09-29 16:04:58,630] ERROR [KafkaServer id=1] Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
org.apache.kafka.common.KafkaException: Socket server failed to bind to 47.100.19.248:9092: Cannot assign requested address.
at kafka.network.Acceptor.openServerSocket(SocketServer.scala:778)
at kafka.network.Acceptor.<init>(SocketServer.scala:672)
at kafka.network.DataPlaneAcceptor.<init>(SocketServer.scala:531)
at kafka.network.SocketServer.createDataPlaneAcceptor(SocketServer.scala:287)
at kafka.network.SocketServer.$anonfun$createDataPlaneAcceptorsAndProcessors$1(SocketServer.scala:267)
at kafka.network.SocketServer.$anonfun$createDataPlaneAcceptorsAndProcessors$1$adapted(SocketServer.scala:261)
at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:62)
at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:55)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:49)
at kafka.network.SocketServer.createDataPlaneAcceptorsAndProcessors(SocketServer.scala:261)
at kafka.network.SocketServer.startup(SocketServer.scala:135)
at kafka.server.KafkaServer.startup(KafkaServer.scala:309)
at kafka.Kafka$.main(Kafka.scala:109)
at kafka.Kafka.main(Kafka.scala)
Caused by: java.net.BindException: Cannot assign requested address
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Net.java:461)
at java.base/sun.nio.ch.Net.bind(Net.java:453)
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:80)
at kafka.network.Acceptor.openServerSocket(SocketServer.scala:774)
… 13 more
[2022-09-29 16:04:58,632] INFO [KafkaServer id=1] shutting down (kafka.server.KafkaServer)

Resin Failed to Startup Error: ERROR: transport error 202: bind failed: Address already in use: JVM_Bind Listenin (Two Resins in One PC)

Error content:

ERROR: transport error 202: bind failed: Address already in use: JVM_Bind Listening for transport dt_socket at addres

The cause of the error is obviously port occupation, but I have clearly changed the app_servers in the resin.properties file to a different port.

The reason
The reason is that I modified the jvm_args in the resin.properties file of one of the resins before in order to allow idea to debug the resin service remotely.

Original content

jvm_args  : -Xmx4000m -Xms4000m -XX:ParallelGCThreads=20 -XX:+UseConcMarkSweepGC -XX:-OmitStackTraceInFastThrow -XX:+UseParNewGC -XX:+DisableExplicitGC -javaagent:wagent.jar -javaagent:stophotdeploy.jar -Djdk.tls.ephemeralDHKeySize=2048 -Dfile.encoding=GBK -javaagent:rasp/rasp.jar

I changed it to

jvm_args  : -Xdebug -Xrunjdwp:transport=dt_socket,address=9081,server=y,suspend=n -Dcom.sun.management.jmxremote -Xloggc:/var/log/resin_gc.log

The other resin service still keeps the original content, so the two services cannot be started, and an error will be reported that the address port is occupied.

 

Solution:

The solution is to configure address= for both resins and set the port differently, or use the original default jvm_args.

Here use the method of configuring address= for both.

The first file.

jvm_args  : -Xdebug -Xrunjdwp:transport=dt_socket,address=9081,server=y,suspend=n -Dcom.sun.management.jmxremote -Xloggc:/var/log/resin_gc.log

Second file

jvm_args  : -Xdebug -Xrunjdwp:transport=dt_socket,address=9082,server=y,suspend=n -Dcom.sun.management.jmxremote -Xloggc:/var/log/resin_gc.log

[Solved] Frida-server Startup Error: syntax error: unexpected‘(‘

Problem description:

An error will be reported after frida-server-15.2.android-arm64.xz is installed, as follows:

�5�5�5�5�: inaccessible or not found
./fs152201[2]: �: inaccessible or not found
./fs152201[80]: syntax error: unexpected '('

Solution:

The correct way is to switch to root privileges first. Then use the following command . /filename. To summarize, there is a problem with the boot method. The correct one is: . /filename

For example.

redfin:/data/local/tmp # . /fs152201

verification:

1: Premise:

1.1: Install the corresponding version of frida on the PC side

pip  install frida
pip install frida-tools

1.2: Check the version of frida. The server should be installed to the matching version

frida –version

2: Start to verify whether the frida-server installation is successful or not. Execute the following commands in the cmd window. If a list appears, it indicates success.

 frida-ps -U

[Solved] o2o Error: addShopImg error:null / character to be escaped is missing

Operating system: Window10

1. During the JUnit test of ShopServiceTest, an error message is reported:addShopImg error:null as follows:

Solution: Modify the configuration information of PathUtil.java.

Check whether the two separators ofprivate static String separator=System. getProperty ("file. separator")are consistent and spelled correctly.

As long as the two separators are consistent and spelled correctly, there will be no null error message

2. The win10 system pops up:addShopImg error: character to be escaped is missing as follows:

Solution: Modify the configuration information of PathUtil.java.

Change all separator in replaceAll to Matcher quoteReplacement(separator)

Finally, the completely correct PathUtil.java source code is attached:

package com.imooc.o2o.util;

import java.util.regex.Matcher;

public class PathUtil {
	private static String separator = System.getProperty("file.separator");
	
	public static String getImgBasePath() {
		String os = System.getProperty("os.name");
		String basePath = "";
		if (os.toLowerCase().startsWith("win")) {
			basePath = "E:/Work/o2o/image";
		} else {
			basePath = "/home/Work/o2o/image";
		}
		basePath = basePath.replaceAll("/", Matcher.quoteReplacement(separator));
		return basePath;
	}
	
	public static String getShopImagePath(long shopId) {
		String imagePath = "upload/item/shop/" + shopId + "/";
		return imagePath.replaceAll("/", Matcher.quoteReplacement(separator));
	}
}

[Solved] Execution failed for task ‘:app:uploadCrashlyticsMappingFileRelease‘

Problem: Recently, when doing a project, an error occurred in the online package of release:

 Execution failed for task ':app:uploadCrashlyticsMappingFileRelease'

 

Reason: This problem is caused by the use of Google’s firebase library, which is the culprit:

com.google.firebase:firebase-crashlytics

 

Solution: Add the following code to Android {} of gradle of app

gradle.taskGraph.whenReady {
    tasks.each { task ->
        if (task.name.contains("uploadCrashlyticsMappingFileRelease")) {
            task.enabled = false
        }
    }
}

Note: this method can only solve this issue temporary, if you know other solutions, please leave a comment and let me know!

[Solved] Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource

Springboot does not specify the “url” property, and cannot configure an embedded data source. Cause: Unable to determine the appropriate driver class

When you open a new springboot project:

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


Action:

Consider the following:
    If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
    If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

First, check whether the yml data source configuration file is correct, account password, etc…

I found that there is no resource file in the target file. A closer look shows that there is no icon in the resource file.

Solution:

Step 1: Select the corresponding item and right-click: Open Module Settings

Step 2: Click in sequence according to the corresponding steps, and finally don’t forget to Apply

If other startup errors fail, you can leave a comment!

[Solved] org.springframework.context.ApplicationContextException: Failed to start bean ‘org.springframework.a

Error

org.springframework .context.ApplicationContextException: Failed to start bean &#39 ;org.springframework.amqp.rabbit.config.internalRabbitListenerEndpointRegistry'; nested exception is org.springframework.amqp.AmqpIllegalStateException: Fatal exception on listener startup

Errors reported when using RabbitMq to test switches and queues

Think hard

At first I thought it was the queue’s listener configuration information and listener code that were written wrong,I checked it repeatedly and there was no error.
Then continue to read the error ,there are these two errors,instant epiphany.

Caused by: org.springframework.amqp.AmqpIllegalStateException: Fatal exception on listener startup
Caused by: org.springframework.amqp. AmqpAuthenticationException: com. rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED

Suddenly realized

ACCESS_REFUSEDSuch a big word, I read it several times, but I didn’t expect this error, It is probably the wrong copy when configuring the password

spring:
  rabbitmq:
    host: 192.168.149.128
    port: 5672
    virtual-host: /hotel
    username: hotel
    password: hotel

hotel was resolutely written as guest

Ok, change the password, successfully run, also warn everyone to be careful!!!

idea Error: Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource

Error:

在这里插入图片描述
Error Message:

APPLICATION FAILED TO START
***************************

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


Action:

Consider the following:
	If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
	If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).


Solution:- [ ] List item
Just check the nacos port and change it to the port used by the project you are running.

How to Solve Image Upload Error: Uncaught (in promise) DOMException: Failed to execute ‘put‘ on ‘IDBObjectStore‘

I encountered a small problem in a recent project,when the system uploads pictures on the front-end page,the background reports 400 errors: Uncaught (in promise) DOMException: Failed to execute ‘put’ on ‘IDBObjectStore ‘: HTMLInputElement object could not be cloned.

Investigation ideas

  1. Analyze from the error 400,http status code is 400,bad request means it is a bad request,invalid hostname means the domain name does not exist. The cause of 400 is generally:
  • The field name or field type of the data submitted by the front-end is inconsistent with the entity class of the back-end, which cannot be encapsulated.
  • The data submitted by the front-end to the back-end should be of json string type, and the front-end has no conversion type.
    Since the back-end interface uses File to receive the picture, the file transmitted by the front-end through the form form, obviously has nothing to do with the parameter type.
  1. So breakpoint debugging at the Controller layer, found that the request did not enter the breakpoint at all, This is a bit strange.
    Roll back the code and repackage it for deployment, This picture can be uploaded normally.
  2. Change my way of thinking to find the answer from the code submission records, I browsed carefully, I found that a colleague submitted a filter, This is a bit relevant, Immediately click in to see the source code. After viewing, it was found that a filter, was added for the POST request, and the file stream was not excluded in the filte, which resulted in the file upload request being directly filtered out.

Solution

Exclude specific requested URLs in SpringBoot filters, example below:

@WebFilter(urlPatterns = "/*")
@Order(value = 1)
public class TestFilter implements Filter {
  
    private static final Set EXCLUDED_PATHS = Collections.unmodifiableSet(new HashSet(
            Arrays.asList("/login", "/register")));
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        //init filter
    }
  
    @Override
    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest request = (HttpServletRequest) req;
        HttpServletResponse response = (HttpServletResponse) res;
        String path = request.getRequestURI().substring(request.getContextPath().length()).replaceAll("[/]+$", "&# 34;);
        boolean excludedPath = EXCLUDED_PATHS.contains(path);
  
        if (excludedPath) {
            // Exclude URLs that do not need filtering
            chain.doFilter(req, res);
        } else {
            // URL that needs to be filtered
            // TODO
        }
    }
  
    @Override
    public void destroy() {
        // destroy filter
    }
}