12-27-2016 04:59 AM
Hello,
I have installed Alfresco and I have running Postgres DB.
I have also generated new maven alfresco-amp-archetype project.
By default it uses H2 DB, however I am trying to connect to the Postgres DB which is created after the installation of Alfresco on my localmachine.
I added the following data in the pom.xml
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<dependencies>
<!-- https://mvnrepository.com/artifact/postgresql/postgresql -->
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
and
<properties>
<alfresco.db.name>alfresco</alfresco.db.name>
<alfresco.db.username>postgres</alfresco.db.username>
<alfresco.db.password>admin</alfresco.db.password>
<alfresco.db.host>localhost</alfresco.db.host>
<alfresco.db.port>5433</alfresco.db.port>
<alfresco.db.url>jdbcostgresql://${alfresco.db.host}:${alfresco.db.port}/${alfresco.db.name}</alfresco.db.url>
<alfresco.db.datasource.class>org.postgresql.Driver</alfresco.db.datasource.class>
</properties>
However I receive the below exception:
2016-12-27 11:49:50,741 ERROR [domain.schema.SchemaBootstrap] [localhost-startStop-1] Schema auto-update failed
org.alfresco.error.AlfrescoRuntimeException: 11270000 A previous schema upgrade failed or was not completed. Revert to the original database before attempting the upgrade again.
at org.alfresco.repo.domain.schema.SchemaBootstrap.onBootstrap(SchemaBootstrap.java:1716)
at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:56)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEventInternal(SafeApplicationEventMulticaster.java:207)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:178)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:950)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
2016-12-27 11:49:50,762 ERROR [web.context.ContextLoader] [localhost-startStop-1] Context initialization failed
org.alfresco.error.AlfrescoRuntimeException: 11270001 Schema auto-update failed
at org.alfresco.repo.domain.schema.SchemaBootstrap.onBootstrap(SchemaBootstrap.java:1802)
at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:56)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEventInternal(SafeApplicationEventMulticaster.java:207)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:178)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:950)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.alfresco.error.AlfrescoRuntimeException: 11270000 A previous schema upgrade failed or was not completed. Revert to the original database before attempting the upgrade again.
at org.alfresco.repo.domain.schema.SchemaBootstrap.onBootstrap(SchemaBootstrap.java:1716)
... 19 more
Dec 27, 2016 11:49:50 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.alfresco.web.app.ContextLoaderListener
org.alfresco.error.AlfrescoRuntimeException: 11270001 Schema auto-update failed
at org.alfresco.repo.domain.schema.SchemaBootstrap.onBootstrap(SchemaBootstrap.java:1802)
at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:56)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEventInternal(SafeApplicationEventMulticaster.java:207)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:178)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:950)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.alfresco.error.AlfrescoRuntimeException: 11270000 A previous schema upgrade failed or was not completed. Revert to the original database before attempting the upgrade again.
at org.alfresco.repo.domain.schema.SchemaBootstrap.onBootstrap(SchemaBootstrap.java:1716)
... 19 more
Dec 27, 2016 11:49:50 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.alfresco.web.app.ContextListener
org.alfresco.error.AlfrescoRuntimeException: 11270001 Schema auto-update failed
at org.alfresco.repo.domain.schema.SchemaBootstrap.onBootstrap(SchemaBootstrap.java:1802)
at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:56)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEventInternal(SafeApplicationEventMulticaster.java:207)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:178)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:950)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.alfresco.error.AlfrescoRuntimeException: 11270000 A previous schema upgrade failed or was not completed. Revert to the original database before attempting the upgrade again.
at org.alfresco.repo.domain.schema.SchemaBootstrap.onBootstrap(SchemaBootstrap.java:1716)
... 19 more
Dec 27, 2016 11:49:50 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.alfresco.repo.webdav.WebDAVSessionListener
org.alfresco.error.AlfrescoRuntimeException: 11270001 Schema auto-update failed
at org.alfresco.repo.domain.schema.SchemaBootstrap.onBootstrap(SchemaBootstrap.java:1802)
at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:56)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEventInternal(SafeApplicationEventMulticaster.java:207)
at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:178)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:950)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.alfresco.error.AlfrescoRuntimeException: 11270000 A previous schema upgrade failed or was not completed. Revert to the original database before attempting the upgrade again.
at org.alfresco.repo.domain.schema.SchemaBootstrap.onBootstrap(SchemaBootstrap.java:1716)
... 19 more
Could someone advise how to change the default DB H2 to Postgres's DB from Alfresco installation?
Thank you in advance.
12-27-2016 06:00 AM
It appears you have already successfully switched from H2 to PostgreSQL, but now have run into a secondary issue. The PostgreSQL database seems to have already been partially initialised by one startup / test attempt but stopped somewhere before completion. Now Alfresco detects this and stops, since it can't determine what is already there and what is missing. The best way to proceed would be to drop + recreate the database in PostgreSQL and start your project again.
These kind of "DB management" issues are why Alfresco SDK uses H2 by default. It is easier to just run a "mvn clean -P purge" and then the tests again with a clean slate, than to require the user to manage an external database server.
12-27-2016 11:19 AM
I did so, however there are some other conflicts
2016-12-27 17:47:37,387 ERROR [domain.schema.SchemaBootstrap] [localhost-startStop-1] Schema auto-update failed
org.postgresql.util.PSQLException: ERROR: column "was_executed" is of type boolean but expression is of type integer
Hint: You will need to rewrite or cast the expression.
Position: 363
I think I changed the type in the sql script , but again the above exception appears
is there any chance not to run these scripts?
Im not sure how all that is working, but is there another way of solving this issue?
12-27-2016 11:38 AM
Why do you want to connect your Alfresco AMP project to the PostgreSQL database in the first place? I can think of no real reason to do so and the H2 database works just fine for local builds + tests. The Alfresco AMP project also is separate from your local Alfresco installation in that the former is only used for the build of customisations. Once you install the resulting AMP file into your Alfresco installation it will automatically use your PostgreSQL instance.
Also, you should normally not change anything in any SQL script. Alfresco already provides PostgreSQL compatible SQL scripts out-of-the-box. If there is an error like this it likely means that there is either an incompatibility with the version of the database or the wrong scripts are being used in the first place.
12-28-2016 03:26 AM
The one reason is because I want to debug the data which comes from the Alfresco installation( I have installed some additional things there), in order to test it I have to install my amp there, yes, but I will not be in debugging mode.
The second reason is that since my project is simple amp, I don't have share ui and cannot create sites for testing.
In general, I have changed the port for the Alfresco installation to 8081 in order not to have any conflicts when I run my project on 8080.
12-28-2016 03:47 AM
You can configure your Tomcat so that you can debug it: Tomcat Wiki - Developing
12-28-2016 10:31 AM
If debugging is the only reason for changing DB from H2 to PostgreSQL, then I believe you don't have to do it.
Use mvndebug command to debug your alfresco-amp-archetype project.
I am not sure which version of alfresco maven sdk are you using but you can refer this blog to debug IT Tips: How to remote debug Java code using Alfresco SDK 2.1 .
12-29-2016 08:39 AM
Well, In general I know how to debug my project..
The problem is that I want to have some data (sites) in order to test.
1st I have them in Postgres DB which is used by my alfresco installation.
2nd If I cannot connect to it then I will need to connect to Share UI somehow when Im running the project though my IDE in order to be able to create Sites properly(through the webscript).
12-29-2016 01:02 PM
Having base data in order to test is a matter of bootstrapping the content either by using a module-based startup component or by importing a prepared content bundle (ACP) via an action. There is no need to try some kind of hacky access to an external database for this, especially since such a hack may disrupt your existing database.
03-16-2017 08:29 PM
Well, this blog post explains about how to get activiti working with postgres DB. See, if this helps.
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.