cancel
Showing results for 
Search instead for 
Did you mean: 

Embedding Nuxeo

mainzelM_
Champ on-the-rise
Champ on-the-rise

Hi,

I'm would like to embed the Nuxeo DM core into my application so that I can make Java API calls to it to store and retrieve documents. However, I don't see what is the right starting point for this. I tried to work with the FrameworkerLoader from http://doc.nuxeo.com/display/KB/How+to+use+an+embedded+Nuxeo+from+a+Java+application but I get a NullPointerException when I call Framework.getLocalService(SchemaManager.class). Can somebody provide me with a more complete example on how to embed Nuxeo?

Thanks

Martin

1 ACCEPTED ANSWER

Julien_Carsique
Elite Collaborator
Elite Collaborator

There must be logs about missing code (such as ClassNotFoundException). If you do get some logs (confirming you properly configured the logging) but no error, please fill a Jira issue about raising errors at framework initialization: https://jira.nuxeo.com/browse/NXP

About nuxeo-core-schema, if you look at its Maven POM, you will see it has dependencies on other Nuxeo modules: nuxeo-common, nuxeo-runtime and on third-party libraries: xsom and relaxngDatatype
See https://maven.nuxeo.org/nexus/ => nuxeo-core-schema-5.4.2.pom

Note those modules will also have their own dependencies. Manually resolving them will be a pain. You should use Maven for compiling and resolving dependencies. See http://doc.nuxeo.com/x/BIAO

FYI, here's a simplified dependency tree of nuxeo-core-schema:

$ mvn dependency:tree -o
org.nuxeo.ecm.core:nuxeo-core-schema:jar:5.4.2
+- org.nuxeo.common:nuxeo-common:jar:5.4.2:compile
|  +- xerces:xercesImpl:jar:2.9.1:provided
|  +- org.osgi:osgi-core:jar:4.1:provided
|  +- commons-io:commons-io:jar:1.4:provided
|  +- commons-lang:commons-lang:jar:2.3:provided
|  \- commons-logging:commons-logging:jar:1.1:provided
|     +- log4j:log4j:jar:1.2.16:provided (version managed from 1.2.12)
|     +- logkit:logkit:jar:1.0.1:provided
|     +- avalon-framework:avalon-framework:jar:4.1.3:provided
|     \- javax.servlet:servlet-api:jar:2.4:provided (version managed from 2.3)
+- org.nuxeo.runtime:nuxeo-runtime:jar:5.4.2:compile
|  +- org.nuxeo.common:nuxeo-common:jar:5.4.2:compile
|  +- javax.transaction:jta:jar:1.1:provided
|  \- commons-jexl:commons-jexl:jar:1.1:provided
+- com.sun.xml:xsom:jar:20060306:compile
\- com.sun.xml:relaxngDatatype:jar:1.0:compile

View answer in original post

5 REPLIES 5

Julien_Carsique
Elite Collaborator
Elite Collaborator

Hi,

mainzelM_
Champ on-the-rise
Champ on-the-rise

Hi,

Julien_Carsique
Elite Collaborator
Elite Collaborator

Since runtime is null, you have an issue with the framework initialization.

mainzelM_
Champ on-the-rise
Champ on-the-rise

The framework reports no errors during initialization. However, my problem seems to be that I did not provide all the bundles required to run my code, because after adding all .jars from the bundles directory of the distribution, my code works. Of course, this is not optimal so I wonder how I can figure out which bundles are required. Currently, I only want to get a reference to the SchemaManager (Framework.getLocalService(SchemaManager.class)) and thus I thought that adding nuxeo-core-schema-5.4.2.jar would be sufficient, but I was wrong. What else do I need to add?

Julien_Carsique
Elite Collaborator
Elite Collaborator

There must be logs about missing code (such as ClassNotFoundException). If you do get some logs (confirming you properly configured the logging) but no error, please fill a Jira issue about raising errors at framework initialization: https://jira.nuxeo.com/browse/NXP

About nuxeo-core-schema, if you look at its Maven POM, you will see it has dependencies on other Nuxeo modules: nuxeo-common, nuxeo-runtime and on third-party libraries: xsom and relaxngDatatype
See https://maven.nuxeo.org/nexus/ => nuxeo-core-schema-5.4.2.pom

Note those modules will also have their own dependencies. Manually resolving them will be a pain. You should use Maven for compiling and resolving dependencies. See http://doc.nuxeo.com/x/BIAO

FYI, here's a simplified dependency tree of nuxeo-core-schema:

$ mvn dependency:tree -o
org.nuxeo.ecm.core:nuxeo-core-schema:jar:5.4.2
+- org.nuxeo.common:nuxeo-common:jar:5.4.2:compile
|  +- xerces:xercesImpl:jar:2.9.1:provided
|  +- org.osgi:osgi-core:jar:4.1:provided
|  +- commons-io:commons-io:jar:1.4:provided
|  +- commons-lang:commons-lang:jar:2.3:provided
|  \- commons-logging:commons-logging:jar:1.1:provided
|     +- log4j:log4j:jar:1.2.16:provided (version managed from 1.2.12)
|     +- logkit:logkit:jar:1.0.1:provided
|     +- avalon-framework:avalon-framework:jar:4.1.3:provided
|     \- javax.servlet:servlet-api:jar:2.4:provided (version managed from 2.3)
+- org.nuxeo.runtime:nuxeo-runtime:jar:5.4.2:compile
|  +- org.nuxeo.common:nuxeo-common:jar:5.4.2:compile
|  +- javax.transaction:jta:jar:1.1:provided
|  \- commons-jexl:commons-jexl:jar:1.1:provided
+- com.sun.xml:xsom:jar:20060306:compile
\- com.sun.xml:relaxngDatatype:jar:1.0:compile