Page 1 of 2

SolrSearchServiceImpl.rebuildIndex exception

Posted: Thu Nov 29, 2012 11:14 am
by om.singh
I have created a parallel project to site of my own similar to the one available in heatclinic application. I am using broadleaf version 2.0.0.GA. I have my own sql folder ( modified to suit my project).

I noticed that sql folder is now maintanined in the core project. Hence i replaced the sql folder with my own sql folder(its the same files, but different catalog and content).

When i kick off the jetty-demo from the build script of my project( similar to site), the data is getting loaded fine but I keep getting the following

aused by: org.apache.solr.client.solrj.SolrServerException: org.apache.solr.client.solrj.SolrServerException: org.apache.solr.common.SolrException: missing content stream
[artifact:mvn] at org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:155)
[artifact:mvn] at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:105)
[artifact:mvn] at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:69)
[artifact:mvn] at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:54)
[artifact:mvn] at org.broadleafcommerce.core.search.service.solr.SolrSearchServiceImpl.rebuildIndex(SolrSearchServiceImpl.java:204)
[artifact:mvn] ... 20 more
[artifact:mvn] Caused by: org.apache.solr.client.solrj.SolrServerException: org.apache.solr.common.SolrException: missing content stream
[artifact:mvn] at org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:144)
[artifact:mvn] ... 24 more
[artifact:mvn] Caused by: org.apache.solr.common.SolrException: missing content stream
[artifact:mvn] at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:53)
[artifact:mvn] at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
[artifact:mvn] at org.apache.solr.core.SolrCore.execute(SolrCore.java:1376)
[artifact:mvn] at org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:142)
[artifact:mvn] ... 24 more
[artifact:mvn] [ERROR] 16:03:47 ErrorLogger - Job (DEFAULT.rebuildIndexJobDetail threw an exception.
[artifact:mvn] org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: org.springframework.scheduling.quartz.JobMethodInvocationFailedException: Invocation of method 'rebuildIndex' on target class [class $Proxy126] failed; nested exception is org.broadleafcommerce.common.exception.ServiceException: Could not rebuild index]
[artifact:mvn] at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
[artifact:mvn] at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
[artifact:mvn] Caused by: org.springframework.scheduling.quartz.JobMethodInvocationFailedException: Invocation of method 'rebuildIndex' on target class [class $Proxy126] failed; nested exception is org.broadleafcommerce.common.exception.ServiceException: Could not rebuild index
[artifact:mvn] at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:320)
[artifact:mvn] at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:113)
[artifact:mvn] at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
[artifact:mvn] ... 1 more
[artifact:mvn] Caused by: org.broadleafcommerce.common.exception.ServiceException: Could not rebuild index
[artifact:mvn] at org.broadleafcommerce.core.search.service.solr.SolrSearchServiceImpl.rebuildIndex(SolrSearchServiceImpl.java:207)
[artifact:mvn] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[artifact:mvn] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[artifact:mvn] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[artifact:mvn] at java.lang.reflect.Method.invoke(Method.java:601)
[artifact:mvn] at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
[artifact:mvn] at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
[artifact:mvn] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
[artifact:mvn] at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
[artifact:mvn] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
[artifact:mvn] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
[artifact:mvn] at $Proxy126.rebuildIndex(Unknown Source)
[artifact:mvn] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[artifact:mvn] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[artifact:mvn] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[artifact:mvn] at java.lang.reflect.Method.invoke(Method.java:601)
[artifact:mvn] at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273)
[artifact:mvn] at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:311)
[artifact:mvn] ... 3 more
[artifact:mvn] Caused by: org.apache.solr.client.solrj.SolrServerException: org.apache.solr.client.solrj.SolrServerException: org.apache.solr.common.SolrException: missing content stream
[artifact:mvn] at org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:155)
[artifact:mvn] at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:105)
[artifact:mvn] at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:69)
[artifact:mvn] at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:54)
[artifact:mvn] at org.broadleafcommerce.core.search.service.solr.SolrSearchServiceImpl.rebuildIndex(SolrSearchServiceImpl.java:204)
[artifact:mvn] ... 20 more


Regards
Om

Re: SolrSearchServiceImpl.rebuildIndex exception

Posted: Fri Nov 30, 2012 11:24 am
by phillipuniverse
I believe this is caused by your database being empty. Can you check to see if this is the case? You might have an error in your SQL syntax somewhere.

