Tag Archives: error

Java Error: No enclosing instance of type Main is accessible. Must qualify the allocation with an encl

The following error occurred today while compiling a Java program.
No enclosing instance of type Main is accessible. Must qualify the allocation with an enclosing instance of type Main (e.g. x.new A() where x is an instance of Main).
The source code I originally wrote looked like this

public class Main 
{
class Dog
{
private String name;
private int weight;
public Dog(String name, int weight) 
{
this.setName(name);
this.weight = weight;
}
public int getWeight() 
{
return weight;
}
public void setWeight(int weight) 
{this.weight = weight;}
public void setName(String name)
{this.name = name;}
public String getName() 
{return name;}
}
public static void main(String[] args)
{
Dog d1 = new Dog("dog1",1);

}
}

When this error occurred, I didn’t quite understand it.

After learning from other people’s explanation, I suddenly realized.

In the code, my dog class is an internal class defined in main. The dog inner class is dynamic, while my main method is static.

Just as static methods cannot call dynamic methods.

There are two solutions:

Method 1

Define the inner class dog as a static class.

Method 2

Define the inner class dog outside the main class.

Word column after the text evenly distributed in the left and right two columns, rather than fill in the left column and then fill in the right column, how to do?

It should be that some paragraphs are selected when setting columns.
Solution:
reset the column, through the menu: format → column → column number set to 2, and set “apply to” to “whole document” → confirm.
After returning to the normal interface, delete all the “section break (continuous)” marks in the document. If you can’t see the “section break (continuous)” marks because they are hidden, you can click the “show/hide edit marks” button in the toolbar to show them.

Location of “show/hide edit mark” button:

Reference 1
reference 2

Error in plot.new() : figure margins too large

There is an error in drawing graphics using the plot function of rstudio

Error in plot.new () : figure margins too large

Solution:
use the code first

par("mar")

Check the Mar parameter and you’ll probably get this result

[1] 5.1 4.1 4.1 2.1

Reset this parameter

par(mar=c(1,1,1,1))

Then the problem was solved

source

Failed to load file or assembly MySql.Web Solution

Configuration error

Description: an error occurred while processing the configuration file required to service the request. Check the specific error details below and modify the configuration file as appropriate.

parser error message: failed to load file or assembly“ MySql.Web , version = 8.0.13.0, culture = neutral, publickeytoken = c5687fc88969c44d “or one of its dependencies. The system cannot find the specified file.

Source error:

Line 282:    <siteMap>
Line 283:      <providers>
Line 284:        <add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=8.0.13.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
Line 285:      </providers>
Line 286:    </siteMap>

Source file: C:: Windows\ Microsoft.NET \Framework\v4.0.30319\Config\ machine.config Line: 284

assembly load trace: the following information helps determine the assembly“ MySql.Web , version = 8.0.13.0, culture = neutral, publickeytoken = c5687fc88969c44d “.

Source file: C:: Windows\ Microsoft.NET \Framework\v4.0.30319\Config\ machine.config There’s a problem

All we need to do is go to C: windows\ Microsoft.NET \Framework\v4.0.30319\Config\ machine.config Find the file

take machine.config.defalut Remove the following. Default and replace the original machine.config Replace it

How to Solve Error: Cannot find the declaration of element ‘beans’.

Question: org.xml.sax .SAXParseException: cvc-elt.1: Cannot find the declaration of element ‘beans’.

Solution: first, if the exception is encountered in the project, it is usually the problem that the project cannot download to the spring-beans-2.5.xsd file. The version number here varies with the project version.

Here you need to configure the local XSD file as follows:

Find the core package of spring referenced in your project, spring.jar

Open it with a compressed file and find the path

org/springframework/beans/factory/xml/

And configure the XSD file in this path to applicationContext.xml If there are more than one configuration file, all of them will be replaced

That is to say,
is the best choice

classpath:/org/springframework/beans/factory/xml/spring-beans-2.5.xsd

Instead of

http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

Enables the configuration file to be read directly from the local

Reprint address: http://blog.csdn.net/wengang285/article/details/7587264

Method 2:

Modify spring applicationContext.xml Change the name space of the XML file to the following code:

<?xml version=”1.0″ encoding=”utf-8″?>
<!DOCTYPE beans PUBLIC “-//SPRING//DTD BEAN 2.0//EN” ” http://www.springframework.org/dtd/spring-beans-2.0.dtd “>
<beans>

Problem solving address: http://www.myexception.cn/vc-mfc/627052.html

 

The first method seems to have no effect, so I use the second method to solve the problem

The solution of red X in eclipse error pages

Every time I build a maven project and turn it into a web project, there are always so many files here, and there will also be a red cross of error pages, which is very uncomfortable. Although there was no error in the project, it was always an error message for me. So I looked for a long time, and finally found the cause of the problem.

It turns out that this is a problem of eclipse itself. If you change to a web project, you will add web.xml , but the compiler will not update itself and will report this error. So you can cut it web.xml Save all the information in Ctrl + s, then the compiler will refresh, and then you are putting the clipped content back web.xml Finally, the problem is solved.

 

Solution to build error in Vue project (error in static/JS)/vendor.xxxxx.js from UglifyJs)

The project that has been running very well suddenly reported an error in build. The error message is as follows:

ERROR in static/js/vendor.f1c68aa2d5e85847d30e.js from UglifyJs
Unexpected token name «i», expected punc «;» [./node_modules/element-ui/src/utils/merge.js:2,0][static/js/vendor.f1c68aa2d5e85847d30e.js:17064,11]
Build failed with errors.

In uglifyjs’ GitHub issues # 78, we found such a solution: because uglifyjs only supports Es5, and element UI may introduce a part of the writing of ES6, so webpack packaging fails. The final solution given in issue is to replace uglify JS with uglify es of beta version (beta version introduces support for es2015 +). You need to execute the command NPMI - D in the front-end working directory uglifyjs-webpack-plugin@beta

However, after trying, we found that the problem of build error is still unsolved. After searching for the problem, we decided to use bable to parse the element UI. To complete this operation, we only need to modify the build error in the front-end folder/ webpack.base.conf The. JS file can be modified as follows:
before modification

module: {
rules: [
...
{
test: /\.js$/,
loader: 'babel-loader',
include: [resolve('src'), resolve('test')]
},

After modification

 

module: {
rules: [
...
{
test: /\.js$/,
loader: 'babel-loader',//Note that elementUI's source code needs to be parsed using ES6
include: [resolve('src'), resolve('test'),resolve('/node_modules/element-ui/src'),resolve('/node_modules/element-ui/packages')]
},
...

It is equivalent to adding element UI to the package that needs to be parsed by Babel.

After that, execute NPM run build again, and the build is successful.

Error: not found; no service started

Sometimes it’s a headache to report an error. If you have a problem with your own code, you can still solve it. However, if there is a problem with the as tool, it’s embarrassing!
I’ve heard that as2.3 has its own bug before, but I haven’t encountered it. Fortunately, I did today! All kinds of search information, over the wall!
The error is as follows:

Starting service: Intent 
{ act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] 
cmp=com.xxx.xxx.constrain/com.android.tools.fd.runtime.InstantRunService }
Error: Not found; no service started.

Solution:
first, simply and crudely re install as2.3 (I use version 2.3)
Second, upgrade as in the case of upgrade. At present, my as is upgraded from 2.3 to 2.3.1
and above, and all the problems can be solved

Error executing Aidl: return code 1

I learned from the video in Aidl studio, and then I used it to create a note file. The Aidl file created in the video has a set of templates. The Aidl file created in eclipse has nothing, even no code prompt. Error executing Aidl: return code 1.

After traversing various websites, even stackoverflow did not find the answer. There is only one similar eclipse that creates Aidl without generating a java file in the gen directory, and writes a standard Aidl format code according to it. After saving, the error disappears.

Hive SQL syntax error and corresponding solutions

Hive SQL syntax is different from the frequently used MySQL syntax. SQL written according to the habit of writing MySQL often reports errors, and it is difficult to see the cause of the problem. Therefore, this paper records the phenomenon of the problem and the solution

If you don’t find any problem with the alias: select from error ‘> select from error = 4200* From a) treror: error while compiling statement: failed: semanticexception [error 10025]: expression not in group by key ID (state = 42000, code = 10025)
cause: fields in the select statement but not in the group by statement will cause the error
solution: change the select id, name from a group by name to select collect_ Set (ID), name from a group by NameError: error while compiling statement: failed: semanticexception [error 10004]: Line 1:13 invalid table alias or column reference ‘ID’:
cause: the corresponding field in the subquery statement has changed, such as using a function or renaming
solution: select id, name from (select collect)_ Set (ID), name from a group by name) t “is changed to” select id, name from (select collect)_ Set (ID) id, name from a group by name) t or select t.id, name from (select collect)_ Set (ID), name from a group by name) tproblem: unable to query data after hive multiple SQL unions
cause: the data after union is saved in HDFS to multiple new directories under the table directory
solution: add configuration (which can be directly input on the CLI command line) set mapred.input.dir .recursive=true;
Or use a select statement to package multiple union statements and then execute hsql on tez to report an error. Out of memory
needs to adjust the size of the container
set hive.tez.container .size=4096;
set hive.tez.java . opts = – xmx3072m; hive does not query subdirectories recursively by default, so when creating a table, if there are subdirectories in the specified directory, it will report ERROR:not a file
You can perform the following four configurations in hive cli to enable recursive access to subdirectories in the callback. Instead of recursive query, all the data under the directory will be loaded in. Therefore, when the subdirectories are very deep or there are many subdirectories, the speed will be very slow.
set hive.input.dir .recursive=true; 
set hive.mapred.supports .subdirectories=true; 
set hive.supports.subdirectories=true ; 
set mapred.input.dir .recursive=true;