>>>>> Steinar Bang <[email protected]>:

>> Creating an eclipse OSGi run configuration from scratch? (it would be
>> neat if that could use maven dependencies through m2e, but google hasn't
>> found me anything saying that this is the case)

> I tried this, but as far as I can tell it is only possible to add
> workspace project and target platform bundles to a runtime
> configuration.

> Could Tycho be used to create a custom target platform from the existing
> dependecies I have for the PaxExam tests
>  https://github.com/steinarb/ukelonn/tree/using-primefaces/ukelonn.tests
> or the maven-pax-plugin provisioning
>  
> https://github.com/steinarb/ukelonn/blob/using-primefaces/ukelonn.gogoshell/provision/pom.xml
> I wonder...?

> (last time I looked at this, about a year ago, it was hard to get a grip
> on what it takes to create an eclipse target platform these days...)

FWIW I almost got this working.

Here's what I did:
 1. Created a pde-target-maven-plugin module
     
https://github.com/steinarb/ukelonn/commit/4c94380d546b63190e749ce9a20ddc08e3a5a917

 2. Added the dependencies from the gogoshell provision pom, ie. [1]
     
https://github.com/steinarb/ukelonn/commit/67a07060d75a8df9fefa7ae44deb3968709d4b5c

 3. Added the equinox base platform of eclipse Neon, as outlined here [2]
     
https://github.com/steinarb/ukelonn/commit/6b3a2f46a4b7dc026b2943a9df0fa2156864aa6f

 4. Build the ukelonn.target project with "mvn install" and set the
    generated target file (ukelonn-generated.target) as the target
    platform
    (Note: the file showed up two places because of the hierarchical
    project organization, I had to use the file
    /ukelonn/ukelonn.target/target/ukelonn-generated.target to make it
    work)

 4. Had to stop embedding my home-written Activator [3] because
    embedding didn't happen when running the project as a bundle (m2e
    was able to make the OSGi run configuration recognize the
    maven-bundle-plugin projects as bundles)
     
https://github.com/steinarb/ukelonn/commit/783a349262b84aea393ddba222863ba3d9bc9e99

 5. Created an "OSGi runtime" run configuration, my three bundle
    projects were picked up, and the target platform contained all the
    PAX stuff needed to launch with the maven-pax-plugin.  Added the
    following three arguments to "VM Arguments" in the Arguments tab of
    the run configuration:
      -Dorg.ops4j.pax.logging.DefaultServiceLog.level=WARN 
-Dorg.osgi.service.http.port=8090 -Dorg.osgi.service.http.port.secure=8443
    (the log level was necessary to keep the JSF noise down to a livable level)


References:
 [1] 
https://github.com/steinarb/ukelonn/blob/scratch/added-target-platform-for-eclipse-osgi-run-config/ukelonn.gogoshell/provision/pom.xml
 [2] 
http://www.vogella.com/tutorials/EclipseTargetPlatform/article.html#creating-a-target-definition-file
 [3] http://sbang.github.io/jsr330activator/


This started at least *something* listening to port 8090, but not my web
application:
 HTTP ERROR: 404

  Problem accessing /ukelonn/. Reason:

    ProxyServlet: /ukelonn/
 Powered by Jetty:// 9.3.9.v20160517

The output on the eclipse console, was:
[pool-1-thread-1] WARN 
org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper - failed to parse 
and instantiate of javax.servlet.ServletContainerInitializer in classpath
[pool-1-thread-1] WARN 
org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper - failed to parse 
and instantiate of javax.servlet.ServletContainerInitializer in classpath
[pool-2-thread-1] WARN org.apache.myfaces.webapp.AbstractFacesInitializer - No 
mappings of FacesServlet found. Abort initializing MyFaces.
[pool-2-thread-1] ERROR org.ops4j.pax.web.service.internal.HttpServiceStarted - 
Could not start the servlet context for context path []
java.net.BindException: Address already in use: bind
        at sun.nio.ch.Net.bind0(Native Method)
        at sun.nio.ch.Net.bind(Unknown Source)
        at sun.nio.ch.Net.bind(Unknown Source)
        at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
        at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
        at 
org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:317)
        at 
org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
        at 
org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:235)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.server.Server.doStart(Server.java:390)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at 
org.ops4j.pax.web.service.jetty.internal.JettyServerImpl$1.start(JettyServerImpl.java:281)
        at 
org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:221)
        at 
org.ops4j.pax.web.service.internal.HttpServiceStarted.registerResources(HttpServiceStarted.java:264)
        at 
org.ops4j.pax.web.service.internal.HttpServiceProxy.registerResources(HttpServiceProxy.java:71)
        at 
no.priv.bang.ukelonn.impl.UkelonnServiceProvider.setWebContainer(UkelonnServiceProvider.java:50)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at 
no.steria.osgi.jsr330activator.implementation.InjectionMethod.doInject(InjectionMethod.java:33)
        at 
no.steria.osgi.jsr330activator.implementation.InjectionBase$1.serviceChanged(InjectionBase.java:33)
        at 
org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
        at 
org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:915)
        at 
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
        at 
org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
        at 
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862)
        at 
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801)
        at 
org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
        at 
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:225)
        at 
org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:464)
        at 
org.ops4j.pax.web.service.internal.Activator.updateController(Activator.java:357)
        at 
org.ops4j.pax.web.service.internal.Activator$3.run(Activator.java:294)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
[pool-1-thread-1] WARN org.apache.myfaces.webapp.AbstractFacesInitializer - No 
mappings of FacesServlet found. Abort initializing MyFaces.
[pool-1-thread-1] WARN org.ops4j.pax.web.service.internal.HttpServiceStarted - 
Exception finalizing HttpContext registration

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to