Category Archives: Error

Android: Can’t create handler inside thread that has not called Looper.prepare() [Solved]

Error reason:

You can't refresh the UI thread in a subthread in Android

resolvent:

//Refresh the UI using the runOnUiThread method
runOnUiThread(new Runnable() {
    @Override
    public void run() {
        //refresh UI
    }
});

common problem:

When calling locationmanager to get the current location information and upload it in real time, the reason for this error is that locationmanager needs to be used in the main thread. The following methods are recommended:

@Override
protected void onCreate(Bundle savedInstanceState) {    
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //upload location messages
    Button btnUploadGPS = (Button)findViewById(R.id.btn_upload_gps);
    if (btnUploadGPS != null){
        btnUploadGPS .setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                uploadGPS();
            }
        });
    }
}

private void uploadGPS(){    
    final LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
    locationManager.requestLocationUpdates(
            LocationManager.GPS_PROVIDER,
            2000,
            (float) 0.01,
            new LocationListener() {
                @Override
                public void onLocationChanged(Location location) {
                    asyncUploadGPS(location);
                }

                @Override
                public void onStatusChanged(String provider, int status, Bundle extras) {

                }

                @Override
                public void onProviderEnabled(String provider) {
                    asyncUploadGPS(locationManager.getLastKnownLocation(provider));
                }

                @Override
                public void onProviderDisabled(String provider) {
                    asyncUploadGPS(null);
                }
            }
    );
}

private void asyncUploadGPS(final Location currentLocation) {
    new Thread(new Runnable() {
        @Override
        public void run() {
            //upload loacation messages
        }
    }).start();
}

Java.sql.SQLException: ORA-02291: integrity constraint violated – par

java.sql.SQLException: ORA-02291: integrity constraint (BOOKER.FK_ANDON_EVENT_STATUS) violated – parent key not found
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:955)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3316)
from: http://www.dba-oracle.com/t_ora_02291_integrity_constraint_string_string_violated_parent_key_not_found.htm

The Oracle docs note this on the ora-02291 error:
ORA-02291: integrity constraint (string.string) violated – parent key not found

Cause: A foreign key value has no matching primary key value.
Action: Delete the foreign key or add a matching primary key.

For an insert statement, this ORA-02291 error is common when you are trying to insert a child without a matching parent, as defined by a foreign key constraint.  In that case, you need to add the parent row to the table and then re-insert your child table row.
See the dba_constraints view to find the parent table.

To fully understand [primary and foreign key constraints, see the book Easy Oracle Jumpstart, to explain these concepts:

Entity integrity error
Your foreign key FK_ANDON_EVENT_STATUS will be wrong if there is no data in the column of the corresponding parent table, you should insert the parent table first, then insert the child table
Table a has a foreign key, pointing to table b, then b is the parent table of a, the foreign key refers to the column is the parent key

 

ORA-08103: object no longer exists [How to Solve]

Today the toolbox reported the following error.

ORA-08103: object no longer exists

After checking the reason, there is a session operating the table, such as insert, update, etc.. And the toolbox operation happens to be in the select table, so the error is reported.

————————————————————————————

ORA-08103: object no longer exists error.
The later description is that one of the processes is performing truncate and insert actions sequentially while another process is doing a select action on the
The latter description is that one of the processes performs truncate and insert actions sequentially, while another process does select on the same table, resulting in ora-8103
metalink information:

fact: Oracle Server – Enterprise Edition 8
symptom: Error performing a SELECT statement
symptom: ORA-08103: object no longer exists
symptom: Table is being truncated by other session
symptom: Analyze table validate structure cascade returns no errors
cause: This ORA-08103 occurs on the next block read after the truncate
command.
The LOCK TABLE IN EXCLUSIVE MODE does not prevent the table from being
SELECTED from. Thus, when the query has started and while this query runs
and the truncate occurs, this ORA-08103 may surface on the next block read.
This is considered intended behavior.
When a TRUNCATE occurs the DATAOBJ# in OBJ$ gets increased by one and thus
may lead to this ORA-08103 ‘object no longer exists’

fix:
Possible solutions are:
– Use DELETE instead of TRUNCATE
– Use SELECT FOR UPDATE as this will try to lock the table

Also ora-08103 has other explanations:
Solution: ‘ORA-8103: Object no longer exists’ When Insert Into External Table after Truncate With Storage Performed

Applies to:
Oracle Server – Enterprise Edition – Version: 10.2.0.1 to 10.2.0.3
This problem can occur on any platform.
Symptoms
The following error can occur on an insert with SQL Loader into an external organized table after a truncate with storage option has been performed
ORA-08103: object no longer exists

SQL> insert

/*+ PARALLEL(a, 8)*/

into iad_o_ast_new a

select /*+ full(b) parallel(b,8)*/

* from iad_o_ast_ext b

where rownum<10000 ;

into iad_o_ast_new a

*

ERROR at line 3:

ORA-08103: object no longer exists

.
Changes
The table was truncated with storage option before the insert .
Cause
The bitmap information is not correct after truncating with the storage option.  The solutions update the bitmap information in the tablespace.
Solution
There are two known solutions at this time.
1.  Add another datafile to increase the size of the tablespace for the insert.  You will need to still use the correct truncate option next time you truncate the table.
2.  Drop the table and recreate it.  You will need to still use the correct truncate option next time you truncate the table.
Do not truncate the table with the storage option.

Do not truncate the base table using:

truncate ;

truncate drop storage;

Use the following instead:

truncate reuse storage;

 

ORA-24338 statement handle not executed [How to Solve]

Today I received a mail from the developer that the program occasionally reports an error when calling a function, but most of the time it is normal, the specific error is as follows:
12/8/2010 5:54:34 PM – Checking MERGED DFMS with Servicetag [128QPN1]
12/8/2010 5:54:34 PM – Creating Dataset
12/8/2010 5:54:34 PM – Initializing WebReference
12/8/2010 5:54:34 PM – Web reference creted, calling GetSn option
12/8/2010 5:54:34 PM – WS returned: ORA-24338: statement handle not executed
12/8/2010 5:54:34 PM – Try to fill out the datagrid with the first table
12/8/2010 5:54:34 PM – Exception Caught:System.NullReferenceException: Object reference not set to an instance of an object.
at TEST_DFMS.Form1.button4_Click(Object sender, EventArgs e)

ORA-24338 statement handle not executed

Cursor not executed

Cause: A fetch or describe was attempted before executing a statement handle.
Fetching from above without executing a cursor

Action: Execute a statement and then fetch or describe the data.
Do a good job of exception control, if the analysis or execution of the error to do a good job of exception control, php, jsp pages are easier to handle when the error.

[Solved] Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!

The web project reports an error when executing the query:
Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!

19:27:26,672 ERROR [STDERR] org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???]; SQL state [null]; error code [0]; Connections could not be acquired from the underlying database!; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!
19:27:26,672 ERROR [STDERR] 	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
19:27:26,672 ERROR [STDERR] 	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
19:27:26,672 ERROR [STDERR] 	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
19:27:26,672 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateAccessor.convertJdbcAccessException(HibernateAccessor.java:424)
19:27:26,673 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:410)
19:27:26,673 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
19:27:26,673 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
19:27:26,673 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:912)
19:27:26,673 ERROR [STDERR] 	at com.springtest.common.dao.GenericHibernateDao.find(GenericHibernateDao.java:224)
19:27:26,673 ERROR [STDERR] 	at com.springtest.system.service.LoginService.findTBaseUser(LoginService.java:25)
19:27:26,673 ERROR [STDERR] 	at com.springtest.system.action.LoginAction.login(LoginAction.java:39)
19:27:26,673 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
19:27:26,673 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
19:27:26,673 ERROR [STDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
19:27:26,673 ERROR [STDERR] 	at java.lang.reflect.Method.invoke(Method.java:597)
19:27:26,673 ERROR [STDERR] 	at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
19:27:26,673 ERROR [STDERR] 	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
19:27:26,673 ERROR [STDERR] 	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
19:27:26,673 ERROR [STDERR] 	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
19:27:26,673 ERROR [STDERR] 	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
19:27:26,673 ERROR [STDERR] 	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
19:27:26,673 ERROR [STDERR] 	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
19:27:26,673 ERROR [STDERR] 	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
19:27:26,673 ERROR [STDERR] 	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
19:27:26,673 ERROR [STDERR] 	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
19:27:26,673 ERROR [STDERR] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
19:27:26,673 ERROR [STDERR] 	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
19:27:26,673 ERROR [STDERR] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
19:27:26,673 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
19:27:26,673 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
19:27:26,673 ERROR [STDERR] 	at com.springtest.common.filter.LoginFilter.doFilter(LoginFilter.java:48)
19:27:26,673 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
19:27:26,673 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
19:27:26,673 ERROR [STDERR] 	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
19:27:26,674 ERROR [STDERR] 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
19:27:26,674 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
19:27:26,674 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
19:27:26,674 ERROR [STDERR] 	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
19:27:26,674 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
19:27:26,674 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
19:27:26,674 ERROR [STDERR] 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
19:27:26,674 ERROR [STDERR] 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
19:27:26,674 ERROR [STDERR] 	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
19:27:26,674 ERROR [STDERR] 	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
19:27:26,674 ERROR [STDERR] 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
19:27:26,674 ERROR [STDERR] 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
19:27:26,674 ERROR [STDERR] 	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
19:27:26,674 ERROR [STDERR] 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
19:27:26,674 ERROR [STDERR] 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
19:27:26,674 ERROR [STDERR] 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
19:27:26,674 ERROR [STDERR] 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
19:27:26,674 ERROR [STDERR] 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
19:27:26,674 ERROR [STDERR] 	at java.lang.Thread.run(Thread.java:619)
19:27:26,674 ERROR [STDERR] Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!
19:27:26,674 ERROR [STDERR] 	at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
19:27:26,674 ERROR [STDERR] 	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:529)
19:27:26,674 ERROR [STDERR] 	at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
19:27:26,674 ERROR [STDERR] 	at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:83)
19:27:26,675 ERROR [STDERR] 	at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
19:27:26,675 ERROR [STDERR] 	at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
19:27:26,675 ERROR [STDERR] 	at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
19:27:26,675 ERROR [STDERR] 	at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1700)
19:27:26,675 ERROR [STDERR] 	at org.hibernate.loader.Loader.doQuery(Loader.java:801)
19:27:26,675 ERROR [STDERR] 	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
19:27:26,675 ERROR [STDERR] 	at org.hibernate.loader.Loader.doList(Loader.java:2542)
19:27:26,675 ERROR [STDERR] 	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
19:27:26,675 ERROR [STDERR] 	at org.hibernate.loader.Loader.list(Loader.java:2271)
19:27:26,675 ERROR [STDERR] 	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:459)
19:27:26,675 ERROR [STDERR] 	at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:365)
19:27:26,675 ERROR [STDERR] 	at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
19:27:26,675 ERROR [STDERR] 	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268)
19:27:26,675 ERROR [STDERR] 	at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
19:27:26,675 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:921)
19:27:26,675 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:912)
19:27:26,675 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)
19:27:26,675 ERROR [STDERR] 	... 47 more
19:27:26,675 ERROR [STDERR] Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
19:27:26,675 ERROR [STDERR] 	at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1319)
19:27:26,675 ERROR [STDERR] 	at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
19:27:26,675 ERROR [STDERR] 	at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
19:27:26,675 ERROR [STDERR] 	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)
19:27:26,675 ERROR [STDERR] 	... 66 more
19:28:29,599 ERROR [STDERR] org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???]; SQL state [null]; error code [0]; Connections could not be acquired from the underlying database!; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!
19:28:29,600 ERROR [STDERR] 	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
19:28:29,600 ERROR [STDERR] 	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
19:28:29,600 ERROR [STDERR] 	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
19:28:29,600 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateAccessor.convertJdbcAccessException(HibernateAccessor.java:424)
19:28:29,600 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:410)
19:28:29,600 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
19:28:29,600 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
19:28:29,600 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:912)
19:28:29,601 ERROR [STDERR] 	at com.springtest.common.dao.GenericHibernateDao.find(GenericHibernateDao.java:224)
19:28:29,601 ERROR [STDERR] 	at com.springtest.system.service.LoginService.findTBaseUser(LoginService.java:25)
19:28:29,601 ERROR [STDERR] 	at com.springtest.system.action.LoginAction.login(LoginAction.java:39)
19:28:29,601 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
19:28:29,601 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
19:28:29,601 ERROR [STDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
19:28:29,601 ERROR [STDERR] 	at java.lang.reflect.Method.invoke(Method.java:597)
19:28:29,601 ERROR [STDERR] 	at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
19:28:29,601 ERROR [STDERR] 	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
19:28:29,601 ERROR [STDERR] 	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
19:28:29,601 ERROR [STDERR] 	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
19:28:29,601 ERROR [STDERR] 	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
19:28:29,601 ERROR [STDERR] 	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
19:28:29,601 ERROR [STDERR] 	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
19:28:29,601 ERROR [STDERR] 	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
19:28:29,601 ERROR [STDERR] 	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
19:28:29,601 ERROR [STDERR] 	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
19:28:29,601 ERROR [STDERR] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
19:28:29,601 ERROR [STDERR] 	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
19:28:29,601 ERROR [STDERR] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
19:28:29,601 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
19:28:29,601 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
19:28:29,601 ERROR [STDERR] 	at com.springtest.common.filter.LoginFilter.doFilter(LoginFilter.java:48)
19:28:29,601 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
19:28:29,601 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
19:28:29,601 ERROR [STDERR] 	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
19:28:29,601 ERROR [STDERR] 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
19:28:29,602 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
19:28:29,602 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
19:28:29,602 ERROR [STDERR] 	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
19:28:29,602 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
19:28:29,602 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
19:28:29,602 ERROR [STDERR] 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
19:28:29,602 ERROR [STDERR] 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
19:28:29,602 ERROR [STDERR] 	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
19:28:29,602 ERROR [STDERR] 	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
19:28:29,602 ERROR [STDERR] 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
19:28:29,602 ERROR [STDERR] 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
19:28:29,602 ERROR [STDERR] 	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
19:28:29,602 ERROR [STDERR] 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
19:28:29,602 ERROR [STDERR] 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
19:28:29,602 ERROR [STDERR] 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
19:28:29,602 ERROR [STDERR] 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
19:28:29,602 ERROR [STDERR] 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
19:28:29,602 ERROR [STDERR] 	at java.lang.Thread.run(Thread.java:619)
19:28:29,602 ERROR [STDERR] Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!
19:28:29,602 ERROR [STDERR] 	at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
19:28:29,602 ERROR [STDERR] 	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:529)
19:28:29,602 ERROR [STDERR] 	at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
19:28:29,602 ERROR [STDERR] 	at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:83)
19:28:29,603 ERROR [STDERR] 	at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
19:28:29,603 ERROR [STDERR] 	at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
19:28:29,603 ERROR [STDERR] 	at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
19:28:29,603 ERROR [STDERR] 	at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1700)
19:28:29,603 ERROR [STDERR] 	at org.hibernate.loader.Loader.doQuery(Loader.java:801)
19:28:29,603 ERROR [STDERR] 	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
19:28:29,603 ERROR [STDERR] 	at org.hibernate.loader.Loader.doList(Loader.java:2542)
19:28:29,603 ERROR [STDERR] 	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
19:28:29,603 ERROR [STDERR] 	at org.hibernate.loader.Loader.list(Loader.java:2271)
19:28:29,603 ERROR [STDERR] 	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:459)
19:28:29,603 ERROR [STDERR] 	at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:365)
19:28:29,603 ERROR [STDERR] 	at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
19:28:29,603 ERROR [STDERR] 	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268)
19:28:29,603 ERROR [STDERR] 	at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
19:28:29,603 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:921)
19:28:29,603 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:912)
19:28:29,603 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)
19:28:29,603 ERROR [STDERR] 	... 47 more
19:28:29,604 ERROR [STDERR] Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
19:28:29,604 ERROR [STDERR] 	at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1319)
19:28:29,604 ERROR [STDERR] 	at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
19:28:29,604 ERROR [STDERR] 	at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
19:28:29,604 ERROR [STDERR] 	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)
19:28:29,604 ERROR [STDERR] 	... 66 more
19:28:46,580 ERROR [STDERR] org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???]; SQL state [null]; error code [0]; Connections could not be acquired from the underlying database!; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!
19:28:46,580 ERROR [STDERR] 	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
19:28:46,580 ERROR [STDERR] 	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
19:28:46,580 ERROR [STDERR] 	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
19:28:46,580 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateAccessor.convertJdbcAccessException(HibernateAccessor.java:424)
19:28:46,581 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:410)
19:28:46,581 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
19:28:46,581 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
19:28:46,581 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:912)
19:28:46,581 ERROR [STDERR] 	at com.springtest.common.dao.GenericHibernateDao.find(GenericHibernateDao.java:224)
19:28:46,581 ERROR [STDERR] 	at com.springtest.system.service.LoginService.findTBaseUser(LoginService.java:25)
19:28:46,581 ERROR [STDERR] 	at com.springtest.system.action.LoginAction.login(LoginAction.java:39)
19:28:46,581 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
19:28:46,581 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
19:28:46,581 ERROR [STDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
19:28:46,581 ERROR [STDERR] 	at java.lang.reflect.Method.invoke(Method.java:597)
19:28:46,581 ERROR [STDERR] 	at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
19:28:46,581 ERROR [STDERR] 	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
19:28:46,581 ERROR [STDERR] 	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
19:28:46,581 ERROR [STDERR] 	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
19:28:46,581 ERROR [STDERR] 	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
19:28:46,581 ERROR [STDERR] 	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
19:28:46,581 ERROR [STDERR] 	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
19:28:46,581 ERROR [STDERR] 	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
19:28:46,581 ERROR [STDERR] 	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
19:28:46,581 ERROR [STDERR] 	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
19:28:46,581 ERROR [STDERR] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
19:28:46,581 ERROR [STDERR] 	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
19:28:46,581 ERROR [STDERR] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
19:28:46,581 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
19:28:46,581 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
19:28:46,581 ERROR [STDERR] 	at com.springtest.common.filter.LoginFilter.doFilter(LoginFilter.java:48)
19:28:46,581 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
19:28:46,581 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
19:28:46,581 ERROR [STDERR] 	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
19:28:46,581 ERROR [STDERR] 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
19:28:46,582 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
19:28:46,582 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
19:28:46,582 ERROR [STDERR] 	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
19:28:46,582 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
19:28:46,582 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
19:28:46,582 ERROR [STDERR] 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
19:28:46,582 ERROR [STDERR] 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
19:28:46,582 ERROR [STDERR] 	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
19:28:46,583 ERROR [STDERR] 	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
19:28:46,583 ERROR [STDERR] 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
19:28:46,583 ERROR [STDERR] 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
19:28:46,583 ERROR [STDERR] 	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
19:28:46,583 ERROR [STDERR] 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
19:28:46,583 ERROR [STDERR] 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
19:28:46,583 ERROR [STDERR] 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
19:28:46,583 ERROR [STDERR] 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
19:28:46,583 ERROR [STDERR] 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
19:28:46,583 ERROR [STDERR] 	at java.lang.Thread.run(Thread.java:619)
19:28:46,583 ERROR [STDERR] Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!
19:28:46,583 ERROR [STDERR] 	at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
19:28:46,583 ERROR [STDERR] 	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:529)
19:28:46,586 ERROR [STDERR] 	at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
19:28:46,586 ERROR [STDERR] 	at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:83)
19:28:46,586 ERROR [STDERR] 	at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
19:28:46,586 ERROR [STDERR] 	at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
19:28:46,586 ERROR [STDERR] 	at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
19:28:46,586 ERROR [STDERR] 	at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1700)
19:28:46,586 ERROR [STDERR] 	at org.hibernate.loader.Loader.doQuery(Loader.java:801)
19:28:46,586 ERROR [STDERR] 	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
19:28:46,586 ERROR [STDERR] 	at org.hibernate.loader.Loader.doList(Loader.java:2542)
19:28:46,586 ERROR [STDERR] 	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
19:28:46,586 ERROR [STDERR] 	at org.hibernate.loader.Loader.list(Loader.java:2271)
19:28:46,586 ERROR [STDERR] 	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:459)
19:28:46,586 ERROR [STDERR] 	at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:365)
19:28:46,586 ERROR [STDERR] 	at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
19:28:46,586 ERROR [STDERR] 	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268)
19:28:46,586 ERROR [STDERR] 	at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
19:28:46,588 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:921)
19:28:46,588 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:912)
19:28:46,588 ERROR [STDERR] 	at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)
19:28:46,588 ERROR [STDERR] 	... 47 more
19:28:46,588 ERROR [STDERR] Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
19:28:46,588 ERROR [STDERR] 	at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1319)
19:28:46,588 ERROR [STDERR] 	at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
19:28:46,588 ERROR [STDERR] 	at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
19:28:46,588 ERROR [STDERR] 	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)
19:28:46,588 ERROR [STDERR] 	... 66 more

Oracle service has been started, but an error was reported when executing the query statement. I failed to connect to the database with PLSQL tool, indicating that I did not listen. I remember that I shut down some services that you don’t often use this morning, and the PLSQL connection is normal after startup.

Baidu found that the following error information needs to be checked:
1. Wrong startup configuration: db.driverclass = oracle.jdbc.driver.oracledriver
2. Wrong database connection address: db.url = JDBC: Oracle: thin: @ 127.0.0.1:1521: orcl
3. Wrong account or password: db.user = spring
db.password = springpwd
4. No right to restrict access if the database is not started Ask. The database service or listening service is not started
5. The project does not introduce the corresponding driver jar package.
6. MySQL root does not have remote access permissions, so it needs to increase permissions.

Sending ‘const NSString *’ to parameter of type ‘NSString *’ discards qualifiers [Solved]

For example, write const NSString* firstString = @"xxx";
NSString* secondString = @"yyyy";
[secondString isEqualToString:firstString];
There is a warning about sending 'const NSString *' to parameter of type 'NSString *' discards qualifiers.
Workaround.
Change const NSString* firstString = @"xxx";
to NSString* const firstString = @"xxx";

Explanation: The former is equivalent to the pointer itself is not modifiable, the latter indicates that the content pointed to by the pointer is not modifiable, both serve to make firstString readable and unwritable only.

 

