Workaround works. I see also that: https://issues.apache.org/jira/browse/FELIX-5604
was filed. Perfect :-) 2017-04-04 9:20 GMT+02:00 Peter Kriens <peter.kri...@aqute.biz>: > I recognise this problem … but I also recall there was a fix for this. I > just looked at Felix but could not fid anything. I also do not see the code > in the repository. Sigh, must have fixed it locally or it did not make the > refactoring of this bundle. > > I’ve pushed a fix for this. > > Kind regards, > > Peter Kriens > > On 3 Apr 2017, at 21:40, Mario Curcija <mario.curc...@gmail.com> wrote: > > I noticed you both struggling with this one, so I gave it a try. While > debugging I ended in felix's ManifestParser class. > > * Assumption: > Felix OSGi framework does not correctly prepares attributes for > requirements. > > * enRoute part: > The RestApplication class is annotated as follows: > @RequireAngularWebResource(resource={"angular.js","angular-resource.js", > "angular-route.js"}, priority=1000) > > Following enRoute method (find(String)) is responsible for finding > resources (*.js in this case) works correctly when running equinox based > setup. The object returned by attrs.get("resource") is (as expected) a List > of String instances with three elements as listed in annotation above. On > the other hand felix framework returns only plain String containing comma > separated list of resources as specified in annotation. This String will > be later converted to a List resulting with single element > ("angular.js","angular-resource.js", "angular-route.js"). It is obvious > that this entry does not exist bundle entries are resolved. > > osgi.enroute.web.server.provider.WebresourceServlet.find(String) > > > BundleRequirement requirement = wire.getRequirement(); > > Map<String,Object> attrs = requirement.getAttributes(); > ... > List<String> resources = Converter.cnv(listOfStrings, > attrs.get("resource")); > ... > for (String resource : resources) { > if (glob.matcher(resource).matches()) { > URL url = provider.getBundle().getEntry(root > + resource); > if (url != null) { > webresources.add(new WR(url, priority, > order++)); > } else { > log.log(LogService.LOG_ERROR, "A web > resource " + resource + " from " + requirement + " in bundle " > + bsn + "-" + version); > return null; > } > } > } > ... > > > * Felix - ManifestParser > > I was able to reproduce it just by adding "following" test Method in: > http://svn.apache.org/repos/asf/felix/releases/org.apache. > felix.framework-5.6.2/src/test/java/org/apache/felix/ > framework/util/manifestparser/ManifestParserTest.java > > org.apache.felix.framework.util.manifestparser.ManifestParserTest > .. > > @SuppressWarnings("unchecked") > public void testAttributes() throws BundleException { > Map<String, Object> headers = new HashMap<String, Object>(); > headers.put(Constants.BUNDLE_MANIFESTVERSION, "2"); > headers.put(Constants.BUNDLE_SYMBOLICNAME, > "com.example.test.sample"); > headers.put(Constants.PROVIDE_CAPABILITY, > " com.example;theList:List<String>=\"red,green,blue\"; > theLong:Long=111"); > headers.put(Constants.REQUIRE_CAPABILITY, > " com.example.other;theList:List<String>=\"one,two,three\" > ;theLong:Long=999"); > > BundleRevision mockBundleRevision = mock(BundleRevision.class); > when(mockBundleRevision.getSymbolicName()).thenReturn( > "com.example.test.sample"); > > ManifestParser mp = new ManifestParser(null, null, > mockBundleRevision, headers); > > BundleCapability bc = findCapability(mp.getCapabilities(), > "com.example"); > Long cLong = (Long) bc.getAttributes().get("theLong"); > assertEquals(Long.valueOf(111), cLong); > List<String> cList = (List<String>) bc.getAttributes().get(" > theList"); > assertEquals(3, cList.size()); > assertTrue(cList.contains("red")); > > BundleRequirement br = findRequirement(mp.getRequirements(), > "com.example.other"); > // > // fails with java.lang.ClassCastException: java.lang.String > cannot be cast to java.lang.Long > Long rLong = (Long) br.getAttributes().get("theLong"); > assertEquals(Long.valueOf(1000), rLong); > // this would also fail with java.lang.ClassCastException > List<String> rList = (List<String>) br.getAttributes().get("com. > example.test.other"); > assertEquals(4, rList.size()); > } > > > Hope this helps. > > 2017-03-31 11:46 GMT+02:00 Peter Kriens <peter.kri...@aqute.biz>: > >> Ok, send me the zip file … but it would really be a lot easier to help >> you when you worked in bndtools. It is pretty likely that if you set it up >> in bndtools it will tell you what is wrong … A setup of bundles in a >> directory is very unmanaged and likely to hide many errors tools could have >> told you. >> >> Send the zip to me personally or send a link so I can download it. >> >> Kind regards, >> >> Peter Kriens >> >> >> >> >> >> >> On 30 Mar 2017, at 16:47, HENRY Cedric D <cedric.d.he...@alstom.com> >> wrote: >> >> Hello, >> >> The only bndrun file I have used is the one from the ‘ >> osgi.enroute.examples.rest.application’ project from >> https://github.com/osgi/osgi.enroute.examples without changing any code, >> and then I manually extracted the bundles to put them in a clean Felix >> instance. >> >> I can send the ZIP containing the examples I used, and I can create a ZIP >> with the end result of the Felix Instance, but I do not see nor do I know >> how to make a bndrun file replicating the manual steps I did (as described >> in my previous email) in order to ease your work in helping me. >> >> >> >> Please let me know what would be useful to you so I can help you in >> helping me. >> >> Best Regards, >> *Cédric* >> >> *From:* osgi-dev-boun...@mail.osgi.org [mailto:osgi-dev-bounces@mail. >> osgi.org <osgi-dev-boun...@mail.osgi.org>] *On Behalf Of *Peter Kriens >> *Sent:* Thursday, March 30, 2017 11:04 AM >> *To:* OSGi Developer Mail List <osgi-dev@mail.osgi.org> >> *Subject:* Re: [osgi-dev] RHelp needed about Web Application with >> AngularJS >> >> Well, there are million of tutorials about Git(hub). It really is hard >> for me to try to retrace your steps and be sure I end up in the same place. >> >> I am more than willing to help but I will not to be able to quickly >> recreate the exact environment you’ve created. >> >> And anyway, wouldn’t it be easier to create a bndrun file with this setup? >> >> Kind regards, >> >> Peter Kriens >> >> >> On 22 Mar 2017, at 12:24, HENRY Cedric D <cedric.d.he...@alstom.com> >> wrote: >> >> I am not very familiar (yet) with Github nor with bndtools workspace. >> >> Still, related to what I mentioned in my initial email, my steps were as >> follow: >> 1. Downloaded https://github.com/osgi/osgi.enroute.examples (as >> ZIP and extracted it locally) >> 2. Follow prerequisites from http://enroute.osgi.org/q >> s/100-prerequisites.html >> a. Java 8 >> b. Eclipse Mars >> c. Bndtools installation (using URL http://dl.bintray.com/bndt >> ools/bndtools/latest as HTTPS failing) >> d. Installed Git for windows >> 3. Imported the download at step 1 in Eclipse >> 4. Followed steps from http://enroute.osgi.org/q >> s/300-application.html,on the osgi.enroute.examples.rest.application >> project: >> a. Double-click the ‘osgi.enroute.examples.rest.bndrun’ file + >> Click ‘Resolve’ then ‘Finish’ >> b. Click ‘Run OSGi’/’Debug OSGi’ and check http://localhost:8080/os >> gi.enroute.examples.rest/index.html >> c. Stopped the run/debug >> d. Click ‘Export’ and followed the wizard >> 5. Extracted content of uber-JAR resulting from the ‘Export’ action >> (http://enroute.osgi.org/qs/300-application.html, ‘Creating an Executable >> ’section) >> 6. Copied following extracted JAR files into ‘bundle’ directory of >> local Felix (v 5.6.2): >> · org.apache.felix.http.servlet-api-1.1.2.jar >> · org.apache.felix.log-1.0.1.jar >> · org.apache.felix.configadmin-1.8.8.jar >> · org.apache.felix.http.jetty-3.2.0.jar >> · org.apache.felix.scr-2.0.2.jar >> · osgi.enroute.examples.rest.application.jar >> · osgi.enroute.twitter.bootstrap.webresource-3.3.5.jar >> · osgi.enroute.configurer.simple.provider-2.0.0.jar >> · osgi.enroute.dtos.bndlib.provider-2.0.0.jar >> · osgi.enroute.executor.simple.provider-2.0.0.jar >> · osgi.enroute.google.angular.webresource-1.5.7.jar >> · osgi.enroute.logger.simple.provider-2.0.0.jar >> · osgi.enroute.rest.simple.provider-2.0.0.jar >> · osgi.enroute.stackexchange.pagedown.webresource-1.1.1.jar >> · osgi.enroute.web.simple.provider-2.0.0.jar >> 7. Added the following Felix sub-projects into the ‘bundle’ >> directory: >> a. http://ftp.tudelft.nl/apache/felix/org.apache.felix >> .bundlerepository-2.0.8.jar >> b. http://ftp.tudelft.nl/apache/felix/org.apache.felix >> .coordinator-1.0.2.jar >> c. org.apache.felix.dependencymanager-4.4.0.jar from >> http://ftp.tudelft.nl/apache//felix/org.apache.felix. >> dependencymanager-r9-bin.zip >> <http://ftp.tudelft.nl/apache/felix/org.apache.felix.dependencymanager-r9-bin.zip> >> d. http://ftp.tudelft.nl/apache//felix/org.apache.feli >> x.eventadmin-1.4.8.jar >> <http://ftp.tudelft.nl/apache/felix/org.apache.felix.eventadmin-1.4.8.jar> >> e. http://ftp.tudelft.nl/apache//felix/org.apache.feli >> x.metatype-1.1.2.jar >> <http://ftp.tudelft.nl/apache/felix/org.apache.felix.metatype-1.1.2.jar> >> f. http://ftp.tudelft.nl/apache//felix/org.apache.fel >> ix.webconsole-4.3.0-all.jar >> <http://ftp.tudelft.nl/apache/felix/org.apache.felix.webconsole-4.3.0-all.jar> >> 8. Added the following OSGi bundles from Maven: >> a. http://central.maven.org/maven2/org/osgi/org.osgi.s >> ervice.coordinator/1.0.2/org.osgi.service.coordinator-1.0.2.jar >> b. http://central.maven.org/maven2/org/osgi/org.osgi.s >> ervice.event/1.3.1/org.osgi.service.event-1.3.1.jar >> c. http://central.maven.org/maven2/org/osgi/org.osgi.s >> ervice.metatype/1.3.0/org.osgi.service.metatype-1.3.0.jar >> 9. In command prompt under the Felix Framework root directory, >> executed: java -jar bin\felix.jar >> a. Waited for Log message: INFO:oejs.ServerConnector:FelixStartLevel: >> Started ServerConnector >> 10. Open http://localhost:<Felix org.osgi.service.http.port>/os >> gi.enroute.examples.rest/index.html >> >> >> Best Regards, >> *Cédric* >> >> *From:* osgi-dev-boun...@mail.osgi.org [mailto:osgi-dev-bounce >> s...@mail.osgi.org <osgi-dev-boun...@mail.osgi.org>] *On Behalf Of *Peter >> Kriens >> *Sent:* Wednesday, March 22, 2017 11:08 AM >> *To:* OSGi Developer Mail List <osgi-dev@mail.osgi.org> >> *Subject:* Re: [osgi-dev] RHelp needed about Web Application with >> AngularJS >> >> Hmm, manifest looks ok. The fact that your bundle runs means Felix must >> have resolved this. >> >> I vaguely recall that there was a bug in Felix wiring custom namespaces >> but that same vague recall says in my head it was fixed. >> >> The easiest for me is if you create a Github bndtools workspace. >> >> Kind regards, >> >> Peter Kriens >> >> >> >> >> On 22 Mar 2017, at 08:18, HENRY Cedric D <cedric.d.he...@alstom.com> >> wrote: >> >> Hello, >> >> I left the code downloaded from GIT as-is and followed the steps from the >> tutorial in order to see it working in full, which it did in when ran from >> Eclipse or when running the exported JAR. >> >> As per angular the Require-Capability header, the >> osgi.enroute.examples.rest bundle has the following (see manifest attached) >> amongst others: >> · effective:=active,osgi.enroute.webresource;resourc >> e:List<String>="angular.js,angular-resource.js,angular-route.js" >> · priority:Long=1000;filter:="(&(osgi.enroute.webres >> ource=/google/angular)(&(version>=1.5.7)(!(version>=2.0 >> .0))))",osgi.enroute.webresource >> >> If it helps with the investigation, I can archive the Felix instance >> included all the bundles and sent it over. >> >> >> Best Regards, >> *Cédric* >> >> *From:* osgi-dev-boun...@mail.osgi.org [mailto:osgi-dev-bounce >> s...@mail.osgi.org <osgi-dev-boun...@mail.osgi.org>] *On Behalf Of *Peter >> Kriens >> *Sent:* Tuesday, March 21, 2017 7:10 PM >> *To:* OSGi Developer Mail List <osgi-dev@mail.osgi.org> >> *Subject:* Re: [osgi-dev] RHelp needed about Web Application with >> AngularJS >> >> Your GUI bundle must require the angular code and the bootstrap code. >> Since you can see the CSS this seems to work fine for Twitter but not >> angular. >> >> * Did you remove or change the RequireAngular annotation from the >> application class? >> * Verify that your osgi.enroute.rest.application bundle requires angular >> in the header (Require-Capability header) >> >> Otherwise make a Github repo with the project and I can take a look. Kind >> regards, >> >> Peter Kriens >> >> >> >> On 21 Mar 2017, at 18:01, HENRY Cedric D <cedric.d.he...@alstom.com> >> wrote: >> >> Hello, >> >> I have followed the tutorial http://enroute.osgi.org/qs/050-start.html >> <https://urldefense.proofpoint.com/v2/url?u=http-3A__enroute.osgi.org_qs_050-2Dstart.html&d=DwMFaQ&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=P6euiOIUTiHGeCo834UpUN15FXdgxZVSdSwprP_eqOo&m=7tDGLFT8Y4SL1Hbi9pYPSF30fCXvShawNw2TQArioZw&s=BVpIxOXWBdZ4T2IGnu0wJ5WS05rMgUUxH7qZd3eX17Q&e=> >> using the examples available on GIT without any problem. >> >> Then, I have extracted the content of the JAR generated at the end of the >> page http://enroute.osgi.org/qs/300-application.html >> <https://urldefense.proofpoint.com/v2/url?u=http-3A__enroute.osgi.org_qs_300-2Dapplication.html&d=DwMFaQ&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=P6euiOIUTiHGeCo834UpUN15FXdgxZVSdSwprP_eqOo&m=7tDGLFT8Y4SL1Hbi9pYPSF30fCXvShawNw2TQArioZw&s=aMOj06IaufFeItw5hnwlF2mNvvfIzETbxZIgsikB3OQ&e=> >> to use it content with a clean instance of Felix (v 5.6.2, configured >> to have on port 8889). >> The intent is to better the dependencies required in order to create a >> Web application (with AngularJS) using OSGi in order to create a similar >> application using Maven on Intellij IDEA. >> >> The Problem is as below: >> >> After some struggle, I have succeeded to have all bundles active, but the >> web application does not work as when ran from Eclipse. >> NOTE that none of the org.eclipse.* bundles got used. >> >> Opening http://localhost:8889/osgi.enroute.examples.rest/index.html#/ >> <https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A8889_osgi.enroute.examples.rest_index.html-23_&d=DwMFaQ&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=P6euiOIUTiHGeCo834UpUN15FXdgxZVSdSwprP_eqOo&m=7tDGLFT8Y4SL1Hbi9pYPSF30fCXvShawNw2TQArioZw&s=V_W98i93Z69Cc5LnyjAXLxPZyFSeWIY_J2DCABsg-eQ&e=> >> only the content of the index.html file is rendered as-is: >> <image001.jpg> >> >> Looking into the Source View, I have followed the CSS link and the JS >> link: >> · http://localhost:8889/osgi.enroute.webresource/osg >> i.enroute.examples.rest.application/1.0.0/*.css >> <https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A8889_osgi.enroute.webresource_osgi.enroute.examples.rest.application_1.0.0_-2A.css&d=DwMFaQ&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=P6euiOIUTiHGeCo834UpUN15FXdgxZVSdSwprP_eqOo&m=7tDGLFT8Y4SL1Hbi9pYPSF30fCXvShawNw2TQArioZw&s=kgzYhTlXSCzRmOmKO_hVP4uaKIKikISnKd3vvUZbrDI&e=>: >> returns the CSS content >> · http://localhost:8889/osgi.enroute.webresource/osg >> i.enroute.examples.rest.application/1.0.0/*.js >> <https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A8889_osgi.enroute.webresource_osgi.enroute.examples.rest.application_1.0.0_-2A.js&d=DwMFaQ&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=P6euiOIUTiHGeCo834UpUN15FXdgxZVSdSwprP_eqOo&m=7tDGLFT8Y4SL1Hbi9pYPSF30fCXvShawNw2TQArioZw&s=dyl6nBIpKmH7osnfGaV-1xDeG14sA3shf0AebcKkhIw&e=>: >> returns HTTP ERROR: 404 >> Note that http://localhost:8889/rest/upper >> <https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A8889_rest_upper&d=DwMFaQ&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=P6euiOIUTiHGeCo834UpUN15FXdgxZVSdSwprP_eqOo&m=7tDGLFT8Y4SL1Hbi9pYPSF30fCXvShawNw2TQArioZw&s=v_IA5GqHB5Y6fbV2NC2nsLlhQ95_Hv8ANRl7M40rmN8&e=> >> is working fine. >> >> I am puzzled about the fact that the CSS file content is returned, but >> not the JS file content event though they are under the same directory >> within the osgi.enroute.examples.rest.application bundle, and I would >> appreciate some help in solving and understand the cause of this problem. >> >> Here is a snapshot of all the bundles under ‘bundle’ directory used by >> Felix: >> <image002.png> >> >> >> Best Regards, >> *Cédric* >> >> >> ------------------------------ >> CONFIDENTIALITY : This e-mail and any attachments are confidential and >> may be privileged. If you are not a named recipient, please notify the >> sender immediately and do not disclose the contents to another person, use >> it for any purpose or store or copy the information in any medium. >> _______________________________________________ >> OSGi Developer Mail List >> osgi-dev@mail.osgi.org >> https://mail.osgi.org/mailman/listinfo/osgi-dev >> <https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.osgi.org_mailman_listinfo_osgi-2Ddev&d=DwMFaQ&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=P6euiOIUTiHGeCo834UpUN15FXdgxZVSdSwprP_eqOo&m=7tDGLFT8Y4SL1Hbi9pYPSF30fCXvShawNw2TQArioZw&s=zeUdHtPyd_ZLBw3ul5UF1a_zMp2Fspe5GjUNjIHtI_w&e=> >> >> >> >> ------------------------------ >> CONFIDENTIALITY : This e-mail and any attachments are confidential and >> may be privileged. If you are not a named recipient, please notify the >> sender immediately and do not disclose the contents to another person, use >> it for any purpose or store or copy the information in any medium. >> <MANIFEST.MF>_______________________________________________ >> OSGi Developer Mail List >> osgi-dev@mail.osgi.org >> https://mail.osgi.org/mailman/listinfo/osgi-dev >> <https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.osgi.org_mailman_listinfo_osgi-2Ddev&d=DwMFaQ&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=P6euiOIUTiHGeCo834UpUN15FXdgxZVSdSwprP_eqOo&m=36gj0fi9Dr_QXivLv4W8lrgBkrHtEYOO3ZfaDO8AMcI&s=mRBXvr3GgeteWbG8572wxFteX8VXYxW3Mh10fmdm8nA&e=> >> >> >> >> ------------------------------ >> CONFIDENTIALITY : This e-mail and any attachments are confidential and >> may be privileged. If you are not a named recipient, please notify the >> sender immediately and do not disclose the contents to another person, use >> it for any purpose or store or copy the information in any medium. >> _______________________________________________ >> OSGi Developer Mail List >> osgi-dev@mail.osgi.org >> https://mail.osgi.org/mailman/listinfo/osgi-dev >> >> >> >> ------------------------------ >> CONFIDENTIALITY : This e-mail and any attachments are confidential and >> may be privileged. If you are not a named recipient, please notify the >> sender immediately and do not disclose the contents to another person, use >> it for any purpose or store or copy the information in any medium. >> _______________________________________________ >> OSGi Developer Mail List >> osgi-dev@mail.osgi.org >> https://mail.osgi.org/mailman/listinfo/osgi-dev >> >> >> >> _______________________________________________ >> OSGi Developer Mail List >> osgi-dev@mail.osgi.org >> https://mail.osgi.org/mailman/listinfo/osgi-dev >> > > _______________________________________________ > OSGi Developer Mail List > osgi-dev@mail.osgi.org > https://mail.osgi.org/mailman/listinfo/osgi-dev > > > > _______________________________________________ > OSGi Developer Mail List > osgi-dev@mail.osgi.org > https://mail.osgi.org/mailman/listinfo/osgi-dev >
_______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev