Workspace workspace = new Workspace(new File("/Users/dhumeniuk/git/myworkspace"));
File projectDir = new File(workspace.getBase(), "myproject.integration");
m_Run = new Run(workspace, projectDir, new File(projectDir, "launch.bndrun"));
m_Run.getProjectLauncher().launch();
However, the project launcher is not able to find the framework bundle and in the end I get this message:
Exception in thread "main" java.lang.NoClassDefFoundError: org/osgi/framework/ServiceListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Looking at the code, the workspace object has the correct base directory, but it only has a JPM4J bundle repo, it doesn't have the other bundle repositories, specifically the run repo that has the framework bundle.
On 17 mrt. 2015, at 21:18, Dave <dhum...@gmail.com> wrote:Based on https://groups.google.com/forum/#!starred/bndtools-users/DVO-XzVs4oc, I tried the following:Workspace workspace = new Workspace(new File("/Users/dhumeniuk/git/myworkspace"));
File projectDir = new File(workspace.getBase(), "myproject.integration");
m_Run = new Run(workspace, projectDir, new File(projectDir, "launch.bndrun"));
m_Run.getProjectLauncher().launch();
However, the project launcher is not able to find the framework bundle and in the end I get this message:
Exception in thread "main" java.lang.NoClassDefFoundError: org/osgi/framework/ServiceListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Looking at the code, the workspace object has the correct base directory, but it only has a JPM4J bundle repo, it doesn't have the other bundle repositories, specifically the run repo that has the framework bundle.
--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
assertThat(workspace.isValid(), is(true));
// tried this too, but the getWorkspace call fails and says no workspace found
Workspace workspace = Workspace.getWorkspace(IO.getFile( "~/git/workspace/cnf"));
assertThat(workspace.isValid(), is(true));
// figure I would let bnd find the workspace for me (BTW, is there a good way to get the current workspace that code is being executed from, ~/git/workspace will not be the same for everyone after all)
Workspace workspace = Workspace.findWorkspace(new File(TestRemoteClient.class.getProtectionDomain().getCodeSource().getLocation().toURI()));
assertThat(workspace.isValid(), is(true));
m_Run = new Run(workspace, myproject.getBase(), myproject.getFile("controller.bndrun"));
assertThat(m_Run.isValid(), is(true));
assertThat(m_Run.isOk(), is(true));
m_Run.getProjectLauncher().launch();
m_Run isValid and isOk return true, but launch call still fails with the same class loader issue.
Exception in thread "main" java.lang.NoClassDefFoundError: org/osgi/framework/ServiceListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)