Tag Archives: solution

com.alibaba.druid.sql.parser.ParserException: syntax error

Remember a simple mistake.

sql.append("select"
+"a.MEMBER_NAME, b.ACTION_NAME"
+"from CLUB_MEMBER a,CLUB c, MEMBER_ACTION_RECORD d");
sql.append("WHERE a.CLUB_MEMBER_ID = d.CLUB_MEMBER_ID"
				+ "AND a.CLUB_ID = b.CLUB_ID"
				+ "AND d.ACTION_ID = ?"); 

It’s wrong, why is it wrong? No spaces, SQL prints.
selecta.MEMBER_NAME, b.ACTION_NAMEfrom CLUB_MEMBER a,CLUB c, MEMBER_ACTION_RECORD dWHERE a.CLUB_MEMBER_ID = d.CLUB_MEMBER_IDAND a.CLUB_ID = b.CLUB_IDAND d.ACTION_ID = ?
Now you know why it’s wrong, right?
Correct Codes.

sql.append("select"
+" a.MEMBER_NAME, b.ACTION_NAME"
+" from CLUB_MEMBER a,CLUB c, MEMBER_ACTION_RECORD d");
sql.append(" WHERE a.CLUB_MEMBER_ID = d.CLUB_MEMBER_ID"
				+ " AND a.CLUB_ID = b.CLUB_ID"
				+ " AND d.ACTION_ID = ?"); 

It doesn’t seem to make a big difference, but it’s enough to take half an hour and patience to look at the code.

Java Error | Error:java: Compilation failed: internal java compiler error

Background

Error:java: Compilation failed: internal java compiler error

According to previous experience, the compiling environment of the read project is reset, and the JDK version is all specified as 1.8
1. Setting – & gt; Java complier

2.Project Structure->Modules

After the above steps are set, the same error will be reported in the recompile run

Solution

After investigation, the project Pom.xml The file does not specify a compiled version, in the Pom.xml Add the following plug-ins:

<build>

    <plugins>
        <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
            <version>3.7.0</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <encoding>utf-8</encoding>
            </configuration>
        </plugin>
    </plugins>

</build>

Why not manage controller in spring container

Spring container and spring MVC container

 

1. Question: why not use spring to manage all classes?

In our configuration of spring MVC, why does the controller not be directly managed by spring, but the spring MVC container should be managed separately

 

 

 

2. The relationship between spring container and spring MVC

Spring container is a parent-child relationship with spring MVC container. The child container can access the objects of the parent container, but the parent container can’t access the classes of the child container. If we scan all classes directly in the spring MVC configuration file and hand over service, Dao and controller to spring MVC for management, but if spring is used to manage contoller, it can’t access this class, because Co The ntoller is in the spring MVC container. If you configure spring to scan all classes directly, including controller, but do not configure spring MVC, the request sent by the server will have a 404 problem, because it can’t find the controller and spring can’t inject the controller

Example.
Configure in applicationContext-service.
<! -- Scan package to load Service implementation classes -->
<context:component-scan base-package="com.easybuy"></context:component-scan>
will scan for @Controller, @Service, @Repository, @Compnent

Springmvc.Xml does not scan.
Conclusion: springmvc. cannot provide services because there is no controller object in the springmvc subcontainer.

3. Why not directly SpringMVC.xml Scan all classes in?

In principle, we can leave the service, Dao and controller to spring MVC for management, and just let it scan all packages directly in the spring MVC configuration file. However, for the sake of future expansion, spring and spring MVC are configured separately, and spring manages the service, which is conducive to later expansion. Even if multiple struct2 are added in the future, the original configuration will not be affected

How to Solve Error: java.io.IOException: Resource [classpath:shiro.ini] could not be found.

scene

When Tomcat starts, it always reports an error. It can’t find the configuration file in the classpath, but the configuration file has been placed in the resource directory

 

 

Solution

The reason for this exception is that the new conf folder cannot be recognized, because it is not set as a resource folder. Just right click the conf folder – >build path – > use as source folder

 

 

 

Nutz framework: using native SQL for CND conditions

case

Today, I received a temporary business requirement. It takes a day or two for a simple filter to be used as a temporary business. So I thought of adding a not like to the original CND condition for filtering. However, I found that the existing CND condition query does not seem to meet the requirement

 

Solution

Using static class in Nutz framework to realize custom SQL and Cnd.and () splicing, new static (“xxxxx”) can connect any native SQL

 

cnd.and( new Static("job.ADDRESS not like '%GuangDong%'") );

 

 

 

 

 

 

Multithreading: when doing unit test, use thread pool to find that the specified code is not running and skip directly

Today, we did a unit test to debug the interface. We found that the interface call was successful, but we did not run the thread pool execution method. Instead, we directly skipped the execution code

 

 ExecutorService pool = Executors.newFixedThreadPool( 2 );

 

 public void callInterfaceCreditease(final String idcard,final String name,final String mobile){
        try{
            
            ExecutorService pool = Executors.newFixedThreadPool( 2 );
            //Interface
            pool.execute(new Runnable() {
                @Override
                public void run() {
                    creditCardCrediteaseService.doFetchCreditData(name, idcard, mobile);
                }
            });
            //Release thread pool resources
            pool.shutdown();
        }catch(Exception e){
            log.error("Calling interface exceptions:",e);
        }
                
    }

 

After Oracle 11g is installed, SQL_ Plus.exe The problem of Chinese garbled in command window

Today, after installing Oracle 11g, we encountered sqlplus.exe Command window user login Chinese garbled problem, hope to give yourself a note, also hope to let more people know how to solve. After entering the CMD, right-click the mouse, click properties, find the box as shown in the figure below, and use the old version of the console!

Unbound classpath container: ‘JRE System Library [JavaSE-1.7]’

maven ——> When updating a project, an error appears as shown in the title. After checking the cause, it is found that the. Classpath file in the project directory has more lines as shown in the figure below. Just comment them out. If necessary, configure build path to add JRE library again. (when this error occurs, another error may come out: the project cannot be built until build path errors are resolved)

Solutions for failure to start Axure RP (including failure to uninstall or install. Net framework)

Axure rp8 was well used in the last company last month. This week, when I joined another company, I will use Axure rp8 I can’t open it when I enter the interface. It’s completely on the black screen. It’s not like many people. When I enter the interface, I click any button and don’t respond (Note: This is the sign that the registration code has expired. I just need to get the registration code again. The specific scheme depends on other information. I won’t repeat it here). I can’t enter the interface at all. The small window is on the black screen, and then I stop working (because the problem has been solved) Absolutely, there is no way to post the picture of the problem here).
In general, there are several ways on the Internet:

Delete C: (users [user name] \ appdata/local/temp/axure-6 (or Axure 7.0) delete C: (users [user name] \ appdata/local/Axure add 3D support for graphics card

These are still of no help.
Here’s the point. The ultimate solution is to reload the. Net framework:
specific steps:

    Win + R run control, enter the change or delete program, find the. Net framework, click uninstall and download again. After the installation is completed, restart Axure, the problem is solved, and the mood is suddenly bright.

. net framework cannot be uninstalled or installed, https://pan.baidu.com/s/1N09AGC4LSjdaz_ 9l3ipdcq extraction code: oi97. Put the CAB file in C/windows, open powshell (administrator), and run dism/online/enable feature/all/Fe atureName:NetFx3 /Source :% windir% “/ limitaccess can install. Net framework

Note: here is only the last solution, other solutions can be found online.

It’s over.

A series of problems caused by the option allow output folders for source folders

To run a maven project of the company, colleagues can run on their own computer, but not on my computer. It lasted for 9 days, and they have been solving this problem all the time. During this period, they made many mistakes, but they can’t remember them clearly. So they can write down what they probably remember, so that they can quickly solve the problems when they are in trouble and save valuable working time. But the most important point is that these mistakes are all caused by the same mistake (it may also be that I made a lot of changes during the period, and it comes naturally. Don’t spray if there are mistakes).

    Maven dependency cannot be added.
    1.1. The Maven configuration is missing in the classpath configuration file. In the. Classpath of a project, sometimes there is an error that Maven is not configured;
    1.2 pom.xml Configuration existing in the file
    1.3. Right click on the project – & gt; Maven – & gt; Enable Maven management
    1.4. Execute MVN clean install on the parent project
    1.5. Delete the related jar packages in Maven repository, such as D:// program files/Maven server/Maven repository/Maven_ Then run as – & gt; maven installcannot find class for bean with name (this was not solved at that time, but it was solved with the third solution of the third problem) class cannot be compiled (actually, there is, but the path is wrong, all the errors start here)
    3.1. Find the source under Java build path, Under the default output folder, the default setting format is: [project name]/build/classes, now it is changed to [project name]/webcontent/WEB-INF/classes (or [project name]/target/classes)
    3.2. Project — & gt; automatically build check (or cancel check, manually build)?&Amp; manual build?
    3.3. Solutions: build path -> configure build path -> uncheck allow output folders for source folders –
    solve all problems Conclusion: if it’s not such a wonderful problem, many problems can be solved by carefully reading the error information of console. Even if it can’t be solved for the time being, you can know where the problem is, and it will be more targeted and efficient when consulting others or Du Niang.

Unsatisfied dependencyexception exception

Make a brief note:

Unsatisfied dependencyexception exception

*Why*

mapper.xml In the folder, I accidentally transposed several letters of a long word (because I use a laptop, sometimes I accidentally click on the touchpad)

*Solutions*

Because it was a mistake discovered in time, I went directly mapper.xml Folder Ctrl + Z recovered…

*Other solutions*

You may have changed a lot of content, many times Ctrl + Z is also very boring, and it is also a waste of energy and time. At this time: right click the project local history to select the version before the error

Error attempting to get column ‘STAFF_NAME’ from result set

Error attempting to get column ‘xxx’ from result set.
1. Check whether the database does not have this column, but generally consider that the field name is misspelled.
2. If the database has this field and there is no spelling error, check whether the wrong type is written in dto. The last time I reported an error, I wrote a varchar type field in dto as private long XXX. Change long to string to solve the problem.