T omcat:removeGeneratedFiles Failed to delete the generated java file solution

Questions

Phenomenon

        Tomcat service startup: JSP page returns 404 phenomenon

Log analysis

02-jun-2021 16:17:30.174 warning [http-nio-8080-exec-14] org.apache.jasper.compiler.compiler.removegeneratedfiles failed to delete the generated java file [E:// cloudvos/apache-tomcat-9.0.39-windows-x64/apache-tomcat-9.0.39/work/Catalina/localhost/CS/org/Apache/JSP/Web]_ 002dINF\views\modules\ri\communityList_ jsp.java]

solve

         File permissions caused by the problem, delete all cache files

Delete the contents of apache-tomcat-9.0.7

Delete the contents of apache-tomcat-9.0.7

The browser requires that samesite by default cookies be disabled

Some websites require that the default in samesite be set to disabled

However, into the browser’s flag page found that there is no problem   Samesite by default cookies because the kernel update page has changed

Solution:

1. Find the browser shortcut and right-click properties

2. Add in the target column

--disable-features=SameSiteByDefaultCookies,CookiesWithoutSameSiteMustBeSecure

 
3. Restart the browser and you will find that it is OK

 
be careful

It is said that this method is invalid after chrome kernel 94 +

 
 

Syntax error in Vue ie10 browser

“29616;” 38169;”35823;”

SyntaxError -2146827286

 

@babel/polyfill

e.g. install –save @babel/polyfill

Main.js

import’@babel/polyfill’

 

“21442;” 32771;”38142;” 255091;

https://www.cnblogs.com/yalong/p/9988615.html

 

Tensorflow ValueError: Failed to convert a NumPy array to a Tensor

    Recently, I’m learning to build tensorflow and keras. There are always all kinds of errors. Thank you very much for your experience. I will see how you solve the problem every time. Of course, some solutions have been tried and found not to work, so we have to continue to look for solutions.

      I will share with you the problems I have encountered and the final solution. In the process, I should refer to the content shared by many predecessors. As a knowledge transmitter, I hope my sharing and summary can also help you.

     


ValueError: Failed to convert a NumPy array to a Tensor

      Thanks to bloggers for solving this problem( https://blog.csdn.net/weixin_ 39653948/article/details/105132995).

Error reason: before training the model, the training samples and test samples were not converted into data types acceptable to tensorflowh and keras.

resolvent:

x_train=x_train.astype('float64')
x_test=x_test.astype('float64')

    The error is removed and the program is running normally.

    Thanks again for sharing.

 

Alfred: How to integrat iterm2

The part of Alfred’s workflow that involves shell uses the system terminal by default. By modifying the configuration, you can call item.

Iterm version: 3.0.11   Theoretically, 2.9 + is OK.

Alfred -> Feature -> Terminal -> Change the application to custom. A code box appears below, and paste the following script.

I’m used to this script. Every time, I will split a column on the right side of the current small window as a new window and execute the incoming command.

If you don’t like it, you can modify it yourself http://www.iterm2.com/documentation-scripting.html

 

on alfred_script(q)
	if application "iTerm2" is running or application "iTerm" is running then
		run script "
			on run {q}
				tell application \":Applications:iTerm.app\"
					activate
					try
						select first window
						set onlywindow to false
					on error
						create window with default profile
						select first window
						set onlywindow to true
					end try
					tell current session of the first window
						if onlywindow is false then
							tell split vertically with default profile
								write text q
							end tell
						end if
					end tell
				end tell
			end run
		" with parameters {q}
	else
		run script "
			on run {q}
				tell application \":Applications:iTerm.app\"
					activate
					try
						select first window
					on error
						create window with default profile
						select first window
					end try
					tell the first window
						tell current session to write text q
					end tell
				end tell
			end run
		" with parameters {q}
	end if
end alfred_script

 

Can not create the Java virtual machine

After the system was reinstalled, a lot of software was installed, including eclipse. However, an error occurred when opening eclipse after installation  

Click OK to show the following:

 
I found the reason on the Internet, because I generated three files java.exe, javaw.exe and javaws.exe in the file C: [windows] system32 when I installed JDK; As shown in the figure:

 

 
Delete the three marked exe files. Be careful not to delete them wrong. Restart eclipse again, and you can run it successfully!

Hope to help you!!!  

MobaXterm error cuda:out of memory

MobaXterm error cuda:out of memory

When using mobaxterm training model, the cuda:out of In addition to the fact that the conventional video memory is too small and the value of subdivisions needs to be adjusted, there may also be a literal meaning that the storage space is insufficient and the data set is too large. At this time, you only need to reduce the capacity of the data set and then reduce it.

How to Solve Error: Type mismatch: cannot convert from Object to Car

Problem Description:

A very simple spring project that uses static factory methods to configure bean instances. The directory structure of the project is as follows:

code show as below:

Car.java

 1 package com.tt.spring.beans.factory;
 2 
 3 public class Car {
 4 
 5     private String brand;
 6     private double price;
 7     
 8     public String getBrand() {
 9         return brand;
10     }
11     public void setBrand(String brand) {
12         this.brand = brand;
13     }
14     public double getPrice() {
15         return price;
16     }
17     public void setPrice(double price) {
18         this.price = price;
19     }
20     
21     public Car(){
22         System.out.println("Car's Constructor...");
23     }
24     
25     
26     
27     public Car(String brand, double price) {
28         super();
29         this.brand = brand;
30         this.price = price;
31     }
32     
33     @Override
34     public String toString() {
35         return "Car [brand=" + brand + ", price=" + price + "]";
36     }
37     
38     
39 }

StaticCarFactory.java

1  package com.tt.spring.beans.factory;
 2  
3  import java.util.HashMap;
 4  import java.util.Map;
 5  
6  /** 
7  * Static factory method: you can directly call a static method of a certain class Return Bean instance
 8   */ 
9  public  class StaticCarFactory {
 10  
11      
12      private  static Map<String,Car> cars = new HashMap<String, Car> ();
 13      
14      static {
 15          cars.put("Audi", new Car ("Audi",300000 ));
 16         cars.put("Ford", new Car("Ford",40000 ));
 17      }
 18      
19      // Static factory method 
20      public  static Car getCar(String name){
 21          return cars.get(name);
 22          
23      }
 24      
25 }

beans-factory.xml

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <beans xmlns="http://www.springframework.org/schema/beans"
 3     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 4     xmlns:context="http://www.springframework.org/schema/context"
 5     xmlns:p="http://www.springframework.org/schema/p"
 6     xmlns:util="http://www.springframework.org/schema/util"
 7     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
 8         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
 9          http://www.springframework.org/schema/util http: //www.springframework.org/schema/util/spring-util-4.0.xsd" > 
10  
11      <!-- Configure beans through static methods. Note that instead of configuring static factory method instances, but configuring bean instances --> 
12      < bean id ="car1"  
13            class ="com.tt.spring.beans.factory.StaticCarFactory" 
14            factory-method ="getCar" > 
15            < constructor-arg value ="Audi" ></constructor-arg>
16     </bean>
17     
18     
19 </beans>

Main.java:

 1 package com.tt.spring.beans.factory;
 2 
 3 import org.springframework.context.ApplicationContext;
 4 import org.springframework.context.support.ClassPathXmlApplicationContext;
 5 
 6 public class Main {
 7 
 8     public static void main(String[] args){
 9         
10         ApplicationContext ctx = new ClassPathXmlApplicationContext("beans-factory.xml");
11         
12         Car car1 = (Car) ctx.getBean("car1");
13         System.out.println(car1);
14      }
 15 }

Run the Main.java program, the console error is as follows:

Exception in thread “main” java.lang.Error: Unresolved compilation problem:
Type mismatch: cannot convert from Object to Car

at com.tt.spring.beans.factory.Main.main(Main.java:12)

 

Cause Analysis:

First, you need to install jre 1.5.0 and above.

Second,
set your installed jre in eclipse’s’Window”Preference”Java’ and’Install JREs’.

Third, in eclipse’s’Window”Preference ” Java ‘in,
‘ Compiler ‘was set up’ Compiler compliance level ‘of 5.0 or more
(the key is the third step, the compatibility level)

 

problem solved:

Since the jdk version I installed is 1.8.0, the problem should be the Compiler compliance level.

Go to Window->Preference->Java->Compiler and find Compiler compliance level=1.5

 

Change the Compiler compliance level to 1.8:

 

Run the Main.java code again, it runs normally, and the console displays the following information:

ApplicationContext.xml file header error Referenced file contains errors

The problem is as follows: The project that was running normally before suddenly reported an error in the applicationContext.xml file header

Referenced file contains errors (http://www.springframework.org/schema/tx/spring-tx.xsd). For more   information, right click on the message in the Problems View and select “Show Details…”

Reason analysis: If you use Maven to build the project, spring always tries to find the xsd file locally when loading the xsd file (the spring jar package already contains all versions of the xsd file), if it is not found, it will go to the URL to specify The path to download. Therefore, this situation is generally caused by a disconnection or the temporary inability of spring’s official website to connect. You can enter the URL of the xsd file in the browser, for example, in the case of spring-beans, enter http://www.springframework.org/schema/beans/spring-beans-2.0.xsd to confirm.

But this time I didn’t use Maven, the jar packages were all released locally, so the above reasons were ruled out.

Another way of thinking:

1. To make sure that Eclipse can get the xsd file remotely, go to Window -> Preferences ->  General -> Network Connections -> Cache and check whether the required file is correct in the Cache entries box under Cache. If you are not sure, click ” Remove All”, then right-click the current Project and select  Validator, Eclipse will reload the xsd file;

2. The easiest way is to delete the version number of the xsd file (it has been deleted here, but an error is still reported, so method 1 is adopted).

[Solved] Hystrix error: java.util.concurrent.TimeoutException: null

The complete error is as follows:

java.util.concurrent.TimeoutException: null
    at com.netflix.hystrix.AbstractCommand.handleTimeoutViaFallback(AbstractCommand.java:997) ~[hystrix-core-1.5.18.jar:1.5.18]
    at com.netflix.hystrix.AbstractCommand.access$500(AbstractCommand.java:60) ~[hystrix-core-1.5.18.jar:1.5.18]
    at com.netflix.hystrix.AbstractCommand$12.call(AbstractCommand.java:609) ~[hystrix-core-1.5.18.jar:1.5.18]
    at com.netflix.hystrix.AbstractCommand$12.call(AbstractCommand.java:601) ~[hystrix-core-1.5.18.jar:1.5.18]
    at rx.internal.operators.OperatorOnErrorResumeNextViaFunction$4.onError(OperatorOnErrorResumeNextViaFunction.java:140) ~[rxjava-1.3.8.jar:1.3.8]
    at rx.internal.operators.OnSubscribeDoOnEach$DoOnEachSubscriber.onError(OnSubscribeDoOnEach.java:87) ~[rxjava-1.3.8.jar:1.3.8]
    at rx.internal.operators.OnSubscribeDoOnEach$DoOnEachSubscriber.onError(OnSubscribeDoOnEach.java:87) ~[rxjava-1.3.8.jar:1.3.8]
    at com.netflix.hystrix.AbstractCommand$HystrixObservableTimeoutOperator$1.run(AbstractCommand.java:1142) ~[hystrix-core-1.5.18.jar:1.5.18]
    at com.netflix.hystrix.strategy.concurrency.HystrixContextRunnable$1.call(HystrixContextRunnable.java:41) ~[hystrix-core-1.5.18.jar:1.5.18]
    at com.netflix.hystrix.strategy.concurrency.HystrixContextRunnable$1.call(HystrixContextRunnable.java:37) ~[hystrix-core-1.5.18.jar:1.5.18]
    at com.netflix.hystrix.strategy.concurrency.HystrixContextRunnable.run(HystrixContextRunnable.java:57) ~[hystrix-core-1.5.18.jar:1.5.18]
    at com.netflix.hystrix.AbstractCommand$HystrixObservableTimeoutOperator$2.tick(AbstractCommand.java:1159) ~[hystrix-core-1.5.18.jar:1.5.18]
    at com.netflix.hystrix.util.HystrixTimer$1.run(HystrixTimer.java:99) ~[hystrix-core-1.5.18.jar:1.5.18]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_221]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) ~[?:1.8.0_221]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_221]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) ~[?:1.8.0_221]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_221]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_221]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_221]

I asked Du Niang, there are those with the function of closing the circuit breaker, and those with a longer circuit breaker time, which are not on the point at all. My purpose is to test the function of the Hystrix circuit breaker, and they are all closed. How can I verify it? Later, I found that there was a line of error on top of this error:

com.netflix.hystrix.contrib.javanica.command.GenericCommand.getFallback 80 - failed to processed fallback is the method: 'failHi'.

Debugging the com.netflix.hystrix.contrib.javanica.command.GenericCommand.getFallback method, it is found that the @HystrixCommand annotation defines the fallbackMethod method to reflect the failure to call failHi, and the failHi method that reported the error is debugged again. Finally, it is found that a RuntimeException exception occurred in the failHi method. The wrong example code is as follows:

@HystrixCommand(fallbackMethod = "failHi")
@ResponseBody
@GetMapping("/hi3")
public String hi3() {
    return restTemplate.getForObject("http://127.0.0.1:" + port + "/res", String.class);
}

public String failHi() {
    try {
        return doThings();
    } catch (Exception e) {
        throw new RuntimeException("error," + e.getMessage());
    }
}

Log4j2 reports ERROR StatusLogger Unrecognized format specifier

problem

When using maven-shade-plugin or maven-assembly-plugin to mark the project into an executable JAR package, if you import log4j2, the following problems will occur:

ERROR StatusLogger Unrecognized format specifier [d]
ERROR StatusLogger Unrecognized conversion specifier [d] starting at position 16 in conversion pattern.
ERROR StatusLogger Unrecognized format specifier [thread]
ERROR StatusLogger Unrecognized conversion specifier [thread] starting at position 25 in conversion pattern.
ERROR StatusLogger Unrecognized format specifier [level]
ERROR StatusLogger Unrecognized conversion specifier [level] starting at position 35 in conversion pattern.
ERROR StatusLogger Unrecognized format specifier [logger]
ERROR StatusLogger Unrecognized conversion specifier [logger] starting at position 47 in conversion pattern.
ERROR StatusLogger Unrecognized format specifier [msg]
ERROR StatusLogger Unrecognized conversion specifier [msg] starting at position 54 in conversion pattern.
ERROR StatusLogger Unrecognized format specifier [n]
ERROR StatusLogger Unrecognized conversion specifier [n] starting at position 56 in conversion pattern.

 

Solution

Add the following configuration to pom.

< plugin > 
   < groupId > org.apache.maven.plugins </ groupId > 
   < artifactId > maven-shade-plugin </ artifactId > 
   < version > 2.4.3 </ 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 > 
               <finalName> ${artifactId}-${env}-${version} </ finalName > 
               < transformers > 
                   < transformer
                            implementation ="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer" > 
                       < mainClass > xxx.yyyy.zzz .Main </ mainClass > 
                   </ transformer > 
                   < transformer implementation ="org.apache.maven.plugins.shade.resource.AppendingTransformer" > 
                       < resource > META-INF/spring.handlers </ resource >
                   </transformer > 
                   < transformer implementation ="org.apache.maven.plugins.shade.resource.AppendingTransformer" > 
                       < resource > META-INF/spring.schemas </ resource > 
                   </ transformer > 
                   < transformer implementation ="org.apache.maven .plugins.shade.resource.AppendingTransformer" > 
                       < resource > META-INF/spring.tooling </ resource > 
                   </ transformer > 
                   < transformer
                            implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer" /> 
                   < transformer
                            implementation ="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" /> 
                   < transformer implementation ="com.github.edwgiz. mavenShadePlugin.log4j2CacheTransformer.PluginsCacheFileTransformer"  /> 
               </ transformers > 
           </ configuration > 
       </ execution > 
   </ executions > 
   < dependencies > 
       < dependency > 
           <groupId >com.github.edwgiz </ groupId > 
           < artifactId > maven-shade-plugin.log4j2-cachefile-transformer </ artifactId > 
           < version > 2.6.1 </ version > 
       </ dependency > 
   </ dependencies > 
</ plugin >

 

Cause Analysis

log4j2 is plug-in programming. When the log4j2 package is compiled, or the package containing the log4j2 plug-in is compiled, the plug-in information that needs to be loaded will be placed in META-INF/org/apache/logging/log4j/core/config/plugins/ Log4j2Plugins.dat (including the official logj42 native plug-in), and then when the project starts, log4j2 will scan the plug-in information file in the META-INF directory of each jar package, and then load the plug-in.

But when the project is marked as a jar package, if there are Log4j2Plugins.dat files in two different jar packages, there will be a problem, one of the files will be overwritten by the other, resulting in a file when the project starts The plug-in cannot be loaded normally, resulting in an error.

To solve this problem, when all jar packages are labeled as one jar package, the Log4j2Plugins.dat in each jar package needs to be merged. This is what the maven-shade-plugin.log4j2-cachefile-transformer package does.