Re: SolrSearchServiceImpl.rebuildIndex exception

Posted: Sat Dec 01, 2012 6:13 am
by om.singh
The data is loading well, as when I comment the solrEmbedded section from the application-context.xml, it will works fine.

In the start up logs I dont see any exception for the *sql files. I connect to the database using squirrel sql to to validate if catalog and other tables are getting populated.

Regards
Om

Re: SolrSearchServiceImpl.rebuildIndex exception

Posted: Fri Dec 28, 2012 2:23 am
by basavarajvs
I am facing similar issue when I use mysql.
If your issue is resolved, can you help me ?

Thanks and regards,
Basavaraj V S

Re: SolrSearchServiceImpl.rebuildIndex exception

Posted: Sat Dec 29, 2012 8:57 am
by broadleafer
I'm not an expert. But here is a suggestion. Check if these tables are being populated.

BLC_CAT_SEARCH_FACET_XREF
BLC_SEARCH_FACET
BLC_FIELD

Building index also fails when I'm adding a new field to solr and the field name does not exist in the schema.xml.

Looking at the stacktrace looks like it's failing at SolrSearchServiceImpl.java:204 and line 204 is is adding document to the server

server.add(documents);

and it's also saying "missing content stream". It really looks like that data is missing. Should check the above tables and should also check if List<Product> products = productDao.readAllActiveProducts(SystemTime.asDate()); is returning products in the method SolrSearchServiceImpl.rebuildIndex()

Cheers.

Re: SolrSearchServiceImpl.rebuildIndex exception

Posted: Mon Jan 14, 2013 5:19 pm
by dlavoie
Hello,

I currently encounter the same problem after trying to migrate to MySQL rather than HSSQL.

Before receiving that Solr exception, I noticed having the following stacktrace. That first exception makes sense with the previous explaination.

Code: Select all

[artifact:mvn] 2013-01-14 22:53:55.499:INFO:/:Initializing Spring root WebApplicationContext
[artifact:mvn] [ WARN] 22:54:02 RuntimeEnvironmentPropertiesConfigurer - Unable to determine runtime environment, using default environment 'development'
[artifact:mvn] [ERROR] 22:54:06 Ejb3Configuration - Container is providing a null PersistenceUnitRootUrl: discovery impossible
[artifact:mvn] [ WARN] 22:54:08 Ejb3Configuration - hibernate.connection.autocommit = false break the EJB3 specification
[artifact:mvn] [ WARN] 22:54:09 AbstractEhcacheRegionFactory - Couldn't find a specific ehcache configuration for cache named [blSandBoxElements]; using defaults.
[artifact:mvn] [ERROR] 22:56:22 SchemaExport - schema export unsuccessful
[artifact:mvn] org.hibernate.JDBCException: Error during import script execution at line 50
[artifact:mvn]    at org.hibernate.tool.hbm2ddl.SchemaExport.importScript(SchemaExport.java:370)
[artifact:mvn]    at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:276)
[artifact:mvn]    at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:219)
[artifact:mvn]    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:372)
[artifact:mvn]    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1872)
[artifact:mvn]    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:906)
[artifact:mvn]    at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)
[artifact:mvn]    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:268)
[artifact:mvn]    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
[artifact:mvn]    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
[artifact:mvn]    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
[artifact:mvn]    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)
[artifact:mvn]    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
[artifact:mvn]    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
[artifact:mvn]    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
[artifact:mvn]    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
[artifact:mvn]    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
[artifact:mvn]    at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:766)
[artifact:mvn]    at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:406)
[artifact:mvn]    at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:758)
[artifact:mvn]    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:242)
[artifact:mvn]    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1233)
[artifact:mvn]    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:701)
[artifact:mvn]    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:475)
[artifact:mvn]    at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:256)
[artifact:mvn]    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
[artifact:mvn]    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
[artifact:mvn]    at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:167)
[artifact:mvn]    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
[artifact:mvn]    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
[artifact:mvn]    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
[artifact:mvn]    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90)
[artifact:mvn]    at org.eclipse.jetty.server.Server.doStart(Server.java:272)
[artifact:mvn]    at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65)
[artifact:mvn]    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
[artifact:mvn]    at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:511)
[artifact:mvn]    at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:364)
[artifact:mvn]    at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:516)
[artifact:mvn]    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
[artifact:mvn]    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
[artifact:mvn]    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
[artifact:mvn]    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
[artifact:mvn]    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
[artifact:mvn]    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
[artifact:mvn]    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
[artifact:mvn]    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
[artifact:mvn]    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
[artifact:mvn]    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
[artifact:mvn]    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
[artifact:mvn]    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
[artifact:mvn]    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
[artifact:mvn]    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[artifact:mvn]    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[artifact:mvn]    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[artifact:mvn]    at java.lang.reflect.Method.invoke(Method.java:597)
[artifact:mvn]    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
[artifact:mvn]    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
[artifact:mvn]    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
[artifact:mvn]    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
[artifact:mvn]    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
[artifact:mvn] Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`dfbroadleaf`.`blc_cat_search_facet_xref`, CONSTRAINT `FK32210EEBB96B1C93` FOREIGN KEY (`SEARCH_FACET_ID`) REFERENCES `BLC_SEARCH_FACET` (`SEARCH_FACET_ID`))
[artifact:mvn]    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[artifact:mvn]    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
[artifact:mvn]    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
[artifact:mvn]    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
[artifact:mvn]    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
[artifact:mvn]    at com.mysql.jdbc.Util.getInstance(Util.java:386)
[artifact:mvn]    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1040)
[artifact:mvn]    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4096)
[artifact:mvn]    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4028)
[artifact:mvn]    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490)
[artifact:mvn]    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651)
[artifact:mvn]    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2728)
[artifact:mvn]    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2678)
[artifact:mvn]    at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:894)
[artifact:mvn]    at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:732)
[artifact:mvn]    at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
[artifact:mvn]    at org.hibernate.tool.hbm2ddl.SchemaExport.importScript(SchemaExport.java:366)
[artifact:mvn]    ... 65 more
[artifact:mvn] [ WARN] 22:56:22 AbstractEhcacheRegionFactory - Couldn't find a specific ehcache configuration for cache named [org.hibernate.cache.UpdateTimestampsCache]; using defaults.
[artifact:mvn] [ERROR] 22:56:25 Ejb3Configuration - Container is providing a null PersistenceUnitRootUrl: discovery impossible
[artifact:mvn] [ WARN] 22:56:25 Ejb3Configuration - hibernate.connection.autocommit = false break the EJB3 specification
[artifact:mvn] [ WARN] 22:56:29 IndexSchema - no uniqueKey specified in schema.
[artifact:mvn] [ERROR] 22:56:31 Ejb3Configuration - Container is providing a null PersistenceUnitRootUrl: discovery impossible
[artifact:mvn] [ WARN] 22:56:31 Ejb3Configuration - hibernate.connection.autocommit = false break the EJB3 specification
[artifact:mvn] 2013-01-14 22:56:35.501:INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/,file:/Users/dlavoie/Documents/Projets/DimensionFantastique/eclipse-workspace/DemoSite/site/target/dimensionFantastique/},file:/Users/dlavoie/Documents/Projets/DimensionFantastique/eclipse-workspace/DemoSite/site/target/dimensionFantastique/
[artifact:mvn] 2013-01-14 22:56:35.697:INFO:/:Initializing Spring FrameworkServlet 'dimensionFantastique'
[artifact:mvn] [ WARN] 22:56:36 RuntimeEnvironmentPropertiesConfigurer - Unable to determine runtime environment, using default environment 'development'
[artifact:mvn] 2013-01-14 22:56:38.503:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:8080
[artifact:mvn] [INFO] Started Jetty Server
[artifact:mvn] 2013-01-14 22:56:38.722:INFO:oejus.SslContextFactory:Enabled Protocols [SSLv2Hello, SSLv3, TLSv1] of [SSLv2Hello, SSLv3, TLSv1]
[artifact:mvn] 2013-01-14 22:56:38.723:INFO:oejs.AbstractConnector:Started SslSelectChannelConnector@0.0.0.0:8443
[artifact:mvn] [ERROR] 22:56:39 SolrCore - org.apache.solr.common.SolrException: missing content stream
[artifact:mvn]    at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:53)
[artifact:mvn]    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
[artifact:mvn]    at org.apache.solr.core.SolrCore.execute(SolrCore.java:1376)
[artifact:mvn]    at org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:142)
[artifact:mvn]    at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:105)
[artifact:mvn]    at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:69)
[artifact:mvn]    at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:54)


