You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by sarf <sa...@gmail.com> on 2013/03/01 17:30:02 UTC

sanityCheck this factory has already been closed

My objective is to be able to start and stop Jackrabbit instance regardless
of number of times.

I m able to successfully stop a Jackrabbit instance through the following
code.

	log.info("Unbind remote repository : {}.", getRemoteRepositoryName());
//$NON-NLS-1$
		UnicastRemoteObject.unexportObject(this.remoteRepository, true);
		getRmiRegistry().unbind(getRemoteRepositoryName());
		
		if (getSessionFactory().getRepository().getDescriptorKeys().length>0) {
            if (getSessionFactory().getRepository() instanceof
JackrabbitRepository) {
                log.info("HOOK JCR : shuttown JackRabbit Repository...");
               ((JackrabbitRepository)
getSessionFactory().getRepository()).shutdown();
            }
        }
			

In the mean time starting Jackrabbit repository through the following code
generates IllegalStateException: 

	RepositoryConfig config = RepositoryConfig.create(repo.getConfig());
	RepositoryImpl.create(config);
	
Caused by: java.lang.IllegalStateException: this factory has already been
closed
	at
org.apache.jackrabbit.core.util.db.ConnectionFactory.sanityCheck(ConnectionFactory.java:215)
	at
org.apache.jackrabbit.core.util.db.ConnectionFactory.getDataSource(ConnectionFactory.java:164)
	at
org.apache.jackrabbit.core.fs.db.DbFileSystem.getDataSource(DbFileSystem.java:226)
	at
org.apache.jackrabbit.core.fs.db.DatabaseFileSystem.init(DatabaseFileSystem.java:187)
	
A boolean value "closed" is set to true as soon as the repository is shut
down. When started later, it fails to reinitialize correctly.

 private void sanityCheck() {
        if (closed) {
            throw new IllegalStateException("this factory has already been
closed");
        }
    }



--
View this message in context: http://jackrabbit.510166.n4.nabble.com/sanityCheck-this-factory-has-already-been-closed-tp4657857.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: sanityCheck this factory has already been closed

Posted by sarf <sa...@gmail.com>.
same old error again!



--
View this message in context: http://jackrabbit.510166.n4.nabble.com/sanityCheck-this-factory-has-already-been-closed-tp4657857p4657881.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: sanityCheck this factory has already been closed

Posted by Cody Burleson <co...@base22.com>.
If this is happening to you at startup, you can correct the issue by
checking out se-jcr and compling SNAPSHOT-1.0 and using it instead of
0.9.

- Cody Burleson

Sent from my iPhone

On Mar 4, 2013, at 3:16 AM, sarf <sa...@gmail.com> wrote:

> I tried in vain leading to the same exeption
>
> 10:16:01.828 ERROR o.a.j.core.fs.db.DatabaseFileSystem - failed to
> initialize file system
> java.lang.IllegalStateException: this factory has already been closed
>    at
> org.apache.jackrabbit.core.util.db.ConnectionFactory.sanityCheck(ConnectionFactory.java:215)
> ~[jackrabbit-core-2.4.3.jar:2.4.3]
>    at
> org.apache.jackrabbit.core.util.db.ConnectionFactory.getDataSource(ConnectionFactory.java:164)
> ~[jackrabbit-core-2.4.3.jar:2.4.3]
>
>
>
> --
> View this message in context: http://jackrabbit.510166.n4.nabble.com/sanityCheck-this-factory-has-already-been-closed-tp4657857p4657869.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: sanityCheck this factory has already been closed

Posted by sarf <sa...@gmail.com>.
I tried in vain leading to the same exeption

10:16:01.828 ERROR o.a.j.core.fs.db.DatabaseFileSystem - failed to
initialize file system
java.lang.IllegalStateException: this factory has already been closed
	at
org.apache.jackrabbit.core.util.db.ConnectionFactory.sanityCheck(ConnectionFactory.java:215)
~[jackrabbit-core-2.4.3.jar:2.4.3]
	at
org.apache.jackrabbit.core.util.db.ConnectionFactory.getDataSource(ConnectionFactory.java:164)
~[jackrabbit-core-2.4.3.jar:2.4.3]



--
View this message in context: http://jackrabbit.510166.n4.nabble.com/sanityCheck-this-factory-has-already-been-closed-tp4657857p4657869.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: sanityCheck this factory has already been closed

Posted by joe verderber <jj...@gmail.com>.
Have you tried getting the config object before the shutdown, then shutting
down, then starting up?

On Friday, March 1, 2013, sarf wrote:

> My objective is to be able to start and stop Jackrabbit instance regardless
> of number of times.
>
> I m able to successfully stop a Jackrabbit instance through the following
> code.
>
>         log.info("Unbind remote repository : {}.",
> getRemoteRepositoryName());
> //$NON-NLS-1$
>                 UnicastRemoteObject.unexportObject(this.remoteRepository,
> true);
>                 getRmiRegistry().unbind(getRemoteRepositoryName());
>
>                 if
> (getSessionFactory().getRepository().getDescriptorKeys().length>0) {
>             if (getSessionFactory().getRepository() instanceof
> JackrabbitRepository) {
>                 log.info("HOOK JCR : shuttown JackRabbit Repository...");
>                ((JackrabbitRepository)
> getSessionFactory().getRepository()).shutdown();
>             }
>         }
>
>
> In the mean time starting Jackrabbit repository through the following code
> generates IllegalStateException:
>
>         RepositoryConfig config =
> RepositoryConfig.create(repo.getConfig());
>         RepositoryImpl.create(config);
>
> Caused by: java.lang.IllegalStateException: this factory has already been
> closed
>         at
>
> org.apache.jackrabbit.core.util.db.ConnectionFactory.sanityCheck(ConnectionFactory.java:215)
>         at
>
> org.apache.jackrabbit.core.util.db.ConnectionFactory.getDataSource(ConnectionFactory.java:164)
>         at
>
> org.apache.jackrabbit.core.fs.db.DbFileSystem.getDataSource(DbFileSystem.java:226)
>         at
>
> org.apache.jackrabbit.core.fs.db.DatabaseFileSystem.init(DatabaseFileSystem.java:187)
>
> A boolean value "closed" is set to true as soon as the repository is shut
> down. When started later, it fails to reinitialize correctly.
>
>  private void sanityCheck() {
>         if (closed) {
>             throw new IllegalStateException("this factory has already been
> closed");
>         }
>     }
>
>
>
> --
> View this message in context:
> http://jackrabbit.510166.n4.nabble.com/sanityCheck-this-factory-has-already-been-closed-tp4657857.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>


-- 
Sent from Gmail Mobile

Re: sanityCheck this factory has already been closed

Posted by sarf <sa...@gmail.com>.
here is the entire exception

16:18:44.179 ERROR o.a.jackrabbit.core.RepositoryImpl - In addition to
startup fail, another unexpected problem occurred while shutting down the
repository again.
java.lang.NullPointerException: null
	at
org.apache.jackrabbit.core.RepositoryImpl.doShutdown(RepositoryImpl.java:1124)
[jackrabbit-core-2.4.3.jar:2.4.3]
	at
org.apache.jackrabbit.core.RepositoryImpl.shutdown(RepositoryImpl.java:1048)
[jackrabbit-core-2.4.3.jar:2.4.3]
	at
org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:372)
[jackrabbit-core-2.4.3.jar:2.4.3]
	at
org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:589)
[jackrabbit-core-2.4.3.jar:2.4.3]
	at
fr.sicof.fiva.services.business.embedded.ged.EmbeddedGedService.demarrer(EmbeddedGedService.java:58)
[fiva-business-embedded-2.4.0-SNAPSHOT.jar:2.4.0-SNAPSHOT]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
~[na:1.6.0_33]
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
~[na:1.6.0_33]
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
~[na:1.6.0_33]
	at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_33]
	at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at
fr.sicof.fiva.service.support.ProcessesExceptionInterceptor.catchProcessException(ProcessesExceptionInterceptor.java:34)
[ProcessesExceptionInterceptor.class:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
~[na:1.6.0_33]
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
~[na:1.6.0_33]
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
~[na:1.6.0_33]
	at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_33]
	at
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
[spring-aop-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at $Proxy193.demarrer(Unknown Source) [na:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
~[na:1.6.0_33]
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
~[na:1.6.0_33]
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
~[na:1.6.0_33]
	at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_33]
	at
org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:124)
[resteasy-jaxrs-1.2.1.GA.jar:na]
	at
org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:247)
[resteasy-jaxrs-1.2.1.GA.jar:na]
	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:212)
[resteasy-jaxrs-1.2.1.GA.jar:na]
	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:202)
[resteasy-jaxrs-1.2.1.GA.jar:na]
	at
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:441)
[resteasy-jaxrs-1.2.1.GA.jar:na]
	at
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:418)
[resteasy-jaxrs-1.2.1.GA.jar:na]
	at
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:111)
[resteasy-jaxrs-1.2.1.GA.jar:na]
	at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:217)
[resteasy-jaxrs-1.2.1.GA.jar:na]
	at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:159)
[resteasy-jaxrs-1.2.1.GA.jar:na]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
[servlet-api.jar:na]
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
[catalina.jar:6.0.35]
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
[catalina.jar:6.0.35]
	at
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:163)
[spring-security-web-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
[spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
[spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE]
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
[catalina.jar:6.0.35]
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
[catalina.jar:6.0.35]
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
[catalina.jar:6.0.35]
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
[catalina.jar:6.0.35]
	at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
[catalina.jar:6.0.35]
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
[catalina.jar:6.0.35]
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
[catalina.jar:6.0.35]
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
[catalina.jar:6.0.35]
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
[catalina.jar:6.0.35]
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
[tomcat-coyote.jar:6.0.35]
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
[tomcat-coyote.jar:6.0.35]
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
[tomcat-coyote.jar:6.0.35]
	at java.lang.Thread.run(Thread.java:662) [na:1.6.0_33]
javax.jcr.RepositoryException: File system initialization failure.
	at
org.apache.jackrabbit.core.config.RepositoryConfigurationParser$6.getFileSystem(RepositoryConfigurationParser.java:1081)
	at
org.apache.jackrabbit.core.config.RepositoryConfig.getFileSystem(RepositoryConfig.java:916)
	at
org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:262)
	at
org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:589)
	at
fr.sicof.fiva.services.business.embedded.ged.EmbeddedGedService.demarrer(EmbeddedGedService.java:58)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
	at
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
	at
fr.sicof.fiva.service.support.ProcessesExceptionInterceptor.catchProcessException(ProcessesExceptionInterceptor.java:34)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
	at
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
	at
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
	at $Proxy193.demarrer(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at
org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:124)
	at
org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:247)
	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:212)
	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:202)
	at
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:441)
	at
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:418)
	at
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:111)
	at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:217)
	at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:159)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:163)
	at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
	at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.jackrabbit.core.fs.FileSystemException: failed to
initialize file system
	at
org.apache.jackrabbit.core.fs.db.DatabaseFileSystem.init(DatabaseFileSystem.java:207)
	at
org.apache.jackrabbit.core.config.RepositoryConfigurationParser$6.getFileSystem(RepositoryConfigurationParser.java:1078)
	... 57 more
Caused by: java.lang.IllegalStateException: this factory has already been
closed
	at
org.apache.jackrabbit.core.util.db.ConnectionFactory.sanityCheck(ConnectionFactory.java:215)
	at
org.apache.jackrabbit.core.util.db.ConnectionFactory.getDataSource(ConnectionFactory.java:164)
	at
org.apache.jackrabbit.core.fs.db.DbFileSystem.getDataSource(DbFileSystem.java:226)
	at
org.apache.jackrabbit.core.fs.db.DatabaseFileSystem.init(DatabaseFileSystem.java:187)
	... 58 more



--
View this message in context: http://jackrabbit.510166.n4.nabble.com/sanityCheck-this-factory-has-already-been-closed-tp4657857p4657859.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.