DB error on initializing NodeRef with Service Registry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2019 04:25 AM
I was trying to initialize a NodeRef on Bean initialization but got error for Authentication so i tried to run my code under Authentication.runAs(...) now i'm getting the below error on application restart.
My Code:
public void init() { // this has been refrenced as "init-method" in the service-context.xml
doclibNode = AuthenticationUtil.runAs(new RunAsWork<NodeRef>() {
@Override
public NodeRef doWork() throws Exception {
return getDocLibNode(); // also tried this without AuthenticationUtil.runAs(...)
}
}, AuthenticationUtil.getSystemUserName());
}
private NodeRef getDocLibNode() { // stores the document library node in a class variable
LOG.info(siteId + ", " + containerId); // fetch these from properties
return serviceRegistry.getSiteService().getContainer(siteId, containerId); // returns docLib Node
}
Error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myService' defined in class path resource [alfresco/module/${my-modul-name}/context/service-context.xml]: Invocation of init method failed; nested exception is org.springframework.jdbc.BadSqlGrammarException:
### Error querying database. Cause: org.apache.commons.dbcp.SQLNestedException: Borrow prepareStatement from pool failed
### The error may exist in alfresco/ibatis/#resource.dialect#/node-common-SqlMap.xml
### The error may involve alfresco.node.select_StoreRootNodeByRef
### The error occurred while executing a query
### SQL: select node.id as id, node.version as version, store.id as store_id, store.protocol as protocol, store.identifier as identifier, node.uuid as uuid, node.type_qname_id as type_qname_id, node.locale_id as locale_id, node.acl_id as acl_id, txn.id as txn_id, txn.change_txn_id as txn_change_id, node.audit_creator as audit_creator, node.audit_created as audit_created, node.audit_modifier as audit_modifier, node.audit_modified as audit_modified, node.audit_accessed as audit_accessed from alf_store store join alf_node node on (store.root_node_id = node.id) join alf_transaction txn on (txn.id = node.transaction_id) where store.protocol = ? and store.identifier = ?
### Cause: org.apache.commons.dbcp.SQLNestedException: Borrow prepareStatement from pool failed
; bad SQL grammar []; nested exception is org.apache.commons.dbcp.SQLNestedException: Borrow prepareStatement from pool failed
.......
I'm using SDK 3.0.1. full error is in attachment
Abbas
- Labels:
-
Alfresco Content Services