I have opened the load_catalog_data.sql file responsible of that exception and I have identified the following sql query.

Code: Select all

INSERT INTO BLC_CAT_SEARCH_FACET_XREF (CATEGORY_SEARCH_FACET_ID, CATEGORY_ID, SEARCH_FACET_ID, SEQUENCE) VALUES (1, 2002, 1, 1);


Considering that the line just before is the following :

Code: Select all

INSERT INTO BLC_SEARCH_FACET (SEARCH_FACET_ID, FIELD_ID, LABEL, SHOW_ON_SEARCH, MULTISELECT, SEARCH_DISPLAY_PRIORITY) VALUES (1, 1, 'Manufacturer', 0, 1, 0);


I don't understand how that exception is possible :

Code: Select all

[artifact:mvn] Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`dfbroadleaf`.`blc_cat_search_facet_xref`, CONSTRAINT `FK32210EEBB96B1C93` FOREIGN KEY (`SEARCH_FACET_ID`) REFERENCES `BLC_SEARCH_FACET` (`SEARCH_FACET_ID`))


Anyone has a clue to go further ?

Re: SolrSearchServiceImpl.rebuildIndex exception

Posted: Mon Jan 14, 2013 7:56 pm
by broadleafer
I think this is happening because you are inserting SEARCH_FACET_ID (foreign key) into BLC_CAT_SEARCH_FACET_XREF that does not exists.

Moving the BLC_SEARCH_FACET insert statement before the insert statement for BLC_CAT_SEARCH_FACET_XREF should fix this. Or just set SEARCH_FACET_ID for BLC_CAT_SEARCH_FACET_XREF to null.

Re: SolrSearchServiceImpl.rebuildIndex exception

Posted: Tue Jan 15, 2013 3:19 am
by dlavoie
Hi Broadleafer,

This was the first thing that I suspected, I've made a check in the table and I found that the foreign key is really present ! After triple checking the foreign keys and all the references, I decided to drop the FK for SEARCH_FACET_ID on BLC_CAT_SEARCH_FACET_XREF. After that I could manually run the INSERT without problem. So I reverted my INSERT and tryed to rebuild the Foreign Key and the MySQL GUI won't allow me ! And he doesn't give any error. So I have the feeling that I am in front of some kind of currupted Foreign Key. I am running MYSQL on my Mac Bookpro OX Mountain Lion. So maybe this is related to my version of MySQL. I'll dig in this direction !

Thx for the heads up !

EDIT :

I have some news ! I made some tests and by dropping the foreing keys and rebuilding it inside the load_catalog_data.sql, I was able to properly process the entire script file upon initial load. But now, I have the same problem with another foreign key inside load_content_data

Code: Select all

INSERT INTO BLC_PAGE (PAGE_ID, DESCRIPTION, PAGE_TMPLT_ID, FULL_URL, DELETED_FLAG, ARCHIVED_FLAG) VALUES (1, 'About Us', 1, '/about_us', FALSE, FALSE);


causes the following error :

Code: Select all

Cannot add or update a child row: a foreign key constraint fails (`dfbroadleaf`.`blc_page`, CONSTRAINT `FKF41BEDD5D49D3961` FOREIGN KEY (`PAGE_TMPLT_ID`) REFERENCES `BLC_PAGE_TMPLT` (`PAGE_TMPLT_ID`))


I don't want to add explicit foreign key dropping and rebuilding in every SQL files. Looks like Hibernate is creating invalid foreign keys upon my initial load. Does anyone had already experienced that issue ?

Thanks in advance ! I might launch a dedicated topic for this.

Re: SolrSearchServiceImpl.rebuildIndex exception

Posted: Wed Jan 23, 2013 9:32 am
by dlavoie
Hi there !

A little update regarding the issue described above, my problem about foreign keys was related to a bug with my MySQL OS X / Hibernate couple. After upgrading my Database, I didn't encountered the problem anymore.

I'll edit my post later today with the technical details about my old version and OS version, might be useful information for anyone who move on that error.

Thanks !

Re: SolrSearchServiceImpl.rebuildIndex exception

Posted: Tue Jan 29, 2013 2:12 am
by basavarajvs
Hi dlavoie,
Can you please share the details about Mysql version, I am still facing the issue.

Thanks and regards,
Basavaraj V S