[Solved] sending const NSString * to parameter of type NSString * discards qualifiers

For example, I wrote

const NSString* firstString = @”xxx”;

NSString* secondString = @”yyy”;

[secondString isEqualToString:firstString];

 

The sending ‘const nsstring *’ to parameter of type ‘nsstring *’ discards qualifiers warning appears.

 

Solution:

Set const nsstring * firststring = @ “XXX”;

Change to nsstring * const firststring = @ “XXX”;

 

Explanation: the former means that the pointer itself is not modifiable, while the latter means that the content pointed to by the pointer is not modifiable. Both functions are to make the firststring only readable and not writable.

[Solved] Android Error: java.lang.IllegalStateException: Not allowed to start service Intent

Android error: java.lang.illegalstateexception: not allowed to start service intent

Error resolution 12

Today’s test threw me a crash message:

Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=xxx }: app is in background uid UidRecord{xxx u0a136 CEM idle procs:1 seq(0,0,0)}

Can it be hard for me
once you see it, you can see that it’s a background service startup error. Just put the service in the foreground, easy

In fact, Google took a look
https://stackoverflow.com/questions/46445265/android-8-0-java-lang-illegalstateexception-not-allowed-to-start-service-inten
The problem is that Android 8.0 does not allow the creation of background services.

Solution:

Method 1:

The simplest way is to directly open the front desk service
set the service to the front desk in oncreate of your service class

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
       startForeground(1, new Notification()); 
}

Of course, this method will show what is running on the status bar of Android 5.0 and 6.0 phones please refer to the following method

Method 2:

The method from here

first modify the service configuration in your manifest file

<service android:name=".YourService"
         android:permission="android.permission.BIND_JOB_SERVICE"/>

Then change the modification inheritance of your service class to extensions jobintentservice
and add the following code

    public static final int JOB_ID = 1;

    public static void enqueueWork(Context context, Intent work) {
        enqueueWork(context, YourService.class, JOB_ID, work);
    }

    @Override
    protected void onHandleWork(@NonNull Intent intent) {
        // your code
    }

The startup service is modified as follows.

YourService.enqueueWork(context, new Intent());

However, I tested that the content in onstartcommand() does not execute. No reason has been found
I hope you can help me with the analysis.

It’s over

How to Solve VMware Workstation Error: The VMware Authorization Service is not running.

An error is reported when opening the virtual machine (as shown in the figure below), and starting the virtual machine fails due to the following error:

wKiom1T7pBeiN5AxAABl_Dp-Pys213.jpg

Solution:

the reason:

This problem may occur when the VMware Authorization service is not running or the service does not have administrator rights.

To solve this problem, please start the service and make sure that it does have administrator rights.

To start the VMware Authorization service or check whether it is running, follow these steps:

  1. Log in to the Windows operating system as an administrator.
  2. Click Start , and then click Run .
  3. Type services.msc and click OK
  4. Scroll down the displayed list to find the VMware Authorization service
  5. Click to start this service , unless the status displayed for this service is already started.

Note : The VMware Authorization service depends on the Windows Management Instrumentation service. The service must also be running. If the VMware Authorization service fails to start or stops after starting, find and start the Windows Management Instrumentation service.

If the VMware Authorization service displays the status as started, it means that the service may not have administrator rights. To provide administrator rights to the VMware Authorization service

Start-run, enter: services.msc, open “services”. Find the VMware Authorization Service service, start this service, modify its properties, and change the startup type to “automatic”.

How to Solve VMware Workstation Error: This virtual machine appears to be in use.

This may be a bug of VMware Workstation. When the virtual machine in VMware Workstation is running, it is shut down or restarted abnormally. As a result, when we restart the virtual machine again, it will prompt “The Virtual Machine Appears to be in use”, and the virtual machine cannot be started.

wKioL1T7nmXDseDrAACtfDZMG2k161.jpg

PS: This lck file is the disk lock file of the virtual machine. We know that the disk of the virtual machine and the disk of the host coexist, but due to the use of a specific virtual mechanism, the two do not affect each other. When using a virtual machine, vmware will generate a number of disk lock files to protect the disk occupied by the current virtual machine from being modified by the host or other virtual machines. After the virtual machine is shut down normally, vmware will automatically delete this lock. However, in a few cases, such as a sudden host crash, abnormal shutdown, etc., vmware cannot delete the lck disk lock file. So next time you start the virtual machine, vmware will mistakenly believe that the virtual system that needs to be started is already running, and the above this virtual machine appears to be in use error appears. After deleting the file, it can return to normal.

【Solution】

The repair method is very simple. Go to the corresponding virtual machine directory and delete the %virtual machine name%.vmx.lck folder or the files in it. If there is still an error, you need to restart the host.

  • Yes, if you are certain that the guest is truly not running, go to the guest’s folder and delete any .lck files and folders. Delete the folders with .lck file extension.
  • If you can’t delete these files, make sure to close VMware workstation program and then try.
  • After deleting above .lck folders and files, I could able to successfully start virtual machine on VMware workstation 10.

[Solved] Android Gradle Build Error: Some file crunching failed, see logs for details

Error Message: Error:java.lang.RuntimeException: Some file crunching failed, see logs for details

 

 

Log:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ‘:app:mergeDebugResources’.
> Error: java.lang.RuntimeException: Crunching Cruncher ic_default_home_new.png failed, see logs

* Try:
Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output.

 

 

The solution is as follows:

1  android {
 2      compileSdkVersion 23
 3      buildToolsVersion "23.0.3"
 4      

5 aaptOptions { 6 cruncherEnabled = false 7 useNewCruncher = false 8 9 }

 10      defaultConfig {
 11          applicationId "com.xxx.xxx"
 12          minSdkVersion 15
 13          targetSdkVersion 22
 14          versionCode 2
 15          versionName "1.0.2"
 16          ndk {
 17              // Set the supported SO library architecture 
18             abiFilters 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
19         }
20     }
21 }

 

 

What is the reason for this error?

1. When building Gradle, Gradle will check whether the file extension has been modified;

2. Generally, most of them appear on pictures. This problem occurs when .jpg is modified to .png;

This problem may also occur with 3.9 patch pictures.

 

 

[Solved] Error C1189: #error: Please use the /MD switch for _AFXDLL builds

An error occurred when compiling the program in VS 2013:

Error message 1:

error C1189: #error: Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]

Reason :

The conventional one is: use MFC in the static library, or use the standard Windows library, at this time, no matter what it is, an error may be reported.

The multi-threaded debugging in the runtime library is: MDd (multi-threaded debugging DLL)

Solution :

Change MDd to MTd. If error 2 is reported after correction, change it as follows.

 

Error message 2:

error C1189: #error: Please use the /MD switch for _AFXDLL builds 

Reason :

The conventional one is: use MFC in a shared DLL,

The multi-threaded debugging in the runtime library is: MTd (multi-threaded debugging)

Solution :

Change the general to: use MFC in the static library, or use the standard Windows library

 

Conventional and runtime libraries are as follows:

General: Right-click the project -> Properties -> Configuration Properties -> General, and then select “Use MFC in a static library” in the “Use of MFC” option in the “Project Defaults” on the right,

Multi-threaded debugging: Right-click the project–>Properties->Configuration Properties->c/c++->Code Generation->Runtime Library->Multithreaded Debugging (/MTd)

 

Related notes:

There are three settings for the use of MFC : 

 1. Use standard Windows libraries

 2. Use MFC in the static library: it is to write the relevant code in the DLL into the EXE file, the file is larger, but it can be run on the machine without the relevant DLL;

 3. Use MFC in a shared DLL: It means that the content of some MFC DLLs is not included in the EXE file when packaging, so the EXE file is small, but the system requires related DLL files at runtime;

Multi-threaded debugging

/MD: Use multithreading in the dll to create the release version of the dynamic link library, which needs to be selected.

/MT: Use multithreading in exe to create a release version of exe, which needs to be selected.

/MTd: Same as /MT, but used in the Debug version.

/MDL: Same as /MD, but used in the Debug version.

 

If it is Debug’s “Use MFC in a static library”, don’t use MDd, use MTd instead, and then compile it to pass.

If it is Debug’s “Use MFC in shared DLL”, be careful not to use MTd, use MDd instead;

If it is the Release version “use MFC in static library”, don’t use MD, use MT;

If it is the Release version of “Use MFC in a shared DLL”, do not use MT, use MD.