I have try the following code as available in the documentation Dspace
Service
I am using Dspace 1.8.2
public class Main {
public static void main( String[] args) {
/* Instantiate the Utility Class */
DSpace dspace = new DSpace();
/* Access get the Service Manager by convenience method */
ServiceManager manager = dspace.getServiceManager();
/* Or access by convenience method for default services */
EventService service = dspace.getEventService();
}
}
I get Exception in thread "main" java.lang.IllegalStateException: DSpace
kernel cannot be null
at org.dspace.utils.DSpace.getServiceManager(DSpace.java:63)
at main.java.Main.main(Main.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
My code is in Dspace/dspace/src/main/java. I created the java folder. My
idea was to have the same dependencies as the Dspace/dspace module, such
that to miss nothing. In particular, i was thinking about the configuration
file that are in the folder. Nevertheless they are not in an
"src/main/resource" folder, but I am not sure that it has an incidence. I
believe this should be related to how the kernel fetch for resource.
Every Library that Dspace/dspace/ depends on are added to the class path
when running of course.
I would like to test service registration and the process to run integration
test.
Does anyone knows how to do that ?
Many thanks in advance
M
--
View this message in context:
http://dspace.2283337.n4.nabble.com/How-to-instantiate-Dspace-Kernel-to-run-integration-test-of-your-custom-services-tp4678064.html
Sent from the DSpace - Tech mailing list archive at Nabble.com.
------------------------------------------------------------------------------
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette