From emijiang6 at googlemail.com Fri Sep 1 10:57:41 2017 From: emijiang6 at googlemail.com (Emily Jiang) Date: Fri, 1 Sep 2017 15:57:41 +0100 Subject: [weld-dev] Principal built-in bean Message-ID: A Java EE or embeddable EJB container must provide the following built-in beans, all of which have qualifier @Default: a bean with bean type javax.security.Principal, allowing injection of a Principal representing the current caller identity. The spec does not say the scope of this bean. In Weld, what is the scope for the Principal bean? -- Thanks Emily ================= Emily Jiang ejiang at apache.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20170901/1763af3d/attachment.html From mkouba at redhat.com Mon Sep 4 04:24:03 2017 From: mkouba at redhat.com (Martin Kouba) Date: Mon, 4 Sep 2017 10:24:03 +0200 Subject: [weld-dev] Principal built-in bean In-Reply-To: References: Message-ID: <1e8cb22b-af26-378b-1d1b-d27f2170b0f6@redhat.com> It's @Dependent. But a special proxy is injected and SPI org.jboss.weld.security.spi.SecurityServices.getPrincipal() is invoked to obtain the current caller identity for every invocation of an injected reference. Martin Dne 1.9.2017 v 16:57 Emily Jiang napsal(a): > A Java EE or embeddable EJB container must provide the following > built-in beans, all of which > have qualifier @Default: > > a bean with bean type javax.security.Principal, allowing injection of a > Principal > representing the current caller identity. > > The spec does not say the scope of this bean. In Weld, what is the scope > for the Principal bean? > > -- > Thanks > Emily > ================= > Emily Jiang > ejiang at apache.org > > > _______________________________________________ > weld-dev mailing list > weld-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/weld-dev > -- Martin Kouba Senior Software Engineer Red Hat, Czech Republic From EMIJIANG at uk.ibm.com Mon Sep 4 05:09:20 2017 From: EMIJIANG at uk.ibm.com (Emily Jiang) Date: Mon, 4 Sep 2017 10:09:20 +0100 Subject: [weld-dev] Principal built-in bean In-Reply-To: <1e8cb22b-af26-378b-1d1b-d27f2170b0f6@redhat.com> References: <1e8cb22b-af26-378b-1d1b-d27f2170b0f6@redhat.com> Message-ID: Does this mean it functions as a Request scoped bean even though it is a Dependent bean? Many thanks, Emily =========================== Emily Jiang WebSphere Application Server, CDI & MicroProfile Development Lead MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN Phone: +44 (0)1962 816278 Internal: 246278 Email: emijiang at uk.ibm.com Lotus Notes: Emily Jiang/UK/IBM at IBMGB From: Martin Kouba To: Emily Jiang , Weld-Dev List Date: 04/09/2017 09:24 Subject: Re: [weld-dev] Principal built-in bean Sent by: weld-dev-bounces at lists.jboss.org It's @Dependent. But a special proxy is injected and SPI org.jboss.weld.security.spi.SecurityServices.getPrincipal() is invoked to obtain the current caller identity for every invocation of an injected reference. Martin Dne 1.9.2017 v 16:57 Emily Jiang napsal(a): > A Java EE or embeddable EJB container must provide the following > built-in beans, all of which > have qualifier @Default: > > a bean with bean type javax.security.Principal, allowing injection of a > Principal > representing the current caller identity. > > The spec does not say the scope of this bean. In Weld, what is the scope > for the Principal bean? > > -- > Thanks > Emily > ================= > Emily Jiang > ejiang at apache.org > > > _______________________________________________ > weld-dev mailing list > weld-dev at lists.jboss.org > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.jboss.org_mailman_listinfo_weld-2Ddev&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=jt2y5_gH2oPaja8Vt6NzAZV-iEo6D2jiWeuVYs0H-1U&m=jIKn0UxNi92JGBmOv2ycs3JoHrlVZC6ARxh7qsqJzE8&s=7SXNuw9nF99r1RrRF97m4EBatYRmA9igLcjOExFx6ak&e= > -- Martin Kouba Senior Software Engineer Red Hat, Czech Republic _______________________________________________ weld-dev mailing list weld-dev at lists.jboss.org https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.jboss.org_mailman_listinfo_weld-2Ddev&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=jt2y5_gH2oPaja8Vt6NzAZV-iEo6D2jiWeuVYs0H-1U&m=jIKn0UxNi92JGBmOv2ycs3JoHrlVZC6ARxh7qsqJzE8&s=7SXNuw9nF99r1RrRF97m4EBatYRmA9igLcjOExFx6ak&e= Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20170904/1631deef/attachment.html From mkouba at redhat.com Mon Sep 4 05:17:52 2017 From: mkouba at redhat.com (Martin Kouba) Date: Mon, 4 Sep 2017 11:17:52 +0200 Subject: [weld-dev] Principal built-in bean In-Reply-To: References: <1e8cb22b-af26-378b-1d1b-d27f2170b0f6@redhat.com> Message-ID: <8c729f4a-c41e-73da-e85a-45c6bc8e81b2@redhat.com> Well, it works similar to how @Dependent stateless session beans work. Unlike @RequestScoped there is no real CDI context just a special proxy that delegates to SPI. Martin Dne 4.9.2017 v 11:09 Emily Jiang napsal(a): > Does this mean it functions as a Request scoped bean even though it is a > Dependent bean? > > Many thanks, > Emily > =========================== > Emily Jiang > WebSphere Application Server, CDI & MicroProfile Development Lead > > MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN > Phone: +44 (0)1962 816278 Internal: 246278 > > Email: emijiang at uk.ibm.com > Lotus Notes: Emily Jiang/UK/IBM at IBMGB > > > > > From: Martin Kouba > To: Emily Jiang , Weld-Dev List > > Date: 04/09/2017 09:24 > Subject: Re: [weld-dev] Principal built-in bean > Sent by: weld-dev-bounces at lists.jboss.org > ------------------------------------------------------------------------ > > > > It's @Dependent. But a special proxy is injected and SPI > org.jboss.weld.security.spi.SecurityServices.getPrincipal() is invoked > to obtain the current caller identity for every invocation of an > injected reference. > > Martin > > Dne 1.9.2017 v 16:57 Emily Jiang napsal(a): > > A Java EE or embeddable EJB container must provide the following > > built-in beans, all of which > > have qualifier @Default: > > > > a bean with bean type javax.security.Principal, allowing injection of a > > Principal > > representing the current caller identity. > > > > The spec does not say the scope of this bean. In Weld, what is the scope > > for the Principal bean? > > > > -- > > Thanks > > Emily > > ================= > > Emily Jiang > > ejiang at apache.org > > > > > > _______________________________________________ > > weld-dev mailing list > > weld-dev at lists.jboss.org > > > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.jboss.org_mailman_listinfo_weld-2Ddev&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=jt2y5_gH2oPaja8Vt6NzAZV-iEo6D2jiWeuVYs0H-1U&m=jIKn0UxNi92JGBmOv2ycs3JoHrlVZC6ARxh7qsqJzE8&s=7SXNuw9nF99r1RrRF97m4EBatYRmA9igLcjOExFx6ak&e= > > > > -- > Martin Kouba > Senior Software Engineer > Red Hat, Czech Republic > _______________________________________________ > weld-dev mailing list > weld-dev at lists.jboss.org > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.jboss.org_mailman_listinfo_weld-2Ddev&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=jt2y5_gH2oPaja8Vt6NzAZV-iEo6D2jiWeuVYs0H-1U&m=jIKn0UxNi92JGBmOv2ycs3JoHrlVZC6ARxh7qsqJzE8&s=7SXNuw9nF99r1RrRF97m4EBatYRmA9igLcjOExFx6ak&e= > > > > Unless stated otherwise above: > IBM United Kingdom Limited - Registered in England and Wales with number > 741598. > Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU -- Martin Kouba Senior Software Engineer Red Hat, Czech Republic From arjan.tijms at gmail.com Mon Sep 4 05:22:34 2017 From: arjan.tijms at gmail.com (arjan tijms) Date: Mon, 4 Sep 2017 11:22:34 +0200 Subject: [weld-dev] Principal built-in bean In-Reply-To: <8c729f4a-c41e-73da-e85a-45c6bc8e81b2@redhat.com> References: <1e8cb22b-af26-378b-1d1b-d27f2170b0f6@redhat.com> <8c729f4a-c41e-73da-e85a-45c6bc8e81b2@redhat.com> Message-ID: Hi, On Mon, Sep 4, 2017 at 11:17 AM, Martin Kouba wrote: > Well, it works similar to how @Dependent stateless session beans work. > Unlike @RequestScoped there is no real CDI context just a special proxy > that delegates to SPI. Indeed, it can't be really request scope, since the principal can potentially change many times during a request. Though, once initially set it normally applies for the remainder of the web request. For other usages of the request scope it's not so well defined in EE actually. Talking about this build-in bean though, wouldn't it be a good idea to let JSR 375 take ownership of it? The CDI spec before proposed to the servlet spec to take ownership of the build-in beans for the Servlet owned artefacts (such as HttpServletRequest). Kind regards, Arjan Tijms -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20170904/f57bc4e4/attachment.html From mkouba at redhat.com Tue Sep 5 02:43:50 2017 From: mkouba at redhat.com (Martin Kouba) Date: Tue, 5 Sep 2017 08:43:50 +0200 Subject: [weld-dev] Fwd: Re[2]: How to make method injection when bean subclass is required in Weld? In-Reply-To: <1504550870.788796245@f388.i.mail.ru> References: <1504170452.423847381@f451.i.mail.ru> <1504550870.788796245@f388.i.mail.ru> Message-ID: This is expected. See also assignability rules [1]. You need to use TypeLiteral [2]: instance.select(new TypeLiteral>() {}) Martin [1] https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#assignable_parameters [2] https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#annotationliteral_typeliteral Dne 4.9.2017 v 20:47 Alex Sviridov napsal(a): > Hi Martin, > > I am back with question about your solution. I have class Temp and I > create CDI bean using Instance.select(Temp.class).get(). > > However, I get Caused by: > org.jboss.weld.exceptions.UnsatisfiedResolutionException: WELD-001334: > Unsatisfied dependencies for type Temp with qualifiers @Default. > > Could you say, how your solution can be used to create bean with generic? > > Best regards, Alex > > > > ???????, 31 ??????? 2017, 12:50 +03:00 ?? Martin Kouba > : > > Hi Alex, > > 1) should work but looks a little bit cumbersome. WRT 2) you should > avoid using BeanManager to create a bean instance whenever possible. > And > in this particular case, if SimpleFoo is @Dependent it wouldn't be > destroyed correctly (@PreDestroy) when Parent or Child is destroyed. > > The following should also work (no need to have two Instance IPs): > > public class Parent { > > @Inject > private Instance fooInstance; > > private SimpleFoo foo; > > protected SimpleFoo newFoo() { > return fooInstance.get(); > } > > @PostConstruct > private void doPostConstruct() { > foo = newFoo(); > } > } > > public class Child extends Parent { > > @Override > protected AdvancedFoo newFoo() { > return fooInstance.select(AdvancedFoo.class).get(); > } > } > > > Martin > > Dne 31.8.2017 v 11:07 Alex Sviridov napsal(a): > > Hi Martin, > > > > > > Could you comment the following solutions? > > > > 1) > > public class Parent { > > > > @Inject > > private Instance fooInstance; > > > > private SimpleFoo foo; > > > > protected SimpleFoo newFoo() { > > return fooInstance.get(); > > } > > > > @PostConstruct > > private void doPostConstruct() { > > foo = newFoo(); > > } > > } > > > > public class Child extends Parent { > > > > @Inject > > private Instance fooInstance; > > > > @Override > > protected AdvancedFoo newFoo() { > > return fooInstance.get(); > > } > > } > > > > > > 2) > > > > public class Parent { > > > > @Inject > > protected BeanManager beanManager; > > > > private SimpleFoo foo; > > > > protected SimpleFoo newFoo() { > > SimpleFoo foo = constructing bean with BM; > > return foo; > > } > > > > @PostConstruct > > private void doPostConstruct() { > > foo = newFoo(); > > } > > } > > > > public class Child extends Parent { > > > > @Override > > protected AdvancedFoo newFoo() { > > AdvancedFoo foo = constructing bean with BM; > > return foo; > > } > > } > > > > > > Best regards, Alex > > > > ?????, 30 ??????? 2017, 10:51 +03:00 ?? Matej Novotny > > > >>: > > > > 1) If you inject Instance, you still have the ambiguous > > dependency issue for any class which does have a subclass. > > E.g. from your sample: > > > > @Inject > > Instance instance; > > > > //within some method > > instance.get(); -> this will blow up because you have two beans > > which have SimpleFoo type (SimpleFoo and AdvancedFoo) > > > > 2) I don't understand what you mean by this. How does BM help here? > > > > > > Sidenote: > > You might want to try and use what Martin said - limiting the types > > of a bean with @Typed(MyClass.Foo). > > That way you have control over the bean types and can further > > manupulate the injection. > > Limit all your children to only the actual subclass type they have: > > > > @Dependent > > @Typed(AdvancedFoo.class) > > public class AdvancedFoo extends SimpleFoo { > > // this ben now only has a bean of AdvancedFoo, e.g. it does not > > fit into injection point for SimpleFoo > > } > > > > And then override the initializer methods like this: > > > > @Dependent > > public class Parent extends Child { > > > > @Inject > > @Override > > protected void setFoo(AdvancedFoo foo) { > > this.foo = foo; // assuming foo is a protected field > > } > > } > > > > Matej > > > > > > ----- Original Message ----- > > > From: "Alex Sviridov" > > >> > > > To: "weld-dev" > > >> > > > Sent: Tuesday, August 29, 2017 8:54:47 PM > > > Subject: Re: [weld-dev] How to make method injection when bean > > subclass is required in Weld? > > > > > > I thought here, and would like to share my ideas hoping to get > > comments from > > > more experienced people. > > > > > > First of all I came to conclusion that CDI works badly with cases > > when we > > > need > > > to change field values in super classes. If there is a lot of > > inheritance as > > > in my case: > > > ParentA, ChildA0, ChildA1.., ParentB, ChildB0, ChildB1..,... then > > situation > > > is > > > becoming very bad. Maybe in future there will be other solutions > > in CDI > > > specs. > > > > > > I found two additional ways that can be used. 1) Inject not > beans but > > > instances, > > > + method SimpleFoo newFoo {return Instance.get} + > > overriding. > > > 2) Inject BeanManager + method SimpleFoo newFoo() > {beanManager...} + > > > overriding. > > > > > > Maybe such ways can be named lazy/postponed initialization with > > overriding > > > support.... > > > > > > Best regards, Alex > > > > > > > > > > > > > > > ???????, 29 ??????? 2017, 18:22 +03:00 ?? Martin Kouba > > > >>: > > > > > > Hi Alex, > > > > > > that's an interesting question. Indeed, qualifiers are the way to > > go if > > > you need to keep the method signature. > > > > > > Another way could be to override the setFoo() method so that the > > Child > > > initializer is ignored and add a new method to inject AdvancedFoo: > > > > > > @Override > > > protected void setFoo(SimpleFoo foo) { // Do nothing } > > > > > > @Inject > > > void setAdvancedFoo(AdvancedFoo foo) { > > > super.setFoo(foo); > > > } > > > > > > However, note that right now there are the following beans: > > > > > > SimpleFoo with bean types Object, SimpleFoo > > > AdvancedFoo -> Object, SimpleFoo, AdvancedFoo > > > > > > So if you do @Inject SimpleFoo you get ambiguous dependency > exception > > > because both SimpleFoo and AdvancedFoo are eligible for injection. > > > > > > To resolve this you need to use qualifiers or restrict the bean > > types of > > > AdvancedFoo: > > > > > > @Typed(AdvancedFoo.class) > > > class AdvancedFoo extends SimpleFoo {} > > > > > > HTH > > > > > > Martin > > > > > > > > > Dne 29.8.2017 v 15:09 Matej Novotny napsal(a): > > > > Hi Alex, > > > > > > > > no need to be sorry, you have come to the right place :) > > > > As for your question, the simplest thing is probably to use > > qualifiers. > > > > > > > > Create your own like this: > > > > > > > > @Qualifier > > > > @Retention(RetentionPolicy.RUNTIME) > > > > @Target({ ElementType.TYPE, ElementType.PARAMETER, > > ElementType.FIELD, > > > > ElementType.METHOD }) > > > > public @interface MyQualifier {} > > > > > > > > > > > > And then change your AdvancedFoo class to use the qualifier: > > > > > > > > @Dependent > > > > @MyQualifier > > > > public class AdvancedFoo extends SimpleFoo { > > > > } > > > > > > > > And accordingly, the init method which uses injection should > > then look like > > > > this: > > > > > > > > @Dependent > > > > public class Parent extends Child { > > > > > > > > @Inject > > > > @Override > > > > protected void setFoo(@MyQualifier SimpleFoo foo) { > > > > super.setFoo(foo); > > > > } > > > > } > > > > > > > > Does this answer your question? > > > > > > > > Matej > > > > > > > > ----- Original Message ----- > > > >> From: "Alex Sviridov" < ooo_saturn7 at mail.ru > > > > > > > > >> To: "weld-dev" < weld-dev at lists.jboss.org > > > > > > > > >> Sent: Tuesday, August 29, 2017 1:46:23 PM > > > >> Subject: [weld-dev] How to make method injection when bean > > subclass is > > > >> required in Weld? > > > >> > > > >> Hi all, > > > >> > > > >> I am really sorry for writing to this mailing list, but I > > checked all user > > > >> forums and chats and saw that they are very old. > > > >> > > > >> I would be very thankful if someone gives suggestion for > > solving the > > > >> following problem. > > > >> I have a child and parent class. Child has SimpleFoo, Parent > > needs Advaced > > > >> foo. So, > > > >> > > > >> @Dependent > > > >> public class SimpleFoo { > > > >> } > > > >> > > > >> @Dependent > > > >> public class AdvancedFoo extends SimpleFoo { > > > >> } > > > >> > > > >> @Dependent > > > >> public class Child { > > > >> > > > >> private SimpleFoo foo; > > > >> > > > >> @Inject > > > >> protected void setFoo(SimpleFoo foo) { > > > >> this.foo = foo; > > > >> } > > > >> } > > > >> > > > >> @Dependent > > > >> public class Parent extends Child { > > > >> > > > >> @Inject > > > >> @Override > > > >> protected void setFoo(SimpleFoo foo) { //How to inject here > > AdvancedFoo? > > > >> super.setFoo(foo); > > > >> } > > > >> } > > > >> > > > >> How to inject in Parent AdvancedFoo? I know that I can do it via > > > >> constructor > > > >> injection > > > >> but I need method injection. How to do it? Can it be done > > without using > > > >> names > > > >> (like MyBean1) > > > >> but only using classes (AdvancedFoo)? > > > >> > > > >> Best regards, Alex > > > >> > > > >> > > > >> > > > >> > > > >> > > > >> -- > > > >> Alex Sviridov > > > >> > > > >> _______________________________________________ > > > >> weld-dev mailing list > > > >> weld-dev at lists.jboss.org > > > > > >> https://lists.jboss.org/mailman/listinfo/weld-dev > > > > _______________________________________________ > > > > weld-dev mailing list > > > > weld-dev at lists.jboss.org > > > > > > https://lists.jboss.org/mailman/listinfo/weld-dev > > > > > > > > > > -- > > > Martin Kouba > > > Senior Software Engineer > > > Red Hat, Czech Republic > > > > > > > > > _______________________________________________ > > > weld-dev mailing list > > > weld-dev at lists.jboss.org > > > > > https://lists.jboss.org/mailman/listinfo/weld-dev > > > > > > > > > ------------------------------------------------------------------------ > > > > -- > > Alex Sviridov > > -- > Martin Kouba > Senior Software Engineer > Red Hat, Czech Republic > > > > -- > Alex Sviridov -- Martin Kouba Senior Software Engineer Red Hat, Czech Republic From manovotn at redhat.com Mon Sep 11 03:21:07 2017 From: manovotn at redhat.com (Matej Novotny) Date: Mon, 11 Sep 2017 03:21:07 -0400 (EDT) Subject: [weld-dev] Weld 2.4.5.Final released In-Reply-To: <1509629634.9598846.1505114197377.JavaMail.zimbra@redhat.com> Message-ID: <760063320.9602221.1505114467186.JavaMail.zimbra@redhat.com> Bugfix release of Weld 2 branch, CDI 1.2, is out. Check the news post for 2.4.5.Final to learn details - http://weld.cdi-spec.org/news/2017/09/11/weld-245Final/ From ooo_saturn7 at mail.ru Sun Sep 17 09:25:49 2017 From: ooo_saturn7 at mail.ru (=?UTF-8?B?QWxleCBTdmlyaWRvdg==?=) Date: Sun, 17 Sep 2017 16:25:49 +0300 Subject: [weld-dev] =?utf-8?q?Weld_and_Java_9_JPMS?= Message-ID: <1505654749.975455722@f450.i.mail.ru> Hi all Could anyone provide information how weld works (if works) with Java 9 JPMS? Is there any tutorial? Best regards, Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20170917/16859c92/attachment.html From manovotn at redhat.com Mon Sep 18 01:10:28 2017 From: manovotn at redhat.com (Matej Novotny) Date: Mon, 18 Sep 2017 01:10:28 -0400 (EDT) Subject: [weld-dev] Weld and Java 9 JPMS In-Reply-To: <1505654749.975455722@f450.i.mail.ru> References: <1505654749.975455722@f450.i.mail.ru> Message-ID: <1089077414.11595440.1505711428425.JavaMail.zimbra@redhat.com> Hi Alex Back there we did some tests with earlier versions of Java 9 and eliminated some crucial problems. I think it should be possible to take *existing* app and run it on Java 9. However, creating a whole new modular project might present some additional challenges. Weld itself is not modularized (since it needs to run on Java 8), therefore you would need to list some extra "requires" in module-info.java for Weld. You also need to have reflection access allowed (we need to instantiate proxies etc) but last time I checked, it was by default enabled in JDK 9 wi th just warning showing up. Other than that, it might just work. To answer your other question - no, there is no tutorial, for there is no special difference between Weld and many other projects in regard to JDK 9. Matej ----- Original Message ----- > From: "Alex Sviridov" > To: "weld-dev" > Sent: Sunday, September 17, 2017 3:25:49 PM > Subject: [weld-dev] Weld and Java 9 JPMS > > Hi all > > Could anyone provide information how weld works (if works) with Java 9 JPMS? > Is there any tutorial? > > Best regards, Alex > > _______________________________________________ > weld-dev mailing list > weld-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/weld-dev From manovotn at redhat.com Mon Sep 18 05:40:50 2017 From: manovotn at redhat.com (Matej Novotny) Date: Mon, 18 Sep 2017 05:40:50 -0400 (EDT) Subject: [weld-dev] Weld and Java 9 JPMS In-Reply-To: <1505723291.865800575@f366.i.mail.ru> References: <1505654749.975455722@f450.i.mail.ru> <1089077414.11595440.1505711428425.JavaMail.zimbra@redhat.com> <1505723291.865800575@f366.i.mail.ru> Message-ID: <366652593.11631544.1505727650798.JavaMail.zimbra@redhat.com> Uhm, is there anything blocking you from placing it where you would in Java 8? E.g. src/main/resources/META-INF? I don't think I have tried this combination (or I do not recall). >From the top of my head I don't know any JDK 9 limitation which would forbid to use XML descriptors in this way. I might be a bit rusty though; been a while since I played with Java 9. Please do report back with how this works for you :) Matej ----- Original Message ----- > From: "Alex Sviridov" > To: "Matej Novotny" > Sent: Monday, September 18, 2017 10:28:11 AM > Subject: Re[2]: [weld-dev] Weld and Java 9 JPMS > > Thank you for your answer. I will try. But where should I place beans.xml > to make Weld read it if I use Java SE+ JPMS? > > Best regards, Alex > > > >???????????, 18 ???????? 2017, 8:10 +03:00 ?? Matej Novotny > >: > > > >Hi Alex > > > >Back there we did some tests with earlier versions of Java 9 and eliminated > >some crucial problems. > >I think it should be possible to take *existing* app and run it on Java 9. > > > >However, creating a whole new modular project might present some additional > >challenges. > >Weld itself is not modularized (since it needs to run on Java 8), therefore > >you would need to list some extra "requires" in module-info.java for Weld. > >You also need to have reflection access allowed (we need to instantiate > >proxies etc) but last time I checked, it was by default enabled in JDK 9 wi > >th just warning showing up. > >Other than that, it might just work. > > > >To answer your other question - no, there is no tutorial, for there is no > >special difference between Weld and many other projects in regard to JDK 9. > > > >Matej > > > >----- Original Message ----- > >> From: "Alex Sviridov" < ooo_saturn7 at mail.ru > > >> To: "weld-dev" < weld-dev at lists.jboss.org > > >> Sent: Sunday, September 17, 2017 3:25:49 PM > >> Subject: [weld-dev] Weld and Java 9 JPMS > >> > >> Hi all > >> > >> Could anyone provide information how weld works (if works) with Java 9 > >> JPMS? > >> Is there any tutorial? > >> > >> Best regards, Alex > >> > >> _______________________________________________ > >> weld-dev mailing list > >> weld-dev at lists.jboss.org > >> https://lists.jboss.org/mailman/listinfo/weld-dev > > > -- > Alex Sviridov > From ooo_saturn7 at mail.ru Mon Sep 18 06:17:28 2017 From: ooo_saturn7 at mail.ru (=?UTF-8?B?QWxleCBTdmlyaWRvdg==?=) Date: Mon, 18 Sep 2017 13:17:28 +0300 Subject: [weld-dev] =?utf-8?q?Weld_and_Java_9_JPMS?= In-Reply-To: <366652593.11631544.1505727650798.JavaMail.zimbra@redhat.com> References: <1505654749.975455722@f450.i.mail.ru> <1505723291.865800575@f366.i.mail.ru> <366652593.11631544.1505727650798.JavaMail.zimbra@redhat.com> Message-ID: <1505729848.387395238@f175.i.mail.ru> Hi Matej I am just trying to make Weld work in Java 9 (JavaSE + JPMS). I use the following jars as automatic modules: weld-environment-common-3.0.2-SNAPSHOT.jar weld-se-core-3.0.2-SNAPSHOT.jar weld-se-shaded-3.0.2-SNAPSHOT.jar weld-spi-3.0.SP1.jar weld-core-impl-3.0.2-SNAPSHOT.jar Is this right configuration? Or should I add/remove something. Best regards, Alex >???????????, 18 ???????? 2017, 12:41 +03:00 ?? Matej Novotny : > >Uhm, is there anything blocking you from placing it where you would in Java 8? >E.g. src/main/resources/META-INF? > >I don't think I have tried this combination (or I do not recall). >From the top of my head I don't know any JDK 9 limitation which would forbid to use XML descriptors in this way. >I might be a bit rusty though; been a while since I played with Java 9. > >Please do report back with how this works for you :) >Matej > >----- Original Message ----- >> From: "Alex Sviridov" < ooo_saturn7 at mail.ru > >> To: "Matej Novotny" < manovotn at redhat.com > >> Sent: Monday, September 18, 2017 10:28:11 AM >> Subject: Re[2]: [weld-dev] Weld and Java 9 JPMS >> >> Thank you for your answer. I will try. But where should I place beans.xml >> to make Weld read it if I use Java SE+ JPMS? >> >> Best regards, Alex >> >> >> >???????????, 18 ???????? 2017, 8:10 +03:00 ?? Matej Novotny >> >< manovotn at redhat.com >: >> > >> >Hi Alex >> > >> >Back there we did some tests with earlier versions of Java 9 and eliminated >> >some crucial problems. >> >I think it should be possible to take *existing* app and run it on Java 9. >> > >> >However, creating a whole new modular project might present some additional >> >challenges. >> >Weld itself is not modularized (since it needs to run on Java 8), therefore >> >you would need to list some extra "requires" in module-info.java for Weld. >> >You also need to have reflection access allowed (we need to instantiate >> >proxies etc) but last time I checked, it was by default enabled in JDK 9 wi >> >th just warning showing up. >> >Other than that, it might just work. >> > >> >To answer your other question - no, there is no tutorial, for there is no >> >special difference between Weld and many other projects in regard to JDK 9. >> > >> >Matej >> > >> >----- Original Message ----- >> >> From: "Alex Sviridov" < ooo_saturn7 at mail.ru > >> >> To: "weld-dev" < weld-dev at lists.jboss.org > >> >> Sent: Sunday, September 17, 2017 3:25:49 PM >> >> Subject: [weld-dev] Weld and Java 9 JPMS >> >> >> >> Hi all >> >> >> >> Could anyone provide information how weld works (if works) with Java 9 >> >> JPMS? >> >> Is there any tutorial? >> >> >> >> Best regards, Alex >> >> >> >> _______________________________________________ >> >> weld-dev mailing list >> >> weld-dev at lists.jboss.org >> >> https://lists.jboss.org/mailman/listinfo/weld-dev >> >> >> -- >> Alex Sviridov >> -- Alex Sviridov -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20170918/94e73600/attachment.html From manovotn at redhat.com Mon Sep 18 07:18:25 2017 From: manovotn at redhat.com (Matej Novotny) Date: Mon, 18 Sep 2017 07:18:25 -0400 (EDT) Subject: [weld-dev] Weld and Java 9 JPMS In-Reply-To: <1505729848.387395238@f175.i.mail.ru> References: <1505654749.975455722@f450.i.mail.ru> <1505723291.865800575@f366.i.mail.ru> <366652593.11631544.1505727650798.JavaMail.zimbra@redhat.com> <1505729848.387395238@f175.i.mail.ru> Message-ID: <973668076.11645734.1505733505330.JavaMail.zimbra@redhat.com> Hi, if you are in SE, you should only need 'weld-se-shaded' artifact (as a JAR). As it is "shaded", it brings along all the other parts of Weld you might need. Matej ----- Original Message ----- > From: "Alex Sviridov" > To: "weld-dev" > Sent: Monday, September 18, 2017 12:17:28 PM > Subject: Re: [weld-dev] Weld and Java 9 JPMS > > Hi Matej > > I am just trying to make Weld work in Java 9 (JavaSE + JPMS). > > I use the following jars as automatic modules: > > weld-environment-common-3.0.2-SNAPSHOT.jar > weld-se-core-3.0.2-SNAPSHOT.jar > weld-se-shaded-3.0.2-SNAPSHOT.jar > weld-spi-3.0.SP1.jar > weld-core-impl-3.0.2-SNAPSHOT.jar > > Is this right configuration? Or should I add/remove something. > > Best regards, Alex > > > > ???????????, 18 ???????? 2017, 12:41 +03:00 ?? Matej Novotny > : > > Uhm, is there anything blocking you from placing it where you would in Java > 8? > E.g. src/main/resources/META-INF? > > I don't think I have tried this combination (or I do not recall). > From the top of my head I don't know any JDK 9 limitation which would forbid > to use XML descriptors in this way. > I might be a bit rusty though; been a while since I played with Java 9. > > Please do report back with how this works for you :) > Matej > > ----- Original Message ----- > > From: "Alex Sviridov" < ooo_saturn7 at mail.ru > > > To: "Matej Novotny" < manovotn at redhat.com > > > Sent: Monday, September 18, 2017 10:28:11 AM > > Subject: Re[2]: [weld-dev] Weld and Java 9 JPMS > > > > Thank you for your answer. I will try. But where should I place beans.xml > > to make Weld read it if I use Java SE+ JPMS? > > > > Best regards, Alex > > > > > > >???????????, 18 ???????? 2017, 8:10 +03:00 ?? Matej Novotny > > >< manovotn at redhat.com >: > > > > > >Hi Alex > > > > > >Back there we did some tests with earlier versions of Java 9 and > > >eliminated > > >some crucial problems. > > >I think it should be possible to take *existing* app and run it on Java 9. > > > > > >However, creating a whole new modular project might present some > > >additional > > >challenges. > > >Weld itself is not modularized (since it needs to run on Java 8), > > >therefore > > >you would need to list some extra "requires" in module-info.java for Weld. > > >You also need to have reflection access allowed (we need to instantiate > > >proxies etc) but last time I checked, it was by default enabled in JDK 9 > > >wi > > >th just warning showing up. > > >Other than that, it might just work. > > > > > >To answer your other question - no, there is no tutorial, for there is no > > >special difference between Weld and many other projects in regard to JDK > > >9. > > > > > >Matej > > > > > >----- Original Message ----- > > >> From: "Alex Sviridov" < ooo_saturn7 at mail.ru > > > >> To: "weld-dev" < weld-dev at lists.jboss.org > > > >> Sent: Sunday, September 17, 2017 3:25:49 PM > > >> Subject: [weld-dev] Weld and Java 9 JPMS > > >> > > >> Hi all > > >> > > >> Could anyone provide information how weld works (if works) with Java 9 > > >> JPMS? > > >> Is there any tutorial? > > >> > > >> Best regards, Alex > > >> > > >> _______________________________________________ > > >> weld-dev mailing list > > >> weld-dev at lists.jboss.org > > >> https://lists.jboss.org/mailman/listinfo/weld-dev > > > > > > -- > > Alex Sviridov > > > > > -- > Alex Sviridov > > _______________________________________________ > weld-dev mailing list > weld-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/weld-dev From ooo_saturn7 at mail.ru Mon Sep 18 07:46:36 2017 From: ooo_saturn7 at mail.ru (=?UTF-8?B?QWxleCBTdmlyaWRvdg==?=) Date: Mon, 18 Sep 2017 14:46:36 +0300 Subject: [weld-dev] =?utf-8?q?Weld_and_Java_9_JPMS?= In-Reply-To: <973668076.11645734.1505733505330.JavaMail.zimbra@redhat.com> References: <1505654749.975455722@f450.i.mail.ru> <1505729848.387395238@f175.i.mail.ru> <973668076.11645734.1505733505330.JavaMail.zimbra@redhat.com> Message-ID: <1505735196.734954822@f340.i.mail.ru> Thank you for your answer. Could anyone give any suggestion about the following? I have my named module and weld-se-shaded as unnamed module. In my module I have module my.module { ??? requires weld.se.shaded; ??? exports com.foo; } ################################# package com.foo; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; @ApplicationScoped public class NewClass { ??? @Inject ??? private NewBean bean; ??? public void doIt() { ??????? bean.doIt(); ??? } } ################################# package com.foo; import javax.enterprise.context.Dependent; @Dependent public class NewBean { ??? public void doIt() { ??????? System.out.println("I am doing it); ??? } } And this is the result Sep 18, 2017 2:33:12 PM org.jboss.weld.bootstrap.WeldStartup INFO: WELD-000900: 3.0.2 (2017-09-18 08:49) Sep 18, 2017 2:33:12 PM org.jboss.weld.environment.deployment.discovery.ReflectionDiscoveryStrategy processAnnotatedDiscovery INFO: WELD-ENV-000014: Falling back to Java Reflection for bean-discovery-mode="annotated" discovery. Add org.jboss:jandex to the classpath to speed-up startup. Sep 18, 2017 2:33:12 PM org.jboss.weld.bootstrap.WeldStartup startContainer INFO: WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously. Exception in thread "main" java.lang.reflect.InaccessibleObjectException ?? ?at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ?? ?at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ?? ?at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ?? ?at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488) ?? ?at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:590) ?? ?at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:996) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions(AbstractExecutorServices.java:72) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:58) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:66) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer.createClassBeans(ConcurrentBeanDeployer.java:65) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:256) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:422) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.environment.se.Weld.initialize(Weld.java:789) ?? ?at my.module/com.foo.NewMain.main(NewMain.java:47) Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private com.foo.NewBean com.foo.NewClass.bean accessible: module my.module does not "opens com.foo" to module weld.se.shaded ?? ?at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337) ?? ?at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281) ?? ?at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:176) ?? ?at java.base/java.lang.reflect.Field.setAccessible(Field.java:170) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.of(GetAccessibleCopyOfMember.java:38) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.run(GetAccessibleCopyOfMember.java:44) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.run(GetAccessibleCopyOfMember.java:26) ?? ?at java.base/java.security.AccessController.doPrivileged(Native Method) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.FieldInjectionPoint.(FieldInjectionPoint.java:65) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.createFieldInjectionPoint(InjectionPointFactory.java:141) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.addFieldInjectionPoint(InjectionPointFactory.java:226) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.getFieldInjectionPoints(InjectionPointFactory.java:211) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.DefaultInjector.(DefaultInjector.java:56) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.ResourceInjector.(ResourceInjector.java:57) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.ResourceInjector.of(ResourceInjector.java:48) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.BeanInjectionTarget.(BeanInjectionTarget.java:63) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.BeanInjectionTarget.createDefault(BeanInjectionTarget.java:47) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.manager.InjectionTargetFactoryImpl.chooseInjectionTarget(InjectionTargetFactoryImpl.java:139) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:88) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.ManagedBean.(ManagedBean.java:100) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.ManagedBean.of(ManagedBean.java:80) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.AbstractBeanDeployer.createManagedBean(AbstractBeanDeployer.java:280) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.BeanDeployer.createClassBean(BeanDeployer.java:221) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:68) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:65) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55) ?? ?at java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1431) ?? ?at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:283) ?? ?at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1603) ?? ?at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) >???????????, 18 ???????? 2017, 14:18 +03:00 ?? Matej Novotny : > >Hi, > >if you are in SE, you should only need 'weld-se-shaded' artifact (as a JAR). >As it is "shaded", it brings along all the other parts of Weld you might need. > >Matej > > >----- Original Message ----- >> From: "Alex Sviridov" < ooo_saturn7 at mail.ru > >> To: "weld-dev" < weld-dev at lists.jboss.org > >> Sent: Monday, September 18, 2017 12:17:28 PM >> Subject: Re: [weld-dev] Weld and Java 9 JPMS >> >> Hi Matej >> >> I am just trying to make Weld work in Java 9 (JavaSE + JPMS). >> >> I use the following jars as automatic modules: >> >> weld-environment-common-3.0.2-SNAPSHOT.jar >> weld-se-core-3.0.2-SNAPSHOT.jar >> weld-se-shaded-3.0.2-SNAPSHOT.jar >> weld-spi-3.0.SP1.jar >> weld-core-impl-3.0.2-SNAPSHOT.jar >> >> Is this right configuration? Or should I add/remove something. >> >> Best regards, Alex >> >> >> >> ???????????, 18 ???????? 2017, 12:41 +03:00 ?? Matej Novotny >> < manovotn at redhat.com >: >> >> Uhm, is there anything blocking you from placing it where you would in Java >> 8? >> E.g. src/main/resources/META-INF? >> >> I don't think I have tried this combination (or I do not recall). >> From the top of my head I don't know any JDK 9 limitation which would forbid >> to use XML descriptors in this way. >> I might be a bit rusty though; been a while since I played with Java 9. >> >> Please do report back with how this works for you :) >> Matej >> >> ----- Original Message ----- >> > From: "Alex Sviridov" < ooo_saturn7 at mail.ru > >> > To: "Matej Novotny" < manovotn at redhat.com > >> > Sent: Monday, September 18, 2017 10:28:11 AM >> > Subject: Re[2]: [weld-dev] Weld and Java 9 JPMS >> > >> > Thank you for your answer. I will try. But where should I place beans.xml >> > to make Weld read it if I use Java SE+ JPMS? >> > >> > Best regards, Alex >> > >> > >> > >???????????, 18 ???????? 2017, 8:10 +03:00 ?? Matej Novotny >> > >< manovotn at redhat.com >: >> > > >> > >Hi Alex >> > > >> > >Back there we did some tests with earlier versions of Java 9 and >> > >eliminated >> > >some crucial problems. >> > >I think it should be possible to take *existing* app and run it on Java 9. >> > > >> > >However, creating a whole new modular project might present some >> > >additional >> > >challenges. >> > >Weld itself is not modularized (since it needs to run on Java 8), >> > >therefore >> > >you would need to list some extra "requires" in module-info.java for Weld. >> > >You also need to have reflection access allowed (we need to instantiate >> > >proxies etc) but last time I checked, it was by default enabled in JDK 9 >> > >wi >> > >th just warning showing up. >> > >Other than that, it might just work. >> > > >> > >To answer your other question - no, there is no tutorial, for there is no >> > >special difference between Weld and many other projects in regard to JDK >> > >9. >> > > >> > >Matej >> > > >> > >----- Original Message ----- >> > >> From: "Alex Sviridov" < ooo_saturn7 at mail.ru > >> > >> To: "weld-dev" < weld-dev at lists.jboss.org > >> > >> Sent: Sunday, September 17, 2017 3:25:49 PM >> > >> Subject: [weld-dev] Weld and Java 9 JPMS >> > >> >> > >> Hi all >> > >> >> > >> Could anyone provide information how weld works (if works) with Java 9 >> > >> JPMS? >> > >> Is there any tutorial? >> > >> >> > >> Best regards, Alex >> > >> >> > >> _______________________________________________ >> > >> weld-dev mailing list >> > >> weld-dev at lists.jboss.org >> > >> https://lists.jboss.org/mailman/listinfo/weld-dev >> > >> > >> > -- >> > Alex Sviridov >> > >> >> >> -- >> Alex Sviridov >> >> _______________________________________________ >> weld-dev mailing list >> weld-dev at lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/weld-dev -- Alex Sviridov -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20170918/701bd3c7/attachment-0001.html From manovotn at redhat.com Mon Sep 18 09:39:31 2017 From: manovotn at redhat.com (Matej Novotny) Date: Mon, 18 Sep 2017 09:39:31 -0400 (EDT) Subject: [weld-dev] Weld and Java 9 JPMS In-Reply-To: <1505735196.734954822@f340.i.mail.ru> References: <1505654749.975455722@f450.i.mail.ru> <1505729848.387395238@f175.i.mail.ru> <973668076.11645734.1505733505330.JavaMail.zimbra@redhat.com> <1505735196.734954822@f340.i.mail.ru> Message-ID: <515880442.11691741.1505741971242.JavaMail.zimbra@redhat.com> >From the exception you are getting, this line is important: "Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private com.foo.NewBean com.foo.NewClass.bean accessible: module my.module does not "opens com.foo" to module weld.se.shaded" Basically, Weld is not modularized (== lands in unnamed module) and it needs access to your module so that it can create beans. E.g. you need to make sure unnamed module has access to your module. I think that by default in JDK 9 the access is intended so that all modules can read unnamed module, but unnamed module can only read itself (simplified version). Hence you want to break a few rules and force this to work in the opposite direction for your module. Matej ----- Original Message ----- > From: "Alex Sviridov" > To: "weld-dev" > Sent: Monday, September 18, 2017 1:46:36 PM > Subject: Re: [weld-dev] Weld and Java 9 JPMS > > Thank you for your answer. > > Could anyone give any suggestion about the following? > > I have my named module and weld-se-shaded as unnamed module. > In my module I have > > module my.module { > requires weld.se.shaded; > exports com.foo; > } > > ################################# > package com.foo; > > import javax.enterprise.context.ApplicationScoped; > import javax.inject.Inject; > > @ApplicationScoped > public class NewClass { > > @Inject > private NewBean bean; > > public void doIt() { > bean.doIt(); > } > > } > > ################################# > package com.foo; > > import javax.enterprise.context.Dependent; > > @Dependent > public class NewBean { > > public void doIt() { > System.out.println("I am doing it); > } > } > > And this is the result > > Sep 18, 2017 2:33:12 PM org.jboss.weld.bootstrap.WeldStartup > INFO: WELD-000900: 3.0.2 (2017-09-18 08:49) > Sep 18, 2017 2:33:12 PM > org.jboss.weld.environment.deployment.discovery.ReflectionDiscoveryStrategy > processAnnotatedDiscovery > INFO: WELD-ENV-000014: Falling back to Java Reflection for > bean-discovery-mode="annotated" discovery. Add org.jboss:jandex to the > classpath to speed-up startup. > Sep 18, 2017 2:33:12 PM org.jboss.weld.bootstrap.WeldStartup startContainer > INFO: WELD-000101: Transactional services not available. Injection of @Inject > UserTransaction not available. Transactional observers will be invoked > synchronously. > Exception in thread "main" java.lang.reflect.InaccessibleObjectException > at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native > Method) > at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) > at > java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488) > at > java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:590) > at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:996) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions(AbstractExecutorServices.java:72) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:58) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:66) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer.createClassBeans(ConcurrentBeanDeployer.java:65) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:256) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:422) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.environment.se.Weld.initialize(Weld.java:789) > at my.module/com.foo.NewMain.main(NewMain.java:47) > Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make > field private com.foo.NewBean com.foo.NewClass.bean accessible: module > my.module does not "opens com.foo" to module weld.se.shaded > at > java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337) > at > java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281) > at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:176) > at java.base/java.lang.reflect.Field.setAccessible(Field.java:170) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.of(GetAccessibleCopyOfMember.java:38) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.run(GetAccessibleCopyOfMember.java:44) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.run(GetAccessibleCopyOfMember.java:26) > at java.base/java.security.AccessController.doPrivileged(Native Method) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.FieldInjectionPoint.(FieldInjectionPoint.java:65) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.createFieldInjectionPoint(InjectionPointFactory.java:141) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.addFieldInjectionPoint(InjectionPointFactory.java:226) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.getFieldInjectionPoints(InjectionPointFactory.java:211) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.DefaultInjector.(DefaultInjector.java:56) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.ResourceInjector.(ResourceInjector.java:57) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.ResourceInjector.of(ResourceInjector.java:48) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.BeanInjectionTarget.(BeanInjectionTarget.java:63) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.BeanInjectionTarget.createDefault(BeanInjectionTarget.java:47) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.manager.InjectionTargetFactoryImpl.chooseInjectionTarget(InjectionTargetFactoryImpl.java:139) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:88) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.ManagedBean.(ManagedBean.java:100) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.ManagedBean.of(ManagedBean.java:80) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.AbstractBeanDeployer.createManagedBean(AbstractBeanDeployer.java:280) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.BeanDeployer.createClassBean(BeanDeployer.java:221) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:68) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:65) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55) > at > java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1431) > at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:283) > at > java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1603) > at > java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) > > > > > > > > ???????????, 18 ???????? 2017, 14:18 +03:00 ?? Matej Novotny > : > > Hi, > > if you are in SE, you should only need 'weld-se-shaded' artifact (as a JAR). > As it is "shaded", it brings along all the other parts of Weld you might > need. > > Matej > > > ----- Original Message ----- > > From: "Alex Sviridov" < ooo_saturn7 at mail.ru > > > To: "weld-dev" < weld-dev at lists.jboss.org > > > Sent: Monday, September 18, 2017 12:17:28 PM > > Subject: Re: [weld-dev] Weld and Java 9 JPMS > > > > Hi Matej > > > > I am just trying to make Weld work in Java 9 (JavaSE + JPMS). > > > > I use the following jars as automatic modules: > > > > weld-environment-common-3.0.2-SNAPSHOT.jar > > weld-se-core-3.0.2-SNAPSHOT.jar > > weld-se-shaded-3.0.2-SNAPSHOT.jar > > weld-spi-3.0.SP1.jar > > weld-core-impl-3.0.2-SNAPSHOT.jar > > > > Is this right configuration? Or should I add/remove something. > > > > Best regards, Alex > > > > > > > > ???????????, 18 ???????? 2017, 12:41 +03:00 ?? Matej Novotny > > < manovotn at redhat.com >: > > > > Uhm, is there anything blocking you from placing it where you would in Java > > 8? > > E.g. src/main/resources/META-INF? > > > > I don't think I have tried this combination (or I do not recall). > > From the top of my head I don't know any JDK 9 limitation which would > > forbid > > to use XML descriptors in this way. > > I might be a bit rusty though; been a while since I played with Java 9. > > > > Please do report back with how this works for you :) > > Matej > > > > ----- Original Message ----- > > > From: "Alex Sviridov" < ooo_saturn7 at mail.ru > > > > To: "Matej Novotny" < manovotn at redhat.com > > > > Sent: Monday, September 18, 2017 10:28:11 AM > > > Subject: Re[2]: [weld-dev] Weld and Java 9 JPMS > > > > > > Thank you for your answer. I will try. But where should I place beans.xml > > > to make Weld read it if I use Java SE+ JPMS? > > > > > > Best regards, Alex > > > > > > > > > >???????????, 18 ???????? 2017, 8:10 +03:00 ?? Matej Novotny > > > >< manovotn at redhat.com >: > > > > > > > >Hi Alex > > > > > > > >Back there we did some tests with earlier versions of Java 9 and > > > >eliminated > > > >some crucial problems. > > > >I think it should be possible to take *existing* app and run it on Java > > > >9. > > > > > > > >However, creating a whole new modular project might present some > > > >additional > > > >challenges. > > > >Weld itself is not modularized (since it needs to run on Java 8), > > > >therefore > > > >you would need to list some extra "requires" in module-info.java for > > > >Weld. > > > >You also need to have reflection access allowed (we need to instantiate > > > >proxies etc) but last time I checked, it was by default enabled in JDK 9 > > > >wi > > > >th just warning showing up. > > > >Other than that, it might just work. > > > > > > > >To answer your other question - no, there is no tutorial, for there is > > > >no > > > >special difference between Weld and many other projects in regard to JDK > > > >9. > > > > > > > >Matej > > > > > > > >----- Original Message ----- > > > >> From: "Alex Sviridov" < ooo_saturn7 at mail.ru > > > > >> To: "weld-dev" < weld-dev at lists.jboss.org > > > > >> Sent: Sunday, September 17, 2017 3:25:49 PM > > > >> Subject: [weld-dev] Weld and Java 9 JPMS > > > >> > > > >> Hi all > > > >> > > > >> Could anyone provide information how weld works (if works) with Java 9 > > > >> JPMS? > > > >> Is there any tutorial? > > > >> > > > >> Best regards, Alex > > > >> > > > >> _______________________________________________ > > > >> weld-dev mailing list > > > >> weld-dev at lists.jboss.org > > > >> https://lists.jboss.org/mailman/listinfo/weld-dev > > > > > > > > > -- > > > Alex Sviridov > > > > > > > > > -- > > Alex Sviridov > > > > _______________________________________________ > > weld-dev mailing list > > weld-dev at lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/weld-dev > > > -- > Alex Sviridov > > _______________________________________________ > weld-dev mailing list > weld-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/weld-dev From ooo_saturn7 at mail.ru Mon Sep 18 10:29:20 2017 From: ooo_saturn7 at mail.ru (=?UTF-8?B?QWxleCBTdmlyaWRvdg==?=) Date: Mon, 18 Sep 2017 17:29:20 +0300 Subject: [weld-dev] =?utf-8?q?Weld_and_Java_9_JPMS?= In-Reply-To: <515880442.11691741.1505741971242.JavaMail.zimbra@redhat.com> References: <1505654749.975455722@f450.i.mail.ru> <1505735196.734954822@f340.i.mail.ru> <515880442.11691741.1505741971242.JavaMail.zimbra@redhat.com> Message-ID: <1505744960.175746978@f290.i.mail.ru> Yes, the line you highlighted is the most important. However, I don't agree with you about some details. Let's see. 1) Please, take a look at the second table (module overview) here https://labs.consol.de/development/2017/02/13/getting-started-with-java9-modules.html 2) Weld is not unnamed module but automatic module as it is on module path and I use it by name. 3) From that table (module overview) we see that both automatic and unnamed modules can read application modules. If so, then why it doesn't? Any suggestions? >???????????, 18 ???????? 2017, 16:39 +03:00 ?? Matej Novotny : > >From the exception you are getting, this line is important: > >"Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private com.foo.NewBean com.foo.NewClass.bean accessible: module my.module does not "opens com.foo" to module weld.se.shaded" > >Basically, Weld is not modularized (== lands in unnamed module) and it needs access to your module so that it can create beans. E.g. you need to make sure unnamed module has access to your module. >I think that by default in JDK 9 the access is intended so that all modules can read unnamed module, but unnamed module can only read itself (simplified version). >Hence you want to break a few rules and force this to work in the opposite direction for your module. > >Matej > > >----- Original Message ----- >> From: "Alex Sviridov" < ooo_saturn7 at mail.ru > >> To: "weld-dev" < weld-dev at lists.jboss.org > >> Sent: Monday, September 18, 2017 1:46:36 PM >> Subject: Re: [weld-dev] Weld and Java 9 JPMS >> >> Thank you for your answer. >> >> Could anyone give any suggestion about the following? >> >> I have my named module and weld-se-shaded as unnamed module. >> In my module I have >> >> module my.module { >> requires weld.se.shaded; >> exports com.foo; >> } >> >> ################################# >> package com.foo; >> >> import javax.enterprise.context.ApplicationScoped; >> import javax.inject.Inject; >> >> @ApplicationScoped >> public class NewClass { >> >> @Inject >> private NewBean bean; >> >> public void doIt() { >> bean.doIt(); >> } >> >> } >> >> ################################# >> package com.foo; >> >> import javax.enterprise.context.Dependent; >> >> @Dependent >> public class NewBean { >> >> public void doIt() { >> System.out.println("I am doing it); >> } >> } >> >> And this is the result >> >> Sep 18, 2017 2:33:12 PM org.jboss.weld.bootstrap.WeldStartup >> INFO: WELD-000900: 3.0.2 (2017-09-18 08:49) >> Sep 18, 2017 2:33:12 PM >> org.jboss.weld.environment.deployment.discovery.ReflectionDiscoveryStrategy >> processAnnotatedDiscovery >> INFO: WELD-ENV-000014: Falling back to Java Reflection for >> bean-discovery-mode="annotated" discovery. Add org.jboss:jandex to the >> classpath to speed-up startup. >> Sep 18, 2017 2:33:12 PM org.jboss.weld.bootstrap.WeldStartup startContainer >> INFO: WELD-000101: Transactional services not available. Injection of @Inject >> UserTransaction not available. Transactional observers will be invoked >> synchronously. >> Exception in thread "main" java.lang.reflect.InaccessibleObjectException >> at >> java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native >> Method) >> at >> java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) >> at >> java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) >> at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488) >> at >> java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:590) >> at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:996) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions(AbstractExecutorServices.java:72) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:58) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:66) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer.createClassBeans(ConcurrentBeanDeployer.java:65) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:256) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:422) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.environment.se.Weld.initialize(Weld.java:789) >> at my.module/com.foo.NewMain.main(NewMain.java:47) >> Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make >> field private com.foo.NewBean com.foo.NewClass.bean accessible: module >> my.module does not "opens com.foo" to module weld.se.shaded >> at >> java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337) >> at >> java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281) >> at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:176) >> at java.base/java.lang.reflect.Field.setAccessible(Field.java:170) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.of(GetAccessibleCopyOfMember.java:38) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.run(GetAccessibleCopyOfMember.java:44) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.run(GetAccessibleCopyOfMember.java:26) >> at java.base/java.security.AccessController.doPrivileged(Native Method) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.FieldInjectionPoint.(FieldInjectionPoint.java:65) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.createFieldInjectionPoint(InjectionPointFactory.java:141) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.addFieldInjectionPoint(InjectionPointFactory.java:226) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.getFieldInjectionPoints(InjectionPointFactory.java:211) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.DefaultInjector.(DefaultInjector.java:56) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.ResourceInjector.(ResourceInjector.java:57) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.ResourceInjector.of(ResourceInjector.java:48) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.BeanInjectionTarget.(BeanInjectionTarget.java:63) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.BeanInjectionTarget.createDefault(BeanInjectionTarget.java:47) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.manager.InjectionTargetFactoryImpl.chooseInjectionTarget(InjectionTargetFactoryImpl.java:139) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:88) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.ManagedBean.(ManagedBean.java:100) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.ManagedBean.of(ManagedBean.java:80) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.AbstractBeanDeployer.createManagedBean(AbstractBeanDeployer.java:280) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.BeanDeployer.createClassBean(BeanDeployer.java:221) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:68) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:65) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55) >> at >> java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1431) >> at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:283) >> at >> java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1603) >> at >> java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) >> >> >> >> >> >> >> >> ???????????, 18 ???????? 2017, 14:18 +03:00 ?? Matej Novotny >> < manovotn at redhat.com >: >> >> Hi, >> >> if you are in SE, you should only need 'weld-se-shaded' artifact (as a JAR). >> As it is "shaded", it brings along all the other parts of Weld you might >> need. >> >> Matej >> >> >> ----- Original Message ----- >> > From: "Alex Sviridov" < ooo_saturn7 at mail.ru > >> > To: "weld-dev" < weld-dev at lists.jboss.org > >> > Sent: Monday, September 18, 2017 12:17:28 PM >> > Subject: Re: [weld-dev] Weld and Java 9 JPMS >> > >> > Hi Matej >> > >> > I am just trying to make Weld work in Java 9 (JavaSE + JPMS). >> > >> > I use the following jars as automatic modules: >> > >> > weld-environment-common-3.0.2-SNAPSHOT.jar >> > weld-se-core-3.0.2-SNAPSHOT.jar >> > weld-se-shaded-3.0.2-SNAPSHOT.jar >> > weld-spi-3.0.SP1.jar >> > weld-core-impl-3.0.2-SNAPSHOT.jar >> > >> > Is this right configuration? Or should I add/remove something. >> > >> > Best regards, Alex >> > >> > >> > >> > ???????????, 18 ???????? 2017, 12:41 +03:00 ?? Matej Novotny >> > < manovotn at redhat.com >: >> > >> > Uhm, is there anything blocking you from placing it where you would in Java >> > 8? >> > E.g. src/main/resources/META-INF? >> > >> > I don't think I have tried this combination (or I do not recall). >> > From the top of my head I don't know any JDK 9 limitation which would >> > forbid >> > to use XML descriptors in this way. >> > I might be a bit rusty though; been a while since I played with Java 9. >> > >> > Please do report back with how this works for you :) >> > Matej >> > >> > ----- Original Message ----- >> > > From: "Alex Sviridov" < ooo_saturn7 at mail.ru > >> > > To: "Matej Novotny" < manovotn at redhat.com > >> > > Sent: Monday, September 18, 2017 10:28:11 AM >> > > Subject: Re[2]: [weld-dev] Weld and Java 9 JPMS >> > > >> > > Thank you for your answer. I will try. But where should I place beans.xml >> > > to make Weld read it if I use Java SE+ JPMS? >> > > >> > > Best regards, Alex >> > > >> > > >> > > >???????????, 18 ???????? 2017, 8:10 +03:00 ?? Matej Novotny >> > > >< manovotn at redhat.com >: >> > > > >> > > >Hi Alex >> > > > >> > > >Back there we did some tests with earlier versions of Java 9 and >> > > >eliminated >> > > >some crucial problems. >> > > >I think it should be possible to take *existing* app and run it on Java >> > > >9. >> > > > >> > > >However, creating a whole new modular project might present some >> > > >additional >> > > >challenges. >> > > >Weld itself is not modularized (since it needs to run on Java 8), >> > > >therefore >> > > >you would need to list some extra "requires" in module-info.java for >> > > >Weld. >> > > >You also need to have reflection access allowed (we need to instantiate >> > > >proxies etc) but last time I checked, it was by default enabled in JDK 9 >> > > >wi >> > > >th just warning showing up. >> > > >Other than that, it might just work. >> > > > >> > > >To answer your other question - no, there is no tutorial, for there is >> > > >no >> > > >special difference between Weld and many other projects in regard to JDK >> > > >9. >> > > > >> > > >Matej >> > > > >> > > >----- Original Message ----- >> > > >> From: "Alex Sviridov" < ooo_saturn7 at mail.ru > >> > > >> To: "weld-dev" < weld-dev at lists.jboss.org > >> > > >> Sent: Sunday, September 17, 2017 3:25:49 PM >> > > >> Subject: [weld-dev] Weld and Java 9 JPMS >> > > >> >> > > >> Hi all >> > > >> >> > > >> Could anyone provide information how weld works (if works) with Java 9 >> > > >> JPMS? >> > > >> Is there any tutorial? >> > > >> >> > > >> Best regards, Alex >> > > >> >> > > >> _______________________________________________ >> > > >> weld-dev mailing list >> > > >> weld-dev at lists.jboss.org >> > > >> https://lists.jboss.org/mailman/listinfo/weld-dev >> > > >> > > >> > > -- >> > > Alex Sviridov >> > > >> > >> > >> > -- >> > Alex Sviridov >> > >> > _______________________________________________ >> > weld-dev mailing list >> > weld-dev at lists.jboss.org >> > https://lists.jboss.org/mailman/listinfo/weld-dev >> >> >> -- >> Alex Sviridov >> >> _______________________________________________ >> weld-dev mailing list >> weld-dev at lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/weld-dev -- Alex Sviridov -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20170918/34ff0ccc/attachment-0001.html From ooo_saturn7 at mail.ru Mon Sep 18 11:23:30 2017 From: ooo_saturn7 at mail.ru (=?UTF-8?B?QWxleCBTdmlyaWRvdg==?=) Date: Mon, 18 Sep 2017 18:23:30 +0300 Subject: [weld-dev] =?utf-8?q?Weld_and_Java_9_JPMS?= In-Reply-To: <515880442.11691741.1505741971242.JavaMail.zimbra@redhat.com> References: <1505654749.975455722@f450.i.mail.ru> <1505735196.734954822@f340.i.mail.ru> <515880442.11691741.1505741971242.JavaMail.zimbra@redhat.com> Message-ID: <1505748210.417179485@f351.i.mail.ru> So, here I am. I changed my.module from my.module { ? requires weld.se.shaded; ? exports com.foo; ? } to my.module { ? requires weld.se.shaded; ? opens com.foo; ? } And got the following (see below). It seems that Weld can't now work with JPMS. What will Weld developers say? Exception in thread "main" org.jboss.weld.exceptions.WeldException: WELD-001524: Unable to load proxy class for bean Implicit Bean [javax.enterprise.event.Event] with qualifiers [@Default] with class interface javax.enterprise.event.Event using classloader jdk.internal.loader.ClassLoaders$AppClassLoader at 6b2fad11 ?? ?at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ?? ?at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ?? ?at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ?? ?at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488) ?? ?at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:587) ?? ?at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:996) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions(AbstractExecutorServices.java:72) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:58) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:66) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer.doAfterBeanDiscovery(ConcurrentBeanDeployer.java:88) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.BeanDeployment.afterBeanDiscovery(BeanDeployment.java:268) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:466) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.environment.se.Weld.initialize(Weld.java:789) ?? ?at my.module/com.foo.NewMain.main(NewMain.java:47) Caused by: org.jboss.weld.exceptions.WeldException: WELD-001524: Unable to load proxy class for bean Implicit Bean [javax.enterprise.event.Event] with qualifiers [@Default] with class interface javax.enterprise.event.Event using classloader jdk.internal.loader.ClassLoaders$AppClassLoader at 6b2fad11 ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:389) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.builtin.AbstractFacadeBean.initializeAfterBeanDiscovery(AbstractFacadeBean.java:61) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:111) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:102) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55) ?? ?at java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1431) ?? ?at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:283) ?? ?at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1603) ?? ?at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) Caused by: java.lang.ExceptionInInitializerError ?? ?at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ?? ?at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ?? ?at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ?? ?at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.proxy.ProxyFactory.newClassFile(ProxyFactory.java:496) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:455) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:381) ?? ?... 9 more Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to module weld.se.shaded ?? ?at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337) ?? ?at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281) ?? ?at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:198) ?? ?at java.base/java.lang.reflect.Method.setAccessible(Method.java:192) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.classfilewriter.ClassFile$1.run(ClassFile.java:256) ?? ?at java.base/java.security.AccessController.doPrivileged(Native Method) ?? ?at weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.classfilewriter.ClassFile.(ClassFile.java:251) ?? ?... 16 more >???????????, 18 ???????? 2017, 16:39 +03:00 ?? Matej Novotny : > >From the exception you are getting, this line is important: > >"Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private com.foo.NewBean com.foo.NewClass.bean accessible: module my.module does not "opens com.foo" to module weld.se.shaded" > >Basically, Weld is not modularized (== lands in unnamed module) and it needs access to your module so that it can create beans. E.g. you need to make sure unnamed module has access to your module. >I think that by default in JDK 9 the access is intended so that all modules can read unnamed module, but unnamed module can only read itself (simplified version). >Hence you want to break a few rules and force this to work in the opposite direction for your module. > >Matej > > >----- Original Message ----- >> From: "Alex Sviridov" < ooo_saturn7 at mail.ru > >> To: "weld-dev" < weld-dev at lists.jboss.org > >> Sent: Monday, September 18, 2017 1:46:36 PM >> Subject: Re: [weld-dev] Weld and Java 9 JPMS >> >> Thank you for your answer. >> >> Could anyone give any suggestion about the following? >> >> I have my named module and weld-se-shaded as unnamed module. >> In my module I have >> >> module my.module { >> requires weld.se.shaded; >> exports com.foo; >> } >> >> ################################# >> package com.foo; >> >> import javax.enterprise.context.ApplicationScoped; >> import javax.inject.Inject; >> >> @ApplicationScoped >> public class NewClass { >> >> @Inject >> private NewBean bean; >> >> public void doIt() { >> bean.doIt(); >> } >> >> } >> >> ################################# >> package com.foo; >> >> import javax.enterprise.context.Dependent; >> >> @Dependent >> public class NewBean { >> >> public void doIt() { >> System.out.println("I am doing it); >> } >> } >> >> And this is the result >> >> Sep 18, 2017 2:33:12 PM org.jboss.weld.bootstrap.WeldStartup >> INFO: WELD-000900: 3.0.2 (2017-09-18 08:49) >> Sep 18, 2017 2:33:12 PM >> org.jboss.weld.environment.deployment.discovery.ReflectionDiscoveryStrategy >> processAnnotatedDiscovery >> INFO: WELD-ENV-000014: Falling back to Java Reflection for >> bean-discovery-mode="annotated" discovery. Add org.jboss:jandex to the >> classpath to speed-up startup. >> Sep 18, 2017 2:33:12 PM org.jboss.weld.bootstrap.WeldStartup startContainer >> INFO: WELD-000101: Transactional services not available. Injection of @Inject >> UserTransaction not available. Transactional observers will be invoked >> synchronously. >> Exception in thread "main" java.lang.reflect.InaccessibleObjectException >> at >> java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native >> Method) >> at >> java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) >> at >> java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) >> at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488) >> at >> java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:590) >> at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:996) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions(AbstractExecutorServices.java:72) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:58) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:66) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer.createClassBeans(ConcurrentBeanDeployer.java:65) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:256) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:422) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.environment.se.Weld.initialize(Weld.java:789) >> at my.module/com.foo.NewMain.main(NewMain.java:47) >> Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make >> field private com.foo.NewBean com.foo.NewClass.bean accessible: module >> my.module does not "opens com.foo" to module weld.se.shaded >> at >> java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337) >> at >> java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281) >> at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:176) >> at java.base/java.lang.reflect.Field.setAccessible(Field.java:170) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.of(GetAccessibleCopyOfMember.java:38) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.run(GetAccessibleCopyOfMember.java:44) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.run(GetAccessibleCopyOfMember.java:26) >> at java.base/java.security.AccessController.doPrivileged(Native Method) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.FieldInjectionPoint.(FieldInjectionPoint.java:65) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.createFieldInjectionPoint(InjectionPointFactory.java:141) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.addFieldInjectionPoint(InjectionPointFactory.java:226) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.getFieldInjectionPoints(InjectionPointFactory.java:211) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.DefaultInjector.(DefaultInjector.java:56) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.ResourceInjector.(ResourceInjector.java:57) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.ResourceInjector.of(ResourceInjector.java:48) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.BeanInjectionTarget.(BeanInjectionTarget.java:63) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.BeanInjectionTarget.createDefault(BeanInjectionTarget.java:47) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.manager.InjectionTargetFactoryImpl.chooseInjectionTarget(InjectionTargetFactoryImpl.java:139) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:88) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.ManagedBean.(ManagedBean.java:100) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.ManagedBean.of(ManagedBean.java:80) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.AbstractBeanDeployer.createManagedBean(AbstractBeanDeployer.java:280) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.BeanDeployer.createClassBean(BeanDeployer.java:221) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:68) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:65) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55) >> at >> java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1431) >> at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:283) >> at >> java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1603) >> at >> java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) >> >> >> >> >> >> >> >> ???????????, 18 ???????? 2017, 14:18 +03:00 ?? Matej Novotny >> < manovotn at redhat.com >: >> >> Hi, >> >> if you are in SE, you should only need 'weld-se-shaded' artifact (as a JAR). >> As it is "shaded", it brings along all the other parts of Weld you might >> need. >> >> Matej >> >> >> ----- Original Message ----- >> > From: "Alex Sviridov" < ooo_saturn7 at mail.ru > >> > To: "weld-dev" < weld-dev at lists.jboss.org > >> > Sent: Monday, September 18, 2017 12:17:28 PM >> > Subject: Re: [weld-dev] Weld and Java 9 JPMS >> > >> > Hi Matej >> > >> > I am just trying to make Weld work in Java 9 (JavaSE + JPMS). >> > >> > I use the following jars as automatic modules: >> > >> > weld-environment-common-3.0.2-SNAPSHOT.jar >> > weld-se-core-3.0.2-SNAPSHOT.jar >> > weld-se-shaded-3.0.2-SNAPSHOT.jar >> > weld-spi-3.0.SP1.jar >> > weld-core-impl-3.0.2-SNAPSHOT.jar >> > >> > Is this right configuration? Or should I add/remove something. >> > >> > Best regards, Alex >> > >> > >> > >> > ???????????, 18 ???????? 2017, 12:41 +03:00 ?? Matej Novotny >> > < manovotn at redhat.com >: >> > >> > Uhm, is there anything blocking you from placing it where you would in Java >> > 8? >> > E.g. src/main/resources/META-INF? >> > >> > I don't think I have tried this combination (or I do not recall). >> > From the top of my head I don't know any JDK 9 limitation which would >> > forbid >> > to use XML descriptors in this way. >> > I might be a bit rusty though; been a while since I played with Java 9. >> > >> > Please do report back with how this works for you :) >> > Matej >> > >> > ----- Original Message ----- >> > > From: "Alex Sviridov" < ooo_saturn7 at mail.ru > >> > > To: "Matej Novotny" < manovotn at redhat.com > >> > > Sent: Monday, September 18, 2017 10:28:11 AM >> > > Subject: Re[2]: [weld-dev] Weld and Java 9 JPMS >> > > >> > > Thank you for your answer. I will try. But where should I place beans.xml >> > > to make Weld read it if I use Java SE+ JPMS? >> > > >> > > Best regards, Alex >> > > >> > > >> > > >???????????, 18 ???????? 2017, 8:10 +03:00 ?? Matej Novotny >> > > >< manovotn at redhat.com >: >> > > > >> > > >Hi Alex >> > > > >> > > >Back there we did some tests with earlier versions of Java 9 and >> > > >eliminated >> > > >some crucial problems. >> > > >I think it should be possible to take *existing* app and run it on Java >> > > >9. >> > > > >> > > >However, creating a whole new modular project might present some >> > > >additional >> > > >challenges. >> > > >Weld itself is not modularized (since it needs to run on Java 8), >> > > >therefore >> > > >you would need to list some extra "requires" in module-info.java for >> > > >Weld. >> > > >You also need to have reflection access allowed (we need to instantiate >> > > >proxies etc) but last time I checked, it was by default enabled in JDK 9 >> > > >wi >> > > >th just warning showing up. >> > > >Other than that, it might just work. >> > > > >> > > >To answer your other question - no, there is no tutorial, for there is >> > > >no >> > > >special difference between Weld and many other projects in regard to JDK >> > > >9. >> > > > >> > > >Matej >> > > > >> > > >----- Original Message ----- >> > > >> From: "Alex Sviridov" < ooo_saturn7 at mail.ru > >> > > >> To: "weld-dev" < weld-dev at lists.jboss.org > >> > > >> Sent: Sunday, September 17, 2017 3:25:49 PM >> > > >> Subject: [weld-dev] Weld and Java 9 JPMS >> > > >> >> > > >> Hi all >> > > >> >> > > >> Could anyone provide information how weld works (if works) with Java 9 >> > > >> JPMS? >> > > >> Is there any tutorial? >> > > >> >> > > >> Best regards, Alex >> > > >> >> > > >> _______________________________________________ >> > > >> weld-dev mailing list >> > > >> weld-dev at lists.jboss.org >> > > >> https://lists.jboss.org/mailman/listinfo/weld-dev >> > > >> > > >> > > -- >> > > Alex Sviridov >> > > >> > >> > >> > -- >> > Alex Sviridov >> > >> > _______________________________________________ >> > weld-dev mailing list >> > weld-dev at lists.jboss.org >> > https://lists.jboss.org/mailman/listinfo/weld-dev >> >> >> -- >> Alex Sviridov >> >> _______________________________________________ >> weld-dev mailing list >> weld-dev at lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/weld-dev -- Alex Sviridov -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20170918/62fdb699/attachment-0001.html From manovotn at redhat.com Tue Sep 19 03:22:31 2017 From: manovotn at redhat.com (Matej Novotny) Date: Tue, 19 Sep 2017 03:22:31 -0400 (EDT) Subject: [weld-dev] Weld and Java 9 JPMS In-Reply-To: <1505748210.417179485@f351.i.mail.ru> References: <1505654749.975455722@f450.i.mail.ru> <1505735196.734954822@f340.i.mail.ru> <515880442.11691741.1505741971242.JavaMail.zimbra@redhat.com> <1505748210.417179485@f351.i.mail.ru> Message-ID: <1471740307.11875173.1505805751286.JavaMail.zimbra@redhat.com> > 1) Please, take a look at the second table (module overview) here > https://labs.consol.de/development/2017/02/13/getting-started-with-java9-modules.html Did that, the article looks like there is finally some solid material on modules. > 2) Weld is not unnamed module but automatic module as it is on module path > and I use it by name. Yea, you are right, my bad. I meant automatic module OFC. > 3) From that table (module overview) we see that both automatic and unnamed > modules can read application modules. If so, then why it doesn't? I suppose you already got your answer on StackOverflow[1], right? To add on top of that, if you `exports` package - you only expose public things in there. For Weld to create proxies of your beans, we need to go deeper and allow reflections access which may mean accessing private/protected stuff (such as your @Inject private NewBean bean). Java 9 doesn't like that and requires you to `opens` the package for this kind of work. > And got the following (see below). It seems that Weld can't now work with > JPMS. > What will Weld developers say? >From the SO question I guess you got it working in the end. If you have any other questions, feel free to contact us again. I'll try to test some JDK 9 project myself to refresh my memory so that I can be of more help next time :) Matej _________________________________________________________________________- [1] https://stackoverflow.com/questions/46282509 ----- Original Message ----- > From: "Alex Sviridov" > To: "weld-dev" > Sent: Monday, September 18, 2017 5:23:30 PM > Subject: Re: [weld-dev] Weld and Java 9 JPMS > > So, here I am. > I changed my.module from > my.module { > requires weld.se.shaded; > exports com.foo; > } > to > my.module { > requires weld.se.shaded; > opens com.foo; > } > > And got the following (see below). It seems that Weld can't now work with > JPMS. > What will Weld developers say? > > Exception in thread "main" org.jboss.weld.exceptions.WeldException: > WELD-001524: Unable to load proxy class for bean Implicit Bean > [javax.enterprise.event.Event] with qualifiers [@Default] with class > interface javax.enterprise.event.Event using classloader > jdk.internal.loader.ClassLoaders$AppClassLoader at 6b2fad11 > at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native > Method) > at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) > at > java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488) > at > java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:587) > at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:996) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions(AbstractExecutorServices.java:72) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:58) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:66) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer.doAfterBeanDiscovery(ConcurrentBeanDeployer.java:88) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.BeanDeployment.afterBeanDiscovery(BeanDeployment.java:268) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:466) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.environment.se.Weld.initialize(Weld.java:789) > at my.module/com.foo.NewMain.main(NewMain.java:47) > Caused by: org.jboss.weld.exceptions.WeldException: WELD-001524: Unable to > load proxy class for bean Implicit Bean [javax.enterprise.event.Event] with > qualifiers [@Default] with class interface javax.enterprise.event.Event > using classloader jdk.internal.loader.ClassLoaders$AppClassLoader at 6b2fad11 > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:389) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.builtin.AbstractFacadeBean.initializeAfterBeanDiscovery(AbstractFacadeBean.java:61) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:111) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:102) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55) > at > java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1431) > at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:283) > at > java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1603) > at > java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) > Caused by: java.lang.ExceptionInInitializerError > at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native > Method) > at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) > at > java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.proxy.ProxyFactory.newClassFile(ProxyFactory.java:496) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:455) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:381) > ... 9 more > Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make > protected final java.lang.Class > java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int) throws > java.lang.ClassFormatError accessible: module java.base does not "opens > java.lang" to module weld.se.shaded > at > java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337) > at > java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281) > at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:198) > at java.base/java.lang.reflect.Method.setAccessible(Method.java:192) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.classfilewriter.ClassFile$1.run(ClassFile.java:256) > at java.base/java.security.AccessController.doPrivileged(Native Method) > at > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.classfilewriter.ClassFile.(ClassFile.java:251) > ... 16 more > > > > > > > ???????????, 18 ???????? 2017, 16:39 +03:00 ?? Matej Novotny > : > > From the exception you are getting, this line is important: > > "Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make > field private com.foo.NewBean com.foo.NewClass.bean accessible: module > my.module does not "opens com.foo" to module weld.se.shaded" > > Basically, Weld is not modularized (== lands in unnamed module) and it needs > access to your module so that it can create beans. E.g. you need to make > sure unnamed module has access to your module. > I think that by default in JDK 9 the access is intended so that all modules > can read unnamed module, but unnamed module can only read itself (simplified > version). > Hence you want to break a few rules and force this to work in the opposite > direction for your module. > > Matej > > > ----- Original Message ----- > > From: "Alex Sviridov" < ooo_saturn7 at mail.ru > > > To: "weld-dev" < weld-dev at lists.jboss.org > > > Sent: Monday, September 18, 2017 1:46:36 PM > > Subject: Re: [weld-dev] Weld and Java 9 JPMS > > > > Thank you for your answer. > > > > Could anyone give any suggestion about the following? > > > > I have my named module and weld-se-shaded as unnamed module. > > In my module I have > > > > module my.module { > > requires weld.se.shaded; > > exports com.foo; > > } > > > > ################################# > > package com.foo; > > > > import javax.enterprise.context.ApplicationScoped; > > import javax.inject.Inject; > > > > @ApplicationScoped > > public class NewClass { > > > > @Inject > > private NewBean bean; > > > > public void doIt() { > > bean.doIt(); > > } > > > > } > > > > ################################# > > package com.foo; > > > > import javax.enterprise.context.Dependent; > > > > @Dependent > > public class NewBean { > > > > public void doIt() { > > System.out.println("I am doing it); > > } > > } > > > > And this is the result > > > > Sep 18, 2017 2:33:12 PM org.jboss.weld.bootstrap.WeldStartup > > INFO: WELD-000900: 3.0.2 (2017-09-18 08:49) > > Sep 18, 2017 2:33:12 PM > > org.jboss.weld.environment.deployment.discovery.ReflectionDiscoveryStrategy > > processAnnotatedDiscovery > > INFO: WELD-ENV-000014: Falling back to Java Reflection for > > bean-discovery-mode="annotated" discovery. Add org.jboss:jandex to the > > classpath to speed-up startup. > > Sep 18, 2017 2:33:12 PM org.jboss.weld.bootstrap.WeldStartup startContainer > > INFO: WELD-000101: Transactional services not available. Injection of > > @Inject > > UserTransaction not available. Transactional observers will be invoked > > synchronously. > > Exception in thread "main" java.lang.reflect.InaccessibleObjectException > > at > > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native > > Method) > > at > > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) > > at > > java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > > at > > java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488) > > at > > java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:590) > > at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:996) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions(AbstractExecutorServices.java:72) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:58) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:66) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer.createClassBeans(ConcurrentBeanDeployer.java:65) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:256) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:422) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.environment.se.Weld.initialize(Weld.java:789) > > at my.module/com.foo.NewMain.main(NewMain.java:47) > > Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make > > field private com.foo.NewBean com.foo.NewClass.bean accessible: module > > my.module does not "opens com.foo" to module weld.se.shaded > > at > > java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337) > > at > > java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281) > > at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:176) > > at java.base/java.lang.reflect.Field.setAccessible(Field.java:170) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.of(GetAccessibleCopyOfMember.java:38) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.run(GetAccessibleCopyOfMember.java:44) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.run(GetAccessibleCopyOfMember.java:26) > > at java.base/java.security.AccessController.doPrivileged(Native Method) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.FieldInjectionPoint.(FieldInjectionPoint.java:65) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.createFieldInjectionPoint(InjectionPointFactory.java:141) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.addFieldInjectionPoint(InjectionPointFactory.java:226) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.getFieldInjectionPoints(InjectionPointFactory.java:211) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.DefaultInjector.(DefaultInjector.java:56) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.ResourceInjector.(ResourceInjector.java:57) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.ResourceInjector.of(ResourceInjector.java:48) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.BeanInjectionTarget.(BeanInjectionTarget.java:63) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.BeanInjectionTarget.createDefault(BeanInjectionTarget.java:47) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.manager.InjectionTargetFactoryImpl.chooseInjectionTarget(InjectionTargetFactoryImpl.java:139) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:88) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.ManagedBean.(ManagedBean.java:100) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.ManagedBean.of(ManagedBean.java:80) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.AbstractBeanDeployer.createManagedBean(AbstractBeanDeployer.java:280) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.BeanDeployer.createClassBean(BeanDeployer.java:221) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:68) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:65) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55) > > at > > java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1431) > > at > > java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:283) > > at > > java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1603) > > at > > java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) > > > > > > > > > > > > > > > > ???????????, 18 ???????? 2017, 14:18 +03:00 ?? Matej Novotny > > < manovotn at redhat.com >: > > > > Hi, > > > > if you are in SE, you should only need 'weld-se-shaded' artifact (as a > > JAR). > > As it is "shaded", it brings along all the other parts of Weld you might > > need. > > > > Matej > > > > > > ----- Original Message ----- > > > From: "Alex Sviridov" < ooo_saturn7 at mail.ru > > > > To: "weld-dev" < weld-dev at lists.jboss.org > > > > Sent: Monday, September 18, 2017 12:17:28 PM > > > Subject: Re: [weld-dev] Weld and Java 9 JPMS > > > > > > Hi Matej > > > > > > I am just trying to make Weld work in Java 9 (JavaSE + JPMS). > > > > > > I use the following jars as automatic modules: > > > > > > weld-environment-common-3.0.2-SNAPSHOT.jar > > > weld-se-core-3.0.2-SNAPSHOT.jar > > > weld-se-shaded-3.0.2-SNAPSHOT.jar > > > weld-spi-3.0.SP1.jar > > > weld-core-impl-3.0.2-SNAPSHOT.jar > > > > > > Is this right configuration? Or should I add/remove something. > > > > > > Best regards, Alex > > > > > > > > > > > > ???????????, 18 ???????? 2017, 12:41 +03:00 ?? Matej Novotny > > > < manovotn at redhat.com >: > > > > > > Uhm, is there anything blocking you from placing it where you would in > > > Java > > > 8? > > > E.g. src/main/resources/META-INF? > > > > > > I don't think I have tried this combination (or I do not recall). > > > From the top of my head I don't know any JDK 9 limitation which would > > > forbid > > > to use XML descriptors in this way. > > > I might be a bit rusty though; been a while since I played with Java 9. > > > > > > Please do report back with how this works for you :) > > > Matej > > > > > > ----- Original Message ----- > > > > From: "Alex Sviridov" < ooo_saturn7 at mail.ru > > > > > To: "Matej Novotny" < manovotn at redhat.com > > > > > Sent: Monday, September 18, 2017 10:28:11 AM > > > > Subject: Re[2]: [weld-dev] Weld and Java 9 JPMS > > > > > > > > Thank you for your answer. I will try. But where should I place > > > > beans.xml > > > > to make Weld read it if I use Java SE+ JPMS? > > > > > > > > Best regards, Alex > > > > > > > > > > > > >???????????, 18 ???????? 2017, 8:10 +03:00 ?? Matej Novotny > > > > >< manovotn at redhat.com >: > > > > > > > > > >Hi Alex > > > > > > > > > >Back there we did some tests with earlier versions of Java 9 and > > > > >eliminated > > > > >some crucial problems. > > > > >I think it should be possible to take *existing* app and run it on > > > > >Java > > > > >9. > > > > > > > > > >However, creating a whole new modular project might present some > > > > >additional > > > > >challenges. > > > > >Weld itself is not modularized (since it needs to run on Java 8), > > > > >therefore > > > > >you would need to list some extra "requires" in module-info.java for > > > > >Weld. > > > > >You also need to have reflection access allowed (we need to > > > > >instantiate > > > > >proxies etc) but last time I checked, it was by default enabled in JDK > > > > >9 > > > > >wi > > > > >th just warning showing up. > > > > >Other than that, it might just work. > > > > > > > > > >To answer your other question - no, there is no tutorial, for there is > > > > >no > > > > >special difference between Weld and many other projects in regard to > > > > >JDK > > > > >9. > > > > > > > > > >Matej > > > > > > > > > >----- Original Message ----- > > > > >> From: "Alex Sviridov" < ooo_saturn7 at mail.ru > > > > > >> To: "weld-dev" < weld-dev at lists.jboss.org > > > > > >> Sent: Sunday, September 17, 2017 3:25:49 PM > > > > >> Subject: [weld-dev] Weld and Java 9 JPMS > > > > >> > > > > >> Hi all > > > > >> > > > > >> Could anyone provide information how weld works (if works) with Java > > > > >> 9 > > > > >> JPMS? > > > > >> Is there any tutorial? > > > > >> > > > > >> Best regards, Alex > > > > >> > > > > >> _______________________________________________ > > > > >> weld-dev mailing list > > > > >> weld-dev at lists.jboss.org > > > > >> https://lists.jboss.org/mailman/listinfo/weld-dev > > > > > > > > > > > > -- > > > > Alex Sviridov > > > > > > > > > > > > > -- > > > Alex Sviridov > > > > > > _______________________________________________ > > > weld-dev mailing list > > > weld-dev at lists.jboss.org > > > https://lists.jboss.org/mailman/listinfo/weld-dev > > > > > > -- > > Alex Sviridov > > > > _______________________________________________ > > weld-dev mailing list > > weld-dev at lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/weld-dev > > > -- > Alex Sviridov > > _______________________________________________ > weld-dev mailing list > weld-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/weld-dev From ooo_saturn7 at mail.ru Tue Sep 19 04:45:03 2017 From: ooo_saturn7 at mail.ru (=?UTF-8?B?QWxleCBTdmlyaWRvdg==?=) Date: Tue, 19 Sep 2017 11:45:03 +0300 Subject: [weld-dev] =?utf-8?q?Weld_and_Java_9_JPMS?= In-Reply-To: <1471740307.11875173.1505805751286.JavaMail.zimbra@redhat.com> References: <1505654749.975455722@f450.i.mail.ru> <1505748210.417179485@f351.i.mail.ru> <1471740307.11875173.1505805751286.JavaMail.zimbra@redhat.com> Message-ID: <1505810703.152762527@f59.i.mail.ru> Hi Matej Thank you for your answer, but I couldn't make it work. I opened my package, but Weld (see my previous message at the end), as I understand, wants to get access to hidden fields and methods of classes in java.base module and JPMS doesn't allow it. So, I gave up - as I don't know what to do else. If you can make it work, please, report. It would be very interesting. Best regards, Alex >???????, 19 ???????? 2017, 10:22 +03:00 ?? Matej Novotny : > >> 1) Please, take a look at the second table (module overview) here >> https://labs.consol.de/development/2017/02/13/getting-started-with-java9-modules.html > >Did that, the article looks like there is finally some solid material on modules. > >> 2) Weld is not unnamed module but automatic module as it is on module path >> and I use it by name. > >Yea, you are right, my bad. I meant automatic module OFC. > >> 3) From that table (module overview) we see that both automatic and unnamed >> modules can read application modules. If so, then why it doesn't? > >I suppose you already got your answer on StackOverflow[1], right? >To add on top of that, if you `exports` package - you only expose public things in there. >For Weld to create proxies of your beans, we need to go deeper and allow reflections access which may mean accessing private/protected stuff (such as your @Inject private NewBean bean). >Java 9 doesn't like that and requires you to `opens` the package for this kind of work. > >> And got the following (see below). It seems that Weld can't now work with >> JPMS. >> What will Weld developers say? > >From the SO question I guess you got it working in the end. >If you have any other questions, feel free to contact us again. >I'll try to test some JDK 9 project myself to refresh my memory so that I can be of more help next time :) > >Matej > >_________________________________________________________________________- >[1] https://stackoverflow.com/questions/46282509 > >----- Original Message ----- >> From: "Alex Sviridov" < ooo_saturn7 at mail.ru > >> To: "weld-dev" < weld-dev at lists.jboss.org > >> Sent: Monday, September 18, 2017 5:23:30 PM >> Subject: Re: [weld-dev] Weld and Java 9 JPMS >> >> So, here I am. >> I changed my.module from >> my.module { >> requires weld.se.shaded; >> exports com.foo; >> } >> to >> my.module { >> requires weld.se.shaded; >> opens com.foo; >> } >> >> And got the following (see below). It seems that Weld can't now work with >> JPMS. >> What will Weld developers say? >> >> Exception in thread "main" org.jboss.weld.exceptions.WeldException: >> WELD-001524: Unable to load proxy class for bean Implicit Bean >> [javax.enterprise.event.Event] with qualifiers [@Default] with class >> interface javax.enterprise.event.Event using classloader >> jdk.internal.loader.ClassLoaders$AppClassLoader at 6b2fad11 >> at >> java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native >> Method) >> at >> java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) >> at >> java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) >> at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488) >> at >> java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:587) >> at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:996) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions(AbstractExecutorServices.java:72) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:58) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:66) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer.doAfterBeanDiscovery(ConcurrentBeanDeployer.java:88) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.BeanDeployment.afterBeanDiscovery(BeanDeployment.java:268) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:466) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.environment.se.Weld.initialize(Weld.java:789) >> at my.module/com.foo.NewMain.main(NewMain.java:47) >> Caused by: org.jboss.weld.exceptions.WeldException: WELD-001524: Unable to >> load proxy class for bean Implicit Bean [javax.enterprise.event.Event] with >> qualifiers [@Default] with class interface javax.enterprise.event.Event >> using classloader jdk.internal.loader.ClassLoaders$AppClassLoader at 6b2fad11 >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:389) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.builtin.AbstractFacadeBean.initializeAfterBeanDiscovery(AbstractFacadeBean.java:61) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:111) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:102) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55) >> at >> java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1431) >> at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:283) >> at >> java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1603) >> at >> java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) >> Caused by: java.lang.ExceptionInInitializerError >> at >> java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native >> Method) >> at >> java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) >> at >> java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) >> at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.proxy.ProxyFactory.newClassFile(ProxyFactory.java:496) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:455) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:381) >> ... 9 more >> Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make >> protected final java.lang.Class >> java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int) throws >> java.lang.ClassFormatError accessible: module java.base does not "opens >> java.lang" to module weld.se.shaded >> at >> java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337) >> at >> java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281) >> at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:198) >> at java.base/java.lang.reflect.Method.setAccessible(Method.java:192) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.classfilewriter.ClassFile$1.run(ClassFile.java:256) >> at java.base/java.security.AccessController.doPrivileged(Native Method) >> at >> weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.classfilewriter.ClassFile.(ClassFile.java:251) >> ... 16 more >> >> >> >> >> >> >> ???????????, 18 ???????? 2017, 16:39 +03:00 ?? Matej Novotny >> < manovotn at redhat.com >: >> >> From the exception you are getting, this line is important: >> >> "Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make >> field private com.foo.NewBean com.foo.NewClass.bean accessible: module >> my.module does not "opens com.foo" to module weld.se.shaded" >> >> Basically, Weld is not modularized (== lands in unnamed module) and it needs >> access to your module so that it can create beans. E.g. you need to make >> sure unnamed module has access to your module. >> I think that by default in JDK 9 the access is intended so that all modules >> can read unnamed module, but unnamed module can only read itself (simplified >> version). >> Hence you want to break a few rules and force this to work in the opposite >> direction for your module. >> >> Matej >> >> >> ----- Original Message ----- >> > From: "Alex Sviridov" < ooo_saturn7 at mail.ru > >> > To: "weld-dev" < weld-dev at lists.jboss.org > >> > Sent: Monday, September 18, 2017 1:46:36 PM >> > Subject: Re: [weld-dev] Weld and Java 9 JPMS >> > >> > Thank you for your answer. >> > >> > Could anyone give any suggestion about the following? >> > >> > I have my named module and weld-se-shaded as unnamed module. >> > In my module I have >> > >> > module my.module { >> > requires weld.se.shaded; >> > exports com.foo; >> > } >> > >> > ################################# >> > package com.foo; >> > >> > import javax.enterprise.context.ApplicationScoped; >> > import javax.inject.Inject; >> > >> > @ApplicationScoped >> > public class NewClass { >> > >> > @Inject >> > private NewBean bean; >> > >> > public void doIt() { >> > bean.doIt(); >> > } >> > >> > } >> > >> > ################################# >> > package com.foo; >> > >> > import javax.enterprise.context.Dependent; >> > >> > @Dependent >> > public class NewBean { >> > >> > public void doIt() { >> > System.out.println("I am doing it); >> > } >> > } >> > >> > And this is the result >> > >> > Sep 18, 2017 2:33:12 PM org.jboss.weld.bootstrap.WeldStartup >> > INFO: WELD-000900: 3.0.2 (2017-09-18 08:49) >> > Sep 18, 2017 2:33:12 PM >> > org.jboss.weld.environment.deployment.discovery.ReflectionDiscoveryStrategy >> > processAnnotatedDiscovery >> > INFO: WELD-ENV-000014: Falling back to Java Reflection for >> > bean-discovery-mode="annotated" discovery. Add org.jboss:jandex to the >> > classpath to speed-up startup. >> > Sep 18, 2017 2:33:12 PM org.jboss.weld.bootstrap.WeldStartup startContainer >> > INFO: WELD-000101: Transactional services not available. Injection of >> > @Inject >> > UserTransaction not available. Transactional observers will be invoked >> > synchronously. >> > Exception in thread "main" java.lang.reflect.InaccessibleObjectException >> > at >> > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native >> > Method) >> > at >> > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) >> > at >> > java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) >> > at >> > java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488) >> > at >> > java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:590) >> > at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:996) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions(AbstractExecutorServices.java:72) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:58) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:66) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer.createClassBeans(ConcurrentBeanDeployer.java:65) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:256) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:422) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.environment.se.Weld.initialize(Weld.java:789) >> > at my.module/com.foo.NewMain.main(NewMain.java:47) >> > Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make >> > field private com.foo.NewBean com.foo.NewClass.bean accessible: module >> > my.module does not "opens com.foo" to module weld.se.shaded >> > at >> > java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337) >> > at >> > java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281) >> > at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:176) >> > at java.base/java.lang.reflect.Field.setAccessible(Field.java:170) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.of(GetAccessibleCopyOfMember.java:38) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.run(GetAccessibleCopyOfMember.java:44) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.run(GetAccessibleCopyOfMember.java:26) >> > at java.base/java.security.AccessController.doPrivileged(Native Method) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.FieldInjectionPoint.(FieldInjectionPoint.java:65) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.createFieldInjectionPoint(InjectionPointFactory.java:141) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.addFieldInjectionPoint(InjectionPointFactory.java:226) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.getFieldInjectionPoints(InjectionPointFactory.java:211) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.DefaultInjector.(DefaultInjector.java:56) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.ResourceInjector.(ResourceInjector.java:57) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.ResourceInjector.of(ResourceInjector.java:48) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.BeanInjectionTarget.(BeanInjectionTarget.java:63) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.BeanInjectionTarget.createDefault(BeanInjectionTarget.java:47) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.manager.InjectionTargetFactoryImpl.chooseInjectionTarget(InjectionTargetFactoryImpl.java:139) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:88) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.ManagedBean.(ManagedBean.java:100) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.ManagedBean.of(ManagedBean.java:80) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.AbstractBeanDeployer.createManagedBean(AbstractBeanDeployer.java:280) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.BeanDeployer.createClassBean(BeanDeployer.java:221) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:68) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:65) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62) >> > at >> > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55) >> > at >> > java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1431) >> > at >> > java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:283) >> > at >> > java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1603) >> > at >> > java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) >> > >> > >> > >> > >> > >> > >> > >> > ???????????, 18 ???????? 2017, 14:18 +03:00 ?? Matej Novotny >> > < manovotn at redhat.com >: >> > >> > Hi, >> > >> > if you are in SE, you should only need 'weld-se-shaded' artifact (as a >> > JAR). >> > As it is "shaded", it brings along all the other parts of Weld you might >> > need. >> > >> > Matej >> > >> > >> > ----- Original Message ----- >> > > From: "Alex Sviridov" < ooo_saturn7 at mail.ru > >> > > To: "weld-dev" < weld-dev at lists.jboss.org > >> > > Sent: Monday, September 18, 2017 12:17:28 PM >> > > Subject: Re: [weld-dev] Weld and Java 9 JPMS >> > > >> > > Hi Matej >> > > >> > > I am just trying to make Weld work in Java 9 (JavaSE + JPMS). >> > > >> > > I use the following jars as automatic modules: >> > > >> > > weld-environment-common-3.0.2-SNAPSHOT.jar >> > > weld-se-core-3.0.2-SNAPSHOT.jar >> > > weld-se-shaded-3.0.2-SNAPSHOT.jar >> > > weld-spi-3.0.SP1.jar >> > > weld-core-impl-3.0.2-SNAPSHOT.jar >> > > >> > > Is this right configuration? Or should I add/remove something. >> > > >> > > Best regards, Alex >> > > >> > > >> > > >> > > ???????????, 18 ???????? 2017, 12:41 +03:00 ?? Matej Novotny >> > > < manovotn at redhat.com >: >> > > >> > > Uhm, is there anything blocking you from placing it where you would in >> > > Java >> > > 8? >> > > E.g. src/main/resources/META-INF? >> > > >> > > I don't think I have tried this combination (or I do not recall). >> > > From the top of my head I don't know any JDK 9 limitation which would >> > > forbid >> > > to use XML descriptors in this way. >> > > I might be a bit rusty though; been a while since I played with Java 9. >> > > >> > > Please do report back with how this works for you :) >> > > Matej >> > > >> > > ----- Original Message ----- >> > > > From: "Alex Sviridov" < ooo_saturn7 at mail.ru > >> > > > To: "Matej Novotny" < manovotn at redhat.com > >> > > > Sent: Monday, September 18, 2017 10:28:11 AM >> > > > Subject: Re[2]: [weld-dev] Weld and Java 9 JPMS >> > > > >> > > > Thank you for your answer. I will try. But where should I place >> > > > beans.xml >> > > > to make Weld read it if I use Java SE+ JPMS? >> > > > >> > > > Best regards, Alex >> > > > >> > > > >> > > > >???????????, 18 ???????? 2017, 8:10 +03:00 ?? Matej Novotny >> > > > >< manovotn at redhat.com >: >> > > > > >> > > > >Hi Alex >> > > > > >> > > > >Back there we did some tests with earlier versions of Java 9 and >> > > > >eliminated >> > > > >some crucial problems. >> > > > >I think it should be possible to take *existing* app and run it on >> > > > >Java >> > > > >9. >> > > > > >> > > > >However, creating a whole new modular project might present some >> > > > >additional >> > > > >challenges. >> > > > >Weld itself is not modularized (since it needs to run on Java 8), >> > > > >therefore >> > > > >you would need to list some extra "requires" in module-info.java for >> > > > >Weld. >> > > > >You also need to have reflection access allowed (we need to >> > > > >instantiate >> > > > >proxies etc) but last time I checked, it was by default enabled in JDK >> > > > >9 >> > > > >wi >> > > > >th just warning showing up. >> > > > >Other than that, it might just work. >> > > > > >> > > > >To answer your other question - no, there is no tutorial, for there is >> > > > >no >> > > > >special difference between Weld and many other projects in regard to >> > > > >JDK >> > > > >9. >> > > > > >> > > > >Matej >> > > > > >> > > > >----- Original Message ----- >> > > > >> From: "Alex Sviridov" < ooo_saturn7 at mail.ru > >> > > > >> To: "weld-dev" < weld-dev at lists.jboss.org > >> > > > >> Sent: Sunday, September 17, 2017 3:25:49 PM >> > > > >> Subject: [weld-dev] Weld and Java 9 JPMS >> > > > >> >> > > > >> Hi all >> > > > >> >> > > > >> Could anyone provide information how weld works (if works) with Java >> > > > >> 9 >> > > > >> JPMS? >> > > > >> Is there any tutorial? >> > > > >> >> > > > >> Best regards, Alex >> > > > >> >> > > > >> _______________________________________________ >> > > > >> weld-dev mailing list >> > > > >> weld-dev at lists.jboss.org >> > > > >> https://lists.jboss.org/mailman/listinfo/weld-dev >> > > > >> > > > >> > > > -- >> > > > Alex Sviridov >> > > > >> > > >> > > >> > > -- >> > > Alex Sviridov >> > > >> > > _______________________________________________ >> > > weld-dev mailing list >> > > weld-dev at lists.jboss.org >> > > https://lists.jboss.org/mailman/listinfo/weld-dev >> > >> > >> > -- >> > Alex Sviridov >> > >> > _______________________________________________ >> > weld-dev mailing list >> > weld-dev at lists.jboss.org >> > https://lists.jboss.org/mailman/listinfo/weld-dev >> >> >> -- >> Alex Sviridov >> >> _______________________________________________ >> weld-dev mailing list >> weld-dev at lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/weld-dev -- Alex Sviridov -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20170919/cd5115c0/attachment-0001.html From manovotn at redhat.com Tue Sep 19 07:13:18 2017 From: manovotn at redhat.com (Matej Novotny) Date: Tue, 19 Sep 2017 07:13:18 -0400 (EDT) Subject: [weld-dev] Weld and Java 9 JPMS In-Reply-To: <1505810703.152762527@f59.i.mail.ru> References: <1505654749.975455722@f450.i.mail.ru> <1505748210.417179485@f351.i.mail.ru> <1471740307.11875173.1505805751286.JavaMail.zimbra@redhat.com> <1505810703.152762527@f59.i.mail.ru> Message-ID: <1929460400.11944167.1505819598083.JavaMail.zimbra@redhat.com> Hi, would you mind sharing your project/reproducer somewhere? That would be the fastest way to get on the same track. Also, what JDK release are you using? Sticking to latest I presume? I am not sure I understand your structure but I tried something in this GH "project" -> https://github.com/manovotn/JDK9Playground I just used Weld SE (3.0.1) and added two beans and tried if it works - looks like it does. Myself, I am using JDK 9 build 181. Matej ----- Original Message ----- > From: "Alex Sviridov" > To: "weld-dev" > Sent: Tuesday, September 19, 2017 10:45:03 AM > Subject: Re: [weld-dev] Weld and Java 9 JPMS > > Hi Matej > > Thank you for your answer, but I couldn't make it work. I opened my package, > but Weld (see my previous message at the end), as I understand, wants to get > access to hidden fields and methods of classes in java.base module and JPMS > doesn't > allow it. > > So, I gave up - as I don't know what to do else. If you can make it work, > please, report. > It would be very interesting. > > Best regards, Alex > > > > ???????, 19 ???????? 2017, 10:22 +03:00 ?? Matej Novotny > : > > > 1) Please, take a look at the second table (module overview) here > > https://labs.consol.de/development/2017/02/13/getting-started-with-java9-modules.html > > Did that, the article looks like there is finally some solid material on > modules. > > > 2) Weld is not unnamed module but automatic module as it is on module path > > and I use it by name. > > Yea, you are right, my bad. I meant automatic module OFC. > > > 3) From that table (module overview) we see that both automatic and unnamed > > modules can read application modules. If so, then why it doesn't? > > I suppose you already got your answer on StackOverflow[1], right? > To add on top of that, if you `exports` package - you only expose public > things in there. > For Weld to create proxies of your beans, we need to go deeper and allow > reflections access which may mean accessing private/protected stuff (such as > your @Inject private NewBean bean). > Java 9 doesn't like that and requires you to `opens` the package for this > kind of work. > > > And got the following (see below). It seems that Weld can't now work with > > JPMS. > > What will Weld developers say? > > From the SO question I guess you got it working in the end. > If you have any other questions, feel free to contact us again. > I'll try to test some JDK 9 project myself to refresh my memory so that I can > be of more help next time :) > > Matej > > _________________________________________________________________________- > [1] https://stackoverflow.com/questions/46282509 > > ----- Original Message ----- > > From: "Alex Sviridov" < ooo_saturn7 at mail.ru > > > To: "weld-dev" < weld-dev at lists.jboss.org > > > Sent: Monday, September 18, 2017 5:23:30 PM > > Subject: Re: [weld-dev] Weld and Java 9 JPMS > > > > So, here I am. > > I changed my.module from > > my.module { > > requires weld.se.shaded; > > exports com.foo; > > } > > to > > my.module { > > requires weld.se.shaded; > > opens com.foo; > > } > > > > And got the following (see below). It seems that Weld can't now work with > > JPMS. > > What will Weld developers say? > > > > Exception in thread "main" org.jboss.weld.exceptions.WeldException: > > WELD-001524: Unable to load proxy class for bean Implicit Bean > > [javax.enterprise.event.Event] with qualifiers [@Default] with class > > interface javax.enterprise.event.Event using classloader > > jdk.internal.loader.ClassLoaders$AppClassLoader at 6b2fad11 > > at > > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native > > Method) > > at > > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) > > at > > java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > > at > > java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488) > > at > > java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:587) > > at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:996) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions(AbstractExecutorServices.java:72) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:58) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:66) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer.doAfterBeanDiscovery(ConcurrentBeanDeployer.java:88) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.BeanDeployment.afterBeanDiscovery(BeanDeployment.java:268) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:466) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.environment.se.Weld.initialize(Weld.java:789) > > at my.module/com.foo.NewMain.main(NewMain.java:47) > > Caused by: org.jboss.weld.exceptions.WeldException: WELD-001524: Unable to > > load proxy class for bean Implicit Bean [javax.enterprise.event.Event] with > > qualifiers [@Default] with class interface javax.enterprise.event.Event > > using classloader jdk.internal.loader.ClassLoaders$AppClassLoader at 6b2fad11 > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:389) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.builtin.AbstractFacadeBean.initializeAfterBeanDiscovery(AbstractFacadeBean.java:61) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:111) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:102) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55) > > at > > java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1431) > > at > > java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:283) > > at > > java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1603) > > at > > java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) > > Caused by: java.lang.ExceptionInInitializerError > > at > > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native > > Method) > > at > > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) > > at > > java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > > at > > java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.proxy.ProxyFactory.newClassFile(ProxyFactory.java:496) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:455) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:381) > > ... 9 more > > Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make > > protected final java.lang.Class > > java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int) throws > > java.lang.ClassFormatError accessible: module java.base does not "opens > > java.lang" to module weld.se.shaded > > at > > java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337) > > at > > java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281) > > at > > java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:198) > > at java.base/java.lang.reflect.Method.setAccessible(Method.java:192) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.classfilewriter.ClassFile$1.run(ClassFile.java:256) > > at java.base/java.security.AccessController.doPrivileged(Native Method) > > at > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.classfilewriter.ClassFile.(ClassFile.java:251) > > ... 16 more > > > > > > > > > > > > > > ???????????, 18 ???????? 2017, 16:39 +03:00 ?? Matej Novotny > > < manovotn at redhat.com >: > > > > From the exception you are getting, this line is important: > > > > "Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make > > field private com.foo.NewBean com.foo.NewClass.bean accessible: module > > my.module does not "opens com.foo" to module weld.se.shaded" > > > > Basically, Weld is not modularized (== lands in unnamed module) and it > > needs > > access to your module so that it can create beans. E.g. you need to make > > sure unnamed module has access to your module. > > I think that by default in JDK 9 the access is intended so that all modules > > can read unnamed module, but unnamed module can only read itself > > (simplified > > version). > > Hence you want to break a few rules and force this to work in the opposite > > direction for your module. > > > > Matej > > > > > > ----- Original Message ----- > > > From: "Alex Sviridov" < ooo_saturn7 at mail.ru > > > > To: "weld-dev" < weld-dev at lists.jboss.org > > > > Sent: Monday, September 18, 2017 1:46:36 PM > > > Subject: Re: [weld-dev] Weld and Java 9 JPMS > > > > > > Thank you for your answer. > > > > > > Could anyone give any suggestion about the following? > > > > > > I have my named module and weld-se-shaded as unnamed module. > > > In my module I have > > > > > > module my.module { > > > requires weld.se.shaded; > > > exports com.foo; > > > } > > > > > > ################################# > > > package com.foo; > > > > > > import javax.enterprise.context.ApplicationScoped; > > > import javax.inject.Inject; > > > > > > @ApplicationScoped > > > public class NewClass { > > > > > > @Inject > > > private NewBean bean; > > > > > > public void doIt() { > > > bean.doIt(); > > > } > > > > > > } > > > > > > ################################# > > > package com.foo; > > > > > > import javax.enterprise.context.Dependent; > > > > > > @Dependent > > > public class NewBean { > > > > > > public void doIt() { > > > System.out.println("I am doing it); > > > } > > > } > > > > > > And this is the result > > > > > > Sep 18, 2017 2:33:12 PM org.jboss.weld.bootstrap.WeldStartup > > > INFO: WELD-000900: 3.0.2 (2017-09-18 08:49) > > > Sep 18, 2017 2:33:12 PM > > > org.jboss.weld.environment.deployment.discovery.ReflectionDiscoveryStrategy > > > processAnnotatedDiscovery > > > INFO: WELD-ENV-000014: Falling back to Java Reflection for > > > bean-discovery-mode="annotated" discovery. Add org.jboss:jandex to the > > > classpath to speed-up startup. > > > Sep 18, 2017 2:33:12 PM org.jboss.weld.bootstrap.WeldStartup > > > startContainer > > > INFO: WELD-000101: Transactional services not available. Injection of > > > @Inject > > > UserTransaction not available. Transactional observers will be invoked > > > synchronously. > > > Exception in thread "main" java.lang.reflect.InaccessibleObjectException > > > at > > > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native > > > Method) > > > at > > > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) > > > at > > > java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > > > at > > > java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488) > > > at > > > java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:590) > > > at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:996) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions(AbstractExecutorServices.java:72) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:58) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:66) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer.createClassBeans(ConcurrentBeanDeployer.java:65) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:256) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:422) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.environment.se.Weld.initialize(Weld.java:789) > > > at my.module/com.foo.NewMain.main(NewMain.java:47) > > > Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make > > > field private com.foo.NewBean com.foo.NewClass.bean accessible: module > > > my.module does not "opens com.foo" to module weld.se.shaded > > > at > > > java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337) > > > at > > > java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281) > > > at > > > java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:176) > > > at java.base/java.lang.reflect.Field.setAccessible(Field.java:170) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.of(GetAccessibleCopyOfMember.java:38) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.run(GetAccessibleCopyOfMember.java:44) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.security.GetAccessibleCopyOfMember.run(GetAccessibleCopyOfMember.java:26) > > > at java.base/java.security.AccessController.doPrivileged(Native Method) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.FieldInjectionPoint.(FieldInjectionPoint.java:65) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.createFieldInjectionPoint(InjectionPointFactory.java:141) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.addFieldInjectionPoint(InjectionPointFactory.java:226) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.InjectionPointFactory.getFieldInjectionPoints(InjectionPointFactory.java:211) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.DefaultInjector.(DefaultInjector.java:56) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.ResourceInjector.(ResourceInjector.java:57) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.ResourceInjector.of(ResourceInjector.java:48) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.BeanInjectionTarget.(BeanInjectionTarget.java:63) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.injection.producer.BeanInjectionTarget.createDefault(BeanInjectionTarget.java:47) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.manager.InjectionTargetFactoryImpl.chooseInjectionTarget(InjectionTargetFactoryImpl.java:139) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:88) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.ManagedBean.(ManagedBean.java:100) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bean.ManagedBean.of(ManagedBean.java:80) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.AbstractBeanDeployer.createManagedBean(AbstractBeanDeployer.java:280) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.BeanDeployer.createClassBean(BeanDeployer.java:221) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:68) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:65) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62) > > > at > > > weld.se.shaded at 3.0.2-SNAPSHOT/org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55) > > > at > > > java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1431) > > > at > > > java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:283) > > > at > > > java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1603) > > > at > > > java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) > > > > > > > > > > > > > > > > > > > > > > > > ???????????, 18 ???????? 2017, 14:18 +03:00 ?? Matej Novotny > > > < manovotn at redhat.com >: > > > > > > Hi, > > > > > > if you are in SE, you should only need 'weld-se-shaded' artifact (as a > > > JAR). > > > As it is "shaded", it brings along all the other parts of Weld you might > > > need. > > > > > > Matej > > > > > > > > > ----- Original Message ----- > > > > From: "Alex Sviridov" < ooo_saturn7 at mail.ru > > > > > To: "weld-dev" < weld-dev at lists.jboss.org > > > > > Sent: Monday, September 18, 2017 12:17:28 PM > > > > Subject: Re: [weld-dev] Weld and Java 9 JPMS > > > > > > > > Hi Matej > > > > > > > > I am just trying to make Weld work in Java 9 (JavaSE + JPMS). > > > > > > > > I use the following jars as automatic modules: > > > > > > > > weld-environment-common-3.0.2-SNAPSHOT.jar > > > > weld-se-core-3.0.2-SNAPSHOT.jar > > > > weld-se-shaded-3.0.2-SNAPSHOT.jar > > > > weld-spi-3.0.SP1.jar > > > > weld-core-impl-3.0.2-SNAPSHOT.jar > > > > > > > > Is this right configuration? Or should I add/remove something. > > > > > > > > Best regards, Alex > > > > > > > > > > > > > > > > ???????????, 18 ???????? 2017, 12:41 +03:00 ?? Matej Novotny > > > > < manovotn at redhat.com >: > > > > > > > > Uhm, is there anything blocking you from placing it where you would in > > > > Java > > > > 8? > > > > E.g. src/main/resources/META-INF? > > > > > > > > I don't think I have tried this combination (or I do not recall). > > > > From the top of my head I don't know any JDK 9 limitation which would > > > > forbid > > > > to use XML descriptors in this way. > > > > I might be a bit rusty though; been a while since I played with Java 9. > > > > > > > > Please do report back with how this works for you :) > > > > Matej > > > > > > > > ----- Original Message ----- > > > > > From: "Alex Sviridov" < ooo_saturn7 at mail.ru > > > > > > To: "Matej Novotny" < manovotn at redhat.com > > > > > > Sent: Monday, September 18, 2017 10:28:11 AM > > > > > Subject: Re[2]: [weld-dev] Weld and Java 9 JPMS > > > > > > > > > > Thank you for your answer. I will try. But where should I place > > > > > beans.xml > > > > > to make Weld read it if I use Java SE+ JPMS? > > > > > > > > > > Best regards, Alex > > > > > > > > > > > > > > > >???????????, 18 ???????? 2017, 8:10 +03:00 ?? Matej Novotny > > > > > >< manovotn at redhat.com >: > > > > > > > > > > > >Hi Alex > > > > > > > > > > > >Back there we did some tests with earlier versions of Java 9 and > > > > > >eliminated > > > > > >some crucial problems. > > > > > >I think it should be possible to take *existing* app and run it on > > > > > >Java > > > > > >9. > > > > > > > > > > > >However, creating a whole new modular project might present some > > > > > >additional > > > > > >challenges. > > > > > >Weld itself is not modularized (since it needs to run on Java 8), > > > > > >therefore > > > > > >you would need to list some extra "requires" in module-info.java for > > > > > >Weld. > > > > > >You also need to have reflection access allowed (we need to > > > > > >instantiate > > > > > >proxies etc) but last time I checked, it was by default enabled in > > > > > >JDK > > > > > >9 > > > > > >wi > > > > > >th just warning showing up. > > > > > >Other than that, it might just work. > > > > > > > > > > > >To answer your other question - no, there is no tutorial, for there > > > > > >is > > > > > >no > > > > > >special difference between Weld and many other projects in regard to > > > > > >JDK > > > > > >9. > > > > > > > > > > > >Matej > > > > > > > > > > > >----- Original Message ----- > > > > > >> From: "Alex Sviridov" < ooo_saturn7 at mail.ru > > > > > > >> To: "weld-dev" < weld-dev at lists.jboss.org > > > > > > >> Sent: Sunday, September 17, 2017 3:25:49 PM > > > > > >> Subject: [weld-dev] Weld and Java 9 JPMS > > > > > >> > > > > > >> Hi all > > > > > >> > > > > > >> Could anyone provide information how weld works (if works) with > > > > > >> Java > > > > > >> 9 > > > > > >> JPMS? > > > > > >> Is there any tutorial? > > > > > >> > > > > > >> Best regards, Alex > > > > > >> > > > > > >> _______________________________________________ > > > > > >> weld-dev mailing list > > > > > >> weld-dev at lists.jboss.org > > > > > >> https://lists.jboss.org/mailman/listinfo/weld-dev > > > > > > > > > > > > > > > -- > > > > > Alex Sviridov > > > > > > > > > > > > > > > > > -- > > > > Alex Sviridov > > > > > > > > _______________________________________________ > > > > weld-dev mailing list > > > > weld-dev at lists.jboss.org > > > > https://lists.jboss.org/mailman/listinfo/weld-dev > > > > > > > > > -- > > > Alex Sviridov > > > > > > _______________________________________________ > > > weld-dev mailing list > > > weld-dev at lists.jboss.org > > > https://lists.jboss.org/mailman/listinfo/weld-dev > > > > > > -- > > Alex Sviridov > > > > _______________________________________________ > > weld-dev mailing list > > weld-dev at lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/weld-dev > > > -- > Alex Sviridov > > _______________________________________________ > weld-dev mailing list > weld-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/weld-dev