Tag Archives: java

javax.persistence.EntityNotFoundException : unable to find error

Javax.mail. Persistence. EntityNotFoundException: Unable to find a class with id?
The reason:
Whether @OneToone or @ManyToone, this is due to the fact that the child table (associated table) has no records corresponding to the ID in the primary table (associated table).
Solutions:

    to check why there is no record for ID in the primary table if the data can be loaded normally without a record for ID in the primary table, you need to add an @notfound Annotation to the primary table field. Example: @onetoone (optional=true)
    @joincolumn (name=”UserId “,insertable=false, updatable=false)
    @notfound (action=NotFoundAction.IGNORE)
    private UserId UserId; In this way, when no data is found in the child table, the corresponding field in the main table is null and no error is reported. Or contact the business personnel, see the data simulation problem, directly kill (I am directly killed)

POI set excel cell background color (use of setfillforegrondcolor and setfillpattern)

    IndexedColors.AQUA.getIndex()IndexedColors.AUTOMATIC.getIndex()IndexedColors.BLUE.getIndex()IndexedColors.BLUE_GREY.getIndex()IndexedColors.BRIGHT_GREEN.getIndex()IndexedColors.BROWN.getIndex()Ind exedColors.CORAL.getIndex()IndexedColors.CORNFLOWER_BLUE.getIndex()IndexedColors.DARK_BLUE.getIndex()IndexedColors.DARK_GREEN.getIndex()IndexedColors.DARK_RED.getIndex()IndexedColors.DARK_TEAL.getInde x()IndexedColors.DARK_YELLOW.getIndex()IndexedColors.GOLD.getIndex()IndexedColors.GREEN.getIndex()IndexedColors.GREY_25_PERCENT.getIndex()IndexedColors.GREY_40_PERCENT.getIndex()IndexedColors.GREY_50_ PERCENT.getIndex()IndexedColors.GREY_80_PERCENT.getIndex()IndexedColors.INDIGO.getIndex()IndexedColors.LAVENDER.getIndex()IndexedColors.LEMON_CHIFFON.getIndex()IndexedColors.LIGHT_BLUE.getIndex()Index edColors.LEMON_CHIFFON.getIndex()IndexedColors.LIGHT_BLUE.getIndex()IndexedColors.LIGHT_CORNFLOWER_BLUE.getIndex()IndexedColors.LIGHT_GREEN.getIndex()IndexedColors.LIGHT_ORANGE.getIndex()IndexedColors .LIGHT_TURQUOISE.getIndex()IndexedColors.LIGHT_YELLOW.getIndex()IndexedColors.LIME.getIndex()IndexedColors.MAROON.getIndex()IndexedColors.OLIVE_GREEN.getIndex()IndexedColors.ORANGE.getIndex()IndexedCo lors.ORCHID.getIndex()IndexedColors.PALE_BLUE.getIndex()IndexedColors.PINK.getIndex()IndexedColors.PLUM.getIndex()IndexedColors.RED.getIndex()IndexedColors.ROSE.getIndex()IndexedColors.ROYAL_BLUE.getI ndex()IndexedColors.SEA_GREEN.getIndex()IndexedColors.SKY_BLUE.getIndex()IndexedColors.TAN.getIndex()IndexedColors.TEAL.getIndex()IndexedColors.TURQUOISE.getIndex()IndexedColors.VIOLET.getIndex()Index EdColors. WHITE. GetIndex IndexedColors ()// WHITE. YELLOW. GetIndex ()

Abnormal report error javax.net.ssl .SSLHandshakeException: server certificate change is restrictedduring renegotiation

Project Scenario:
Access the external interface address


Problem description:
The following abnormalities appear:

javax.net.ssl.SSLHandshakeException: server certificate change is restrictedduring renegotiation
	at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
	at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1884)
	at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:276)
	at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:266)
	at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1402)
	at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:209)
	at sun.security.ssl.Handshaker.processLoop(Handshaker.java:878)
	at sun.security.ssl.Handshaker.process_record(Handshaker.java:814)
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1016)
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323)
	at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:395)
	at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:354)
	at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
	at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
	at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:220)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:164)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:139)

Reason analysis:
As a result of the Http access certificate problem, it is possible that the project environment is too old. The current Java environment is JDK1.7, Tomcat1.7
Solutions:
Turn off HTTP certificate validation
Measures are as follows:
Modify the Tomcat startup script Catalina.sh
Location: Tomcat root directory /bin/catalina.sh
Add the following values for the JAVA_OPTS parameter:

-Djdk.tls.allowUnsafeServerCertChange=true 
-Dsun.security.ssl.allowUnsafeRenegotiation=true

Restart the project and see if the parameter Settings take effect in the Tomcat startup log
Problem solving.

CMD input Java error could not create the Java virtual machine

CMD input JAVA error Could not create the JAVA Virtual Machine, solution
Write this post today, I hope that the students who encounter the following similar problems can refer to my solution to solve quickly, rather than spend a long time like me to explore!
Error message (part 1)
JAVA– CMD input JAVA error prompt: Could not create the JAVA Virtual Machine.

Eclipse — Open error: Fail to create the Java Virtual Machine.

Cause analysis,
because the path path has a Chinese directory or Chinese punctuation, causing Java and eclipse traversal path error. If I type path in CMD, I get something like this :
my error is because path =; D: \ development \ Java \ jdk1.8.0 _151; %JRE_HOME%\ jRE \bin %JRE_HOME%\ jRE \bin %JRE_HOME%\jre\bin %JRE_HOME%\jre\bin %JRE_HOME%\jre\bin

Error message (below)
After the above error is fixed, enter Java in CMD again, the relevant information will appear, as follows:


Version 1.6.0 of the JVM is not suitable for the this product.version :1.8 or greater is required
The current version of the JDK is too low, and Eclipse requires a higher version. The key point is that the version 1.8 is installed on my computer. How can this error still be found?After searching, I have to go to the path of CONFIGURING JDK in Ecipse.ini to find it.
-vm
D:\Program Files\Java\jre1.8.0_121\bin\javaw.exe// add these two lines (of course, the specific address shall be subject to their own address)

JSP exception message invalid TLD file

Today is going to start a core business system for a long time, after downloading the launch access JSP has been reporting this error

Java error: Message Invalid TLD File: see JSP 2.2 Specification section 7.3.1 for more details

After struggling for an hour, I found it after reading the error message in the document.

The JSP tag class file. TLD file cannot be placed under the Web-info classes,lib,tags file, while the old project’S TLD tag is just placed under the tags directory, so it will go straight to GG. The current solution is to move the TLD tag to another legitimate folder, and you can read the above mentioned documents if you are interested.

Perfect solution for IntelliJ idea error “CreateProcess error = 2, system cannot find the specified file”

I. Background of the problem
The blogger was using Intellij IDEA normally, but Intellij IDEA suddenly sounded wrong for unknown reasons. The error hints were as follows:

Error:Cannot run program “F:\WINDOWS Application Installation \ JRE \bin\ Java “(in directory “C:\Users\ Li Junde \.IntelliJIdea2018.1\ System \ Compile-Server “): CreateProcess Error =2, the system could not find the specified file.


Ii. Problem analysis
By observing the Intellij IDEA error, we know that it was caused by a failure to find the correct installation path for the JDK(Java Development Kit). There are many reasons why Intellij IDEA might not find the JDK: Maybe you accidentally removed it; Or if you install the JDK in a path with Chinese characters, Intellij IDEA does not recognize paths with Chinese characters; Or maybe you accidentally configured the WRONG ENVIRONMENT variable for the JDK on your computer.
The wrong solution
1. Make sure we have the JDK installed on our computer
In 2019, the new version of the JDK(also known as Java) already has the JDK and JRE bundled in it, so installing the JDK is equivalent to installing the JDK and JRE.
Press and hold Windows+R on the computer keyboard, pops out and run program, enter CMD and to confirm. enter Java --version in the black box console to view the Java version number.

If your computer pops up a prompt like the one above (describing the Java version number, release date, etc.), then your computer has the JDK installed correctly, and we go straight to the next step. Otherwise, it means that your computer did not properly install the JDK, you still have to search the latest version of Java in 2019 Java10 and above Java installation tutorial, the bloggers do not recommend small white users to install the old version of Java, the old version of Java needs to install the Java JDK and JRE, also need to configure environment variables, small white users are easy to make mistakes.
2. Properly set the JDK installation path at Intellij IDEA
Click the File option in the upper-left menu bar of Intellij IDEA, and then click the Project Structure sub-option.

In the configuration page for Project Structure, the project-JDK must not be red as shown in the figure below, because red indicates that there is no corresponding JDK under the file path.

First, make sure that you have followed the first step above to find the current Java version on your computer through the black box command Java — Version. Otherwise, you will have to reinstall the JDK before you see this step. Under the Project SDK TAB, we clicked on the small triangle arrow in the drop-down box to see if Intellij IDEA had helped us find an alternative JDK version. If so, we checked that Intellij IDEA was basically back to normal by selecting the existing JDK in the drop-down box.

If there is no existing JDK version in the drop-down box, we need to manually click New… , then select the “install the latest JDK on our computer properly” installation path. If you’ve just reinstalled the JDK you must remember the JDK installation path. If you’ve forgotten where you installed the JDK, type Java –verbose — in the black box and the JDK installation path appears at the end of the command line.
3. Save the configuration of Project Structure and recompile it to run the Java program normally
After OK, compile Run again to Run the Java program as normal.

Could not start Quartz Scheduler after delay; nested exception is org.quartz.SchedulerException:

directory
Problem description and solution process summary

Problem description
First of all, there is a timer in this project, and then it seems that the timing task error causes the project not to start up, but it is not.

2020-11-19 15:22:06.141 [restartedMain] INFO  com.alibaba.druid.pool.DruidDataSource 1609 - {dataSource-1} closed
2020-11-19 15:22:06.952  INFO 1352 --- [lerFactoryBean]] o.s.s.quartz.SchedulerFactoryBean        : Starting Quartz Scheduler now, after delay of 1 seconds
2020-11-19 15:22:06.952 [Quartz Scheduler [schedulerFactoryBean]] INFO  org.springframework.scheduling.quartz.SchedulerFactoryBean 665 - Starting Quartz Scheduler now, after delay of 1 seconds
Exception in thread "Quartz Scheduler [schedulerFactoryBean]" org.springframework.scheduling.SchedulingException: Could not start Quartz Scheduler after delay; nested exception is org.quartz.SchedulerException: The Scheduler cannot be restarted after shutdown() has been called.
	at org.springframework.scheduling.quartz.SchedulerFactoryBean$1.run(SchedulerFactoryBean.java:671)
Caused by: org.quartz.SchedulerException: The Scheduler cannot be restarted after shutdown() has been called.
	at org.quartz.core.QuartzScheduler.start(QuartzScheduler.java:557)
	at org.quartz.impl.StdScheduler.start(StdScheduler.java:142)
	at org.springframework.scheduling.quartz.SchedulerFactoryBean$1.run(SchedulerFactoryBean.java:668)

To solve the process
At the beginning, I always thought that the project could not be started due to the timing task, but I ignored the error log above. I searched a lot about the timer error, but I couldn’t solve it. And then it turned out that there was another error. The Mybatis mapping file resultMap is filled incorrectly. It will be all right after the changes are done.

conclusion
In the face of error, must be calm and calm, good observation of the log. Only after observing the log can you quickly lock the cause of the error.

Could not publish server configuration for Tomcat v8.5 server at localhost

Could not publish Server Configuration for Tomcat V8.5 Server at localhost. The solution
Problem analysis
Possible exception: Multiple duplicate project names are stored in the Context tag in the server.xml file in the Servers file
The solution
Find the Servers file in Eclipse. Find the folder with the name of the server used to start the project in it, and under its directory find the server.xml file
At this time found that the document is very lengthy, small white shows that look dizzy..
Find the Design view at the bottom, click on the Design view to change the view, find the small arrow to the left of Servers, click on the small arrow to see the subdirectory of Servers, and keep looking for the small arrow until you find the Context.

You can clearly see the duplicate item name in the Context, right-click on it and select Remove to remove the redundant Context save (Ctrl+S or click save in the upper left corner, the * on the file label will disappear).
We’re done. Go and restart the project.

MySQL:Foreign key fails with error Error Code: 1452.

Today in MySQL, we add foreign keys to A table, the type is int, the name is not wrong, I temporarily want to add foreign keys to Table A table B, that is, the foreign keys in table A are associated with the primary key in table B.
NavigateSQL, however, always saves an operation with an error:
Foreign key fails with error error Code: 1452. Cannot add or update a child row: a Foreign key constraint fails: XXX.< result 2…

Go through Google and solve from StackOverflow!

The original B table I created temporarily had no data. When I added data to B table, I reported the same error again.

Originally, table A associated table B primary key field value, and table B value inconsistent, I manually changed the consistent “content consistent” can be!

StachOverflow:
http://stackoverflow.com/questions/7354032/foreign-key-fails-with-error-error-code-1452-cannot-add-or-update-a-child-row

Record here for accumulation!

com.microsoft.sqlserver . jdbc.SQLServerException : invalid object name ‘XX’

Myeclipse error message:
Error: com. Microsoft. Essentially. JDBC. SQLServerException: object name ‘xx’ is invalid
Warning: SQL Error: 208, SQLState: S0002
 
Error behavior: HQL statements can run in sqlserver, but run in hibernate to report an error.
Solution: The Settings in the.hbm.xml file of the data table mapping are incorrect. The database name catalog=”eportal” should be added, and the schema name schema=” DBO “should also be added.
This is a new feature in sqlserver2005, in mysql can be omitted.