Skip to main content
margaretywong5
Level 2
2月 22, 2019 7:28 下午 UTC
已解决

JcrUtils.getRepository throws ExceptionInIntializerError

When I attempt to execute the code snippet in the "How to programmatically access the AEM JCR" article, I get the following exception:

Exception in thread "main" java.lang.ExceptionInInitializerError

  at GetRepository.main(GetRepository.java:15)

Caused by: java.lang.IllegalArgumentException: unknown type: 10

  at javax.jcr.PropertyType.nameFromValue(PropertyType.java:92)

  at org.apache.jackrabbit.commons.JcrUtils.<clinit>(JcrUtils.java:1277)

Any ideas on how to fix this?

此主题已关闭回复。
smacdonald2008
Level 10
2月 22, 2019 8:07 下午 UTC

See this video I just created:

7回复

smacdonald2008
Level 10
2月 22, 2019 7:32 下午 UTC

How are you accessing it - from a Java APP - did you include the correct Jackrabbit JAR into your applications' classpath?

翻译
margaretywong5
Level 2
2月 22, 2019 7:34 下午 UTC

Yes, from a Java App and I do compile using "jackrabbit-jcr-commons-2.19.1.jar" in my classpath. The app compiles fine, it just gives this exception at runtime.

翻译
smacdonald2008
Level 10
2月 22, 2019 7:39 下午 UTC

What AEM version are you using?

Looks like you are using wrong JAR for your AEM version. You can obtain the jackrabbit-standalone JAR file from http://jackrabbit.apache.org/jcr/jcr-api.html.

翻译
smacdonald2008
Level 10
2月 22, 2019 7:44 下午 UTC

I am testing which JAR against AEM 6.4 - i will post back.

翻译
margaretywong5
Level 2
2月 22, 2019 7:50 下午 UTC

Now using "jackrabbit-standalone-2.12.10.jar" but still same error.

翻译
smacdonald2008
Level 10
2月 22, 2019 8:07 下午 UTC

See this video I just created:

翻译
margaretywong5
Level 2
2月 22, 2019 10:00 下午 UTC

Thank you, this worked for me.

翻译