Re: How access classes from war dependency?
> I don't simple known where I should ask this. Besides Anders has proposed me > this idea. I've thought that he can help me further. stackoverflow.com javaranch.com forums.oracle.com forums.terracotta.org or try the User Forum for whatever j2ee container you are using (glassfish, weblogic, jboss, etc) Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: How access classes from war dependency?
Wayne Fay wrote: > >> If I debug 1-st war and then 2-nd one, I see that 2-nd war also goes into >> row 5. So both wars works with different objects. >> Can you explain me how can I solve this? > > This is not the right place to ask such questions -- we are Maven > experts, not j2ee war classloader experts. You probably need to use > some tooling like Terracotta to achieve a server-wide (or even > cluster-wide?) singleton. > > Wayne > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > Thank you Wayne. I don't simple known where I should ask this. Besides Anders has proposed me this idea. I've thought that he can help me further. -- View this message in context: http://maven.40175.n5.nabble.com/How-to-access-classes-from-war-dependency-tp4362127p4373752.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: How access classes from war dependency?
Rick Genter wrote: > > I don't think you can do this. I think each war is in its own class > loader; effectively each web application is in its own space. There may be > ways to configure your app server to share information between wars, but > frankly the whole concept smells of bad design. > -- > Rick Genter > Thank you for explanation Rick, but what would be in this case a good design? Thank you in advance, Best Regards, -sipungora -- View this message in context: http://maven.40175.n5.nabble.com/How-to-access-classes-from-war-dependency-tp4362127p4373726.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: How access classes from war dependency?
> If I debug 1-st war and then 2-nd one, I see that 2-nd war also goes into > row 5. So both wars works with different objects. > Can you explain me how can I solve this? This is not the right place to ask such questions -- we are Maven experts, not j2ee war classloader experts. You probably need to use some tooling like Terracotta to achieve a server-wide (or even cluster-wide?) singleton. Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: How access classes from war dependency?
On May 5, 2011, at 2:44 PM, sipungora wrote: > I've done this, as you've explained me here. But I have one problem yet. If > I save data in jar object from 1-st war for the 2-nd war, the 2-nd war > cannot acces they. My object is the singleton. > > 1 protected static Controller controller; > 2 > 3 public static Controller getInstance() { > 4 if(controller == null) { > 5 controller = new Controller(); > 6 } > 7 return controller; > 8 } > > If I debug 1-st war and then 2-nd one, I see that 2-nd war also goes into > row 5. So both wars works with different objects. > Can you explain me how can I solve this? I don't think you can do this. I think each war is in its own class loader; effectively each web application is in its own space. There may be ways to configure your app server to share information between wars, but frankly the whole concept smells of bad design. -- Rick Genter rgen...@interactions.net *** This e-mail and any of its attachments may contain Interactions Corporation proprietary information, which is privileged, confidential, or subject to copyright belonging to the Interactions Corporation. This e-mail is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution, copying, or action taken in relation to the contents of and attachments to this e-mail is strictly prohibited and may be unlawful. If you have received this e-mail in error, please notify the sender immediately and permanently delete the original and any copy of this e-mail and any printout. Thank You. *** - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: How access classes from war dependency?
Anders Hammar wrote: > > No, you create a third project which is a standard jar Maven project. > There > you but those Java classes. This will produce a jar artifact, which you > declare a dependency to from both war projects. > I've done this, as you've explained me here. But I have one problem yet. If I save data in jar object from 1-st war for the 2-nd war, the 2-nd war cannot acces they. My object is the singleton. 1 protected static Controller controller; 2 3 public static Controller getInstance() { 4 if(controller == null) { 5 controller = new Controller(); 6 } 7 return controller; 8 } If I debug 1-st war and then 2-nd one, I see that 2-nd war also goes into row 5. So both wars works with different objects. Can you explain me how can I solve this? Thank you in advance. Best Regards, -sipungora -- View this message in context: http://maven.40175.n5.nabble.com/How-to-access-classes-from-war-dependency-tp4362127p4373647.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: How access classes from war dependency?
Should happen automagically if you declare a dependency to it in your war project. Use the standard compile scope for the dependency. /Anders On Mon, May 2, 2011 at 01:33, sipungora wrote: > Hi Anders, > > > you create a third project which is a standard jar Maven project. > > I've done it. But how can I configure my pom, that this jar will after > building be in WEB-INF/lib of my war? Currently I do it manually. > > Thank you in advance. > Best Regards, > -sipungora-- > View this message in context: > http://maven.40175.n5.nabble.com/How-to-access-classes-from-war-dependency-tp4362127p4363706.html > Sent from the Maven - Users mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > >
Re: How access classes from war dependency?
Hi Anders, > you create a third project which is a standard jar Maven project. I've done it. But how can I configure my pom, that this jar will after building be in WEB-INF/lib of my war? Currently I do it manually. Thank you in advance. Best Regards, -sipungora-- View this message in context: http://maven.40175.n5.nabble.com/How-to-access-classes-from-war-dependency-tp4362127p4363706.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: How access classes from war dependency?
Thank you Dennis. I will later write, if it works. -- View this message in context: http://maven.40175.n5.nabble.com/How-to-access-classes-from-war-dependency-tp4362127p4362575.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: How access classes from war dependency?
Thank you, Anders. I'll try this to do. -- View this message in context: http://maven.40175.n5.nabble.com/How-to-access-classes-from-war-dependency-tp4362127p4362573.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: How access classes from war dependency?
On 2011-05-01 03:48, sipungora wrote: > Hi, > > I have a war-dependency. Its classes are arranged in war/WEB-INF/classes/. > How should I configure my pom, that I can access they? > > I assume, they should be copied from war/WEB-INF/classes/ into > mywar/WEB-INF/classes/, but I don't know, how my pom should correct be > configured. For that to work you need to use a feature in Maven WAR Plugin that is called overlays. That will "overlay" the dependant WAR on top of your current project's WAR. See http://maven.apache.org/plugins/maven-war-plugin/examples/war-overlay.html > > this is a config of maven-war-plugin > > > > org.apache.maven.plugins > maven-war-plugin > > > war > > src/main/webapp/WEB-INF/web.xml > > WEB-INF/lib/* > > > > war/META-INF/MANIFEST.MF > > > > > > and this is the war-dependency: > > > > ${groupId} > test > ${version} > war > > > Thanks in advance. > Best Regards. > -sipungora. > -- > View this message in context: > http://maven.40175.n5.nabble.com/How-access-classes-from-war-dependency-tp4362127p4362127.html > Sent from the Maven - Users mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > > -- Dennis Lundberg - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: How access classes from war dependency?
No, you create a third project which is a standard jar Maven project. There you but those Java classes. This will produce a jar artifact, which you declare a dependency to from both war projects. /Anders On Sun, May 1, 2011 at 03:48, sipungora wrote: > Hi, > > I have a war-dependency. Its classes are arranged in war/WEB-INF/classes/. > How should I configure my pom, that I can access they? > > I assume, they should be copied from war/WEB-INF/classes/ into > mywar/WEB-INF/classes/, but I don't know, how my pom should correct be > configured. > > this is a config of maven-war-plugin > > > >org.apache.maven.plugins >maven-war-plugin > > > war > > src/main/webapp/WEB-INF/web.xml > > WEB-INF/lib/* > > > > war/META-INF/MANIFEST.MF > > > > > > and this is the war-dependency: > > > >${groupId} >test >${version} >war > > > Thanks in advance. > Best Regards. > -sipungora. > -- > View this message in context: > http://maven.40175.n5.nabble.com/How-access-classes-from-war-dependency-tp4362127p4362127.html > Sent from the Maven - Users mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > >