Camel - Catching global exceptions - apache-camel

I have a lot of transformations in my routes and sometime some of them is failing due to some bad formed file or other reasons, so when some exception arise I have to send an email. So in the context I've declared the following:
<camel:onException useOriginalMessage="true">
<camel:exception>javax.xml.transform.TransformerException</camel:exception>
<camel:redeliveryPolicy maximumRedeliveries="3"/>
<camel:to uri="smtp://localhost:25?From=noreply-esb#me.com&To=me#me.com" />
</camel:onException>
But it is like nothing happen because my camel is retring to do the transformation without stopping and also the email is not sent.
This is the log:
2013-02-01 14:55:09,645 | WARN | ox/products_list | GenericFileOnCompletion | ? ? | 92 - org.apache.camel.camel-core - 2.8.5 | Rollback file strategy: org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy#6fc72332 for file: GenericFile[/opt/servicemix/data/smx-data/outbox/products_list/product_export.xml]
2013-02-01 14:55:10,238 | ERROR | ox/products_list | DefaultErrorHandler | ? ? | 92 - org.apache.camel.camel-core - 2.8.5 | Failed delivery for exchangeId: ID-esb1-prod-prod-thesting-cyso-net-44582-1359563246542-5-1329. Exhausted after delivery attempt: 1 caught: javax.xml.transform.TransformerException: XML document structures must start and end within the same entity.
javax.xml.transform.TransformerException: XML document structures must start and end within the same entity.
at org.apache.xalan.transformer.TransformerImpl.fatalError(TransformerImpl.java:780)[:]
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:756)[:]
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1273)[:]
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1251)[:]
at org.apache.camel.builder.xml.XsltBuilder.process(XsltBuilder.java:123)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:102)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:72)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:48)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:114)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:284)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:109)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:90)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:306)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:116)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:79)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:111)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:61)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:114)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:284)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:109)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:90)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:306)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:111)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:61)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:114)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:284)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:109)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:90)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:306)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:139)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:106)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:573)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:506)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:219)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:90)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:306)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:139)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:106)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:353)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:176)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:137)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:139)[92:org.apache.camel.camel-core:2.8.5]
at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:91)[92:org.apache.camel.camel-core:2.8.5]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_26]
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)[:1.6.0_26]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)[:1.6.0_26]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)[:1.6.0_26]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)[:1.6.0_26]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)[:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_26]
at java.lang.Thread.run(Thread.java:662)[:1.6.0_26]
Am I doing something wrong?

If a transformation failes, it is very unlikely that it will complete the next time - the data is wrong. So redelivery policy for your case is a bit point less.
However, try setting the exception to handled and then your smtp endpoint.
<camel:handled>
<camel:constant>true</camel:constant>
</camel:handled>

Related

FOS User bundle : Column 'salt' cannot be null during change password

Previously, the app was in PHP7.0, SF 3.1, and FOS/UserBundle 2.0.
After the migration to PHP7.2 with SF 3.4 and FOS/UserBundle 2.1, during a change password, I encounter that:
$ bin/console fos:user:change-password toto pass1234
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'salt' cannot be null" ["exception" => Doctrine\DBAL\Exception\NotNullConstraintViolationException { …},"command" => "fos:user:change-password toto pass1234","message" => """ An exception occurred while executing 'UPDATE fos_user SET salt = ?, password = ? WHERE id = ?' with params [null, "$2y$13$LOb\/************************************wof0QpTGGpzGi", 2]:\n \n SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'salt' cannot be null """] []
In AbstractMySQLDriver.php line 123:
An exception occurred while executing 'UPDATE fos_user SET salt = ?, password = ? WHERE id = ?' with params [null, "$2y$13$LOb\/************************************wof0QpTGGpzGi", 2]:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'salt' cannot be null
In PDOStatement.php line 144:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'salt' cannot be null
In PDOStatement.php line 142:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'salt' cannot be null
fos:user:change-password [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> <username> <password>
Solved!
I edited file app/config/security.yml and replace the value of security.encoders.FOS\UserBundle\Model\UserInterface (which was bcrypt) with argon2i.
Then I cleared the cache, retried, and that worked!
https://symfony.com/doc/current/reference/configuration/security.html#reference-security-argon2i

liquibase.exception.DatabaseException: ERROR: relation "container" already exists

I'm working on an application with liquibase, spring-boot and hibernate.
The database used is PostgreSQL. In order to populate the DB at startup I configured a data.sql file in src/main/resources, containing some insert statements.
In addition, after the boot there is also liquibase trying to apply all the changesets, one of them being the creation of a table populated using the data.sql file. So I get the following non blocking error, when executing the mvn cmd to start the app:
2018-04-25 14:33:53.417 ERROR 11060 --- [neut-Executor-1] liquibase : classpath:config/liquibase/master.xml: config/liquibase/changelog/20180424154826_added_entity_Container.xml::20180424154826-1::jhipster: Change Set config/liquibase/changelog/20180424154826_added_entity_Container.xml::20180424154826-1::jhipster failed. Error: ERROR: relation "container" already exists [Failed SQL: CREATE TABLE public.container (id BIGINT NOT NULL, name VARCHAR(255) NOT NULL, description VARCHAR(2000), container_type VARCHAR(255), created TIMESTAMP WITHOUT TIME ZONE, CONSTRAINT PK_CONTAINER PRIMARY KEY (id))]
2018-04-25 14:33:53.453 ERROR 11060 --- [neut-Executor-1] i.g.j.c.liquibase.AsyncSpringLiquibase : Liquibase could not start correctly, your database is NOT ready: Migration failed for change set config/liquibase/changelog/20180424154826_added_entity_Container.xml::20180424154826-1::jhipster:
Reason: liquibase.exception.DatabaseException: ERROR: relation "container" already exists [Failed SQL: CREATE TABLE public.container (id BIGINT NOT NULL, name VARCHAR(255) NOT NULL, description VARCHAR(2000), container_type VARCHAR(255), created TIMESTAMP WITHOUT TIME ZONE, CONSTRAINT PK_CONTAINER PRIMARY KEY (id))]
liquibase.exception.MigrationFailedException: Migration failed for change set config/liquibase/changelog/20180424154826_added_entity_Container.xml::20180424154826-1::jhipster:
Reason: liquibase.exception.DatabaseException: ERROR: relation "container" already exists [Failed SQL: CREATE TABLE public.container (id BIGINT NOT NULL, name VARCHAR(255) NOT NULL, description VARCHAR(2000), container_type VARCHAR(255), created TIMESTAMP WITHOUT TIME ZONE, CONSTRAINT PK_CONTAINER PRIMARY KEY (id))]
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:619)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:51)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:79)
at liquibase.Liquibase.update(Liquibase.java:214)
at liquibase.Liquibase.update(Liquibase.java:192)
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:431)
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:388)
at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.initDb(AsyncSpringLiquibase.java:94)
at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.lambda$afterPropertiesSet$0(AsyncSpringLiquibase.java:77)
at io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor.lambda$createWrappedRunnable$1(ExceptionHandlingAsyncTaskExecutor.java:68)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: liquibase.exception.DatabaseException: ERROR: relation "container" already exists [Failed SQL: CREATE TABLE public.container (id BIGINT NOT NULL, name VARCHAR(255) NOT NULL, description VARCHAR(2000), container_type VARCHAR(255), created TIMESTAMP WITHOUT TIME ZONE, CONSTRAINT PK_CONTAINER PRIMARY KEY (id))]
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:309)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:113)
at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1277)
at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1259)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:582)
... 12 common frames omitted
Caused by: org.postgresql.util.PSQLException: ERROR: relation "container" already exists
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2455)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2155)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:288)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:430)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:356)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:303)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:289)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:266)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:262)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:114)
at com.sun.proxy.$Proxy129.execute(Unknown Source)
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:307)
... 17 common frames omitted
What I'm thinking is that the hibernate executing the data.sql gets executed just a moment before the liquibase migration process, so maybe there should be a way to avoid this exception. Is it possible to force the execution of hibernate importing data.sql to happen after liquibase migration?
you have to decide by which mechanism do you want to execute the changes. So you can use hibernate to create your tables and insert data or you can use liquibase to create you tables and data not both at the same time. What I was doing on previous projects was setting the hibenate to only validate mode spring.jpa.hibernate.ddl-auto=validateand using liquibase to create tables and insert data.

phoenix ecto relationships on delete

There are two models: resource and metadata:
defmodule Myapp.Repo.Migrations.CreateResources do
use Ecto.Migration
def change do
create table(:resources) do
add :name, :string
add :parent_id, references(:resources, on_delete: :delete_all)
timestamps
end
create index(:resources, [:parent_id])
end
end
defmodule Myapp.Repo.Migrations.CreateMetadata do
use Ecto.Migration
def change do
create table(:metadata) do
add :size, :integer
add :resource_id, references(:resources)
timestamps
end
create index(:metadata, [:resource_id])
end
end
schema "resources" do
field :name, :string
belongs_to :parent, Myapp.Resource
has_one :metadata, Myapp.Metadata, on_delete: :delete_all
has_many :childs, Myapp.Resource, foreign_key: :parent_id, on_delete: :delete_all
timestamps()
end
schema "metadata" do
field :size, :integer
belongs_to :resource, Myapp.Resource
timestamps()
end
resource can have children, which parent_id = id.
also has a resource metadata. Table Metadata has resource_id column.
Now, I want to delete the resource with the remove all his children, and all associated metadata.
when I write
Repo.delete resource
I get an error:
[error] #PID<0.441.0> running Myapp.Endpoint terminated
Server: localhost:4000 (http)
Request: POST /resources/%2Fdocs%2Ftest
** (exit) an exception was raised:
** (Postgrex.Error) ERROR (foreign_key_violation): update or delete on table "resources" violates foreign key constraint "metadata_resource_id_fkey" on table "metadata"
table: metadata
constraint: metadata_resource_id_fkey
Key (id)=(3) is still referenced from table "metadata".
that appears only when triggered to remove metadata from a resource children. If I try to delete a resource that has no childrens, then everything is working correctly.
Apparently, does not cause the removal of the children required callbacks removing metadata, so Postgres an error.
Whether it is possible to solve this problem without suffering from resource_id metadata metadata_id resource and without starting a recursive manual removal of all the children of the resource?
:delete_all does not cascade to child records unless set via database migrations. To fix the problem make sure you change your metadata migration script line to
add :resource_id, references(:resources, on_delete: :delete_all)

SOLR failed to create index for Cassandra 2.1.1 list which have user defined data type

I m trying to integrate Cassandra 2.1.1 with SOLR, but SOLR failed to
create index with following error message.
16767 [qtp297774990-12] INFO org.apache.solr.handler.dataimport.DataImporter – Loading DIH Configuration: dataconfigCassandra.xml
16779 [qtp297774990-12] INFO org.apache.solr.handler.dataimport.DataImporter – Data Configuration loaded successfully
16788 [Thread-15] INFO org.apache.solr.handler.dataimport.DataImporter – Starting Full Import
16789 [qtp297774990-12] INFO org.apache.solr.core.SolrCore – [Entity_dev] webapp=/solr path=/dataimport params={optimize=false&indent=true&clean=true&commit=true&verbose=false&command=full-import&debug=false&wt=json} status=0 QTime=27
16810 [qtp297774990-12] INFO org.apache.solr.core.SolrCore – [Entity_dev] webapp=/solr path=/dataimport params={indent=true&command=status&_=1416042006354&wt=json} status=0 QTime=0
16831 [Thread-15] INFO org.apache.solr.handler.dataimport.SimplePropertiesWriter – Read dataimport.properties
16917 [Thread-15] INFO org.apache.solr.search.SolrIndexSearcher – Opening Searcher#6214b0dc[Entity_dev] realtime
16945 [Thread-15] INFO org.apache.solr.handler.dataimport.JdbcDataSource – Creating a connection for entity Entity with URL: jdbc:cassandra://10.234.31.153:9160/galaxy_dev
17082 [Thread-15] INFO org.apache.solr.handler.dataimport.JdbcDataSource – Time taken for getConnection(): 136
17429 [Thread-15] ERROR org.apache.solr.handler.dataimport.DocBuilder – Exception while processing: Entity document : SolrInputDocument(fields: []):org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: select * from entity Processing Document # 1
at
org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:71)
at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:283)
at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:240)
at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:44)
at org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:59)
at org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:73)
at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:243)
at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:476)
at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:415)
at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:330)
at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:232)
at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:416)
at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:480)
at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:461)
Caused by: java.lang.NullPointerException
at org.apache.cassandra.cql.jdbc.ListMaker.compose(ListMaker.java:61)
at org.apache.cassandra.cql.jdbc.TypedColumn.<init>(TypedColumn.java:68)
at org.apache.cassandra.cql.jdbc.CassandraResultSet.createColumn(CassandraResultSet.java:1174)
at org.apache.cassandra.cql.jdbc.CassandraResultSet.populateColumns(CassandraResultSet.java:240)
at org.apache.cassandra.cql.jdbc.CassandraResultSet.<init>(CassandraResultSet.java:200)
at org.apache.cassandra.cql.jdbc.CassandraStatement.doExecute(CassandraStatement.java:169)
at org.apache.cassandra.cql.jdbc.CassandraStatement.execute(CassandraStatement.java:205)
at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:276)
... 12 more
CREATE TABLE dev.entity (
id uuid PRIMARY KEY,
begining int,
domain text,
domain_type text,
template_name text,
****field_values list<frozen<fieldmap>>****
)
User Defined Type :
CREATE TYPE galaxy_dev.fieldmap (
key text,
value text );
Please let me know what driver or Jar use to create SOLR index for latest CASSANDRA.

Can't perform inter-node administrative Solr commands when Cassandra PasswordAuthenticator is enabled

Actions like core RELOAD/CREATE fail with the following message when Cassandra authentication is enabled:
WARN [SolrDistributedRequestTemplate thread-0] 2014-10-22 02:09:26,355 SolrCoreResourceManager.java (line 310) Error creating core myks.mycf on node: /111.222.333.444
WARN [SolrDistributedRequestTemplate thread-0] 2014-10-22 02:09:26,357 SolrCoreResourceManager.java (line 310) Error creating core myks.mycf on node: /222.333.444.555
WARN [SolrDistributedRequestTemplate thread-0] 2014-10-22 02:09:26,360 SolrCoreResourceManager.java (line 310) Error creating core myks.mycf on node: /333.444.555.666
WARN [SolrDistributedRequestTemplate thread-0] 2014-10-22 02:09:26,365 SolrCoreResourceManager.java (line 310) Error creating core myks.mycf on node: /444.555.666.777
WARN [SolrDistributedRequestTemplate thread-0] 2014-10-22 02:09:26,368 SolrCoreResourceManager.java (line 310) Error creating core myks.mycf on node: /555.666.777.888
The same actions succeed when I disable authentication. Is this a known bug?
Probably related to this
EDIT:
My users and permissions:
[cqlsh 4.1.1 | Cassandra 2.0.10.71 | DSE 4.5.2 | CQL spec 3.1.1 | Thrift protocol 19.39.0]
Use HELP for help.
cqlsh> select * from system_auth.users;
name | super
--------------------------------------+-------
node682507b669a04443b3af75916a2ccd7d | False
nodea41d1fc13e784e41ba0a925d95f26953 | False
nodeba7fb6409207469db924db64841e9e9e | False
node69d6ac2ff17348ca80ab00921c455440 | False
cassandra | False
node98c907bc0f2b4225b3823616627ed309 | False
node61a9d13323504e7b019c97292a1cdb6b | False
dse_admin | True
The failing CREATE/RELOAD commands look something like:
curl -u dse_admin:password "http://111.222.333.444:8983/solr/admin/cores?action=CREATE&name=myks.mycf"
Definition of system_auth keyspace:
cqlsh> describe keyspace system_auth;
CREATE KEYSPACE system_auth WITH replication = {
'class': 'NetworkTopologyStrategy',
'DC2': '3'
};
Definition of myks keyspace:
cqlsh> describe keyspace myks;
CREATE KEYSPACE myks WITH replication = {
'class': 'NetworkTopologyStrategy',
'DC2': '2'
};

Resources