chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joseph Vychtrle (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CMIS-336) java.lang.ClassNotFoundException: JcrServiceFactory
Date Tue, 22 Mar 2011 22:56:05 GMT

     [ https://issues.apache.org/jira/browse/CMIS-336?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Joseph Vychtrle resolved CMIS-336.
----------------------------------

    Resolution: Not A Problem

Sorry, it was my fault

> java.lang.ClassNotFoundException: JcrServiceFactory
> ---------------------------------------------------
>
>                 Key: CMIS-336
>                 URL: https://issues.apache.org/jira/browse/CMIS-336
>             Project: Chemistry
>          Issue Type: Bug
>          Components: opencmis-server-jcr
>    Affects Versions: OpenCMIS 0.3.0
>         Environment: java 1.6, maven 3
>            Reporter: Joseph Vychtrle
>              Labels: ClassNotFoundException
>
> The problem is that classloader doesn't see JcrServiceFactory to load it up, even though
it is on the classpath
> {code:title=cmisTest.java|borderStyle=solid}
> SessionFactory factory = SessionFactoryImpl.newInstance();
> Map<String, String> parameters = new HashMap<String, String>();
> // user credentials
> parameters.put(SessionParameter.USER, "username");
> parameters.put(SessionParameter.PASSWORD, "password");
> // connection settings
> parameters.put(SessionParameter.BINDING_TYPE, BindingType.LOCAL.value());
> parameters.put(SessionParameter.LOCAL_FACTORY, "JcrServiceFactory.class.getName()");
> parameters.put(SessionParameter.REPOSITORY_ID, "myRepository");
> // create session
> org.apache.chemistry.opencmis.client.api.Session session = factory.createSession(parameters);
> {code}
> {code:title=CmisLocalSpi.java|borderStyle=solid}
>       // create and initialize factory
>       factory = (CmisServiceFactory) Class.forName(serviceFactoryClassname).newInstance();
>       factory.init(parameters);
>   } catch (Exception e) {
>       throw new CmisConnectionException("Factory cannot be created!", e);
>  }
> {code}
> org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException: Factory cannot
be created!
> 	at org.apache.chemistry.opencmis.client.bindings.spi.local.CmisLocalSpi.getSpiInstance(CmisLocalSpi.java:96)
> 	at org.apache.chemistry.opencmis.client.bindings.impl.CmisBindingsHelper.getSPI(CmisBindingsHelper.java:81)
> 	at org.apache.chemistry.opencmis.client.bindings.impl.CmisBindingImpl.clearAllCaches(CmisBindingImpl.java:172)
> 	at org.apache.chemistry.opencmis.client.bindings.impl.CmisBindingImpl.<init>(CmisBindingImpl.java:95)
> 	at org.apache.chemistry.opencmis.client.bindings.CmisBindingFactory.createCmisLocalBinding(CmisBindingFactory.java:154)
> 	at org.apache.chemistry.opencmis.client.runtime.CmisBindingHelper.createLocalBinding(CmisBindingHelper.java:96)
> 	at org.apache.chemistry.opencmis.client.runtime.CmisBindingHelper.createBinding(CmisBindingHelper.java:53)
> 	at org.apache.chemistry.opencmis.client.runtime.SessionImpl.connect(SessionImpl.java:561)
> 	at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.createSession(SessionFactoryImpl.java:61)
> 	at repository.RepoTest.createCmisServer(RepoTest.java:143)
> 	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.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:640)
> 	at org.testng.internal.Invoker.invokeMethod(Invoker.java:627)
> 	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:799)
> 	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1103)
> 	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
> 	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
> 	at org.testng.TestRunner.runWorkers(TestRunner.java:1098)
> 	at org.testng.TestRunner.privateRun(TestRunner.java:727)
> 	at org.testng.TestRunner.run(TestRunner.java:581)
> 	at org.testng.SuiteRunner.runTest(SuiteRunner.java:315)
> 	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:310)
> 	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:272)
> 	at org.testng.SuiteRunner.run(SuiteRunner.java:221)
> 	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:40)
> 	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:83)
> 	at org.testng.internal.thread.ThreadUtil$CountDownLatchedRunnable.run(ThreadUtil.java:151)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> 	at java.lang.Thread.run(Thread.java:619)
> Caused by: java.lang.ClassNotFoundException: JcrServiceFactory
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
> 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
> 	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
> 	at java.lang.Class.forName0(Native Method)
> 	at java.lang.Class.forName(Class.java:169)
> 	at org.apache.chemistry.opencmis.client.bindings.spi.local.CmisLocalSpi.getSpiInstance(CmisLocalSpi.java:93)
> 	... 32 more
> {color:red} The problem is, that the chemistry-opencmis-server-jcr - classes.jar really
is on the classpath, I can see that via maven and debugger{color} 
> $ jar tf /opt/m2/repository/org/apache/chemistry/opencmis/chemistry-opencmis-server-jcr/0.3.0-incubating-SNAPSHOT/chemistry-opencmis-server-jcr-0.3.0-incubating-SNAPSHOT-classes.jar

> META-INF/
> META-INF/MANIFEST.MF
> org/
> org/apache/
> org/apache/chemistry/
> org/apache/chemistry/opencmis/
> org/apache/chemistry/opencmis/jcr/
> org/apache/chemistry/opencmis/jcr/JcrRepository.class
> org/apache/chemistry/opencmis/jcr/JcrConverter.class
> org/apache/chemistry/opencmis/jcr/TypeManager$1.class
> org/apache/chemistry/opencmis/jcr/JcrService.class
> org/apache/chemistry/opencmis/jcr/Util.class
> org/apache/chemistry/opencmis/jcr/JcrRepository$1.class
> org/apache/chemistry/opencmis/jcr/JcrBinary.class
> org/apache/chemistry/opencmis/jcr/JcrServiceFactory.class
> org/apache/chemistry/opencmis/jcr/TypeManager.class
> META-INF/LICENSE
> META-INF/DEPENDENCIES
> META-INF/NOTICE
> META-INF/maven/
> META-INF/maven/org.apache.chemistry.opencmis/
> META-INF/maven/org.apache.chemistry.opencmis/chemistry-opencmis-server-jcr/
> META-INF/maven/org.apache.chemistry.opencmis/chemistry-opencmis-server-jcr/pom.xml
> META-INF/maven/org.apache.chemistry.opencmis/chemistry-opencmis-server-jcr/pom.properties
> repository.properties                                      
> {code:xml}
> <dependencies>
> 	<dependency>
> 		<groupId>javax.jcr</groupId>
> 		<artifactId>jcr</artifactId>
> 		<version>2.0</version>
> 		<scope>compile</scope>
> 	</dependency>
> 	<dependency>
> 		<groupId>org.apache.jackrabbit</groupId>
> 		<artifactId>jackrabbit-core</artifactId>
> 		<version>2.2.4</version>
> 		<scope>compile</scope>
> 	</dependency>
> 	<dependency>
> 		<groupId>org.apache.jackrabbit</groupId>
> 		<artifactId>jackrabbit-api</artifactId>
> 		<version>2.2.4</version>
> 		<scope>compile</scope>
> 	</dependency>
> 	<dependency>
> 		<groupId>org.slf4j</groupId>
> 		<artifactId>slf4j-log4j12</artifactId>
> 		<version>1.5.11</version>
> 		<scope>compile</scope>
> 	</dependency>
> 	<dependency>
> 		<groupId>org.testng</groupId>
> 		<artifactId>testng</artifactId>
> 		<version>5.14</version>
> 		<type>jar</type>
> 		<scope>compile</scope>
> 	</dependency>
> 	
> 	<dependency>
> 		<groupId>org.apache.chemistry.opencmis</groupId>
> 		<artifactId>chemistry-opencmis-server-jcr</artifactId>
> 		<version>0.3.0-incubating-SNAPSHOT</version>
> 		<classifier>classes</classifier>
> 	</dependency>
> 	<dependency>
> 		<groupId>org.apache.chemistry.opencmis</groupId>
> 		<artifactId>chemistry-opencmis-client-bindings</artifactId>
> 		<version>0.3.0-incubating-SNAPSHOT</version>
> 	</dependency>
> 	<dependency>
> 		<groupId>org.apache.chemistry.opencmis</groupId>
> 		<artifactId>chemistry-opencmis-client-api</artifactId>
> 		<version>0.3.0-incubating-SNAPSHOT</version>
> 	</dependency>
> 	<dependency>
> 		<groupId>org.apache.chemistry.opencmis</groupId>
> 		<artifactId>chemistry-opencmis-client-impl</artifactId>
> 		<version>0.3.0-incubating-SNAPSHOT</version>
> 	</dependency>
> </dependencies>
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message