sentence
stringlengths 1
1.38k
| label
stringclasses 3
values |
|---|---|
However Jboss picketbox gives you a really easy way to go, unless you need something specific.
|
o
|
I can't speak too much to JAAS itself, but this URL_http://static.springsource.org/spring-security/site/start-here.html ["suggested-steps"-guide] on Spring Security and URL_http://static.springframework.org/spring-security/site/reference.html [the-reference-manual] are both pretty good resources on Spring Security - if your setup is anything close to simple, you don't really need to do much more than read these.
|
p
|
The "suggested steps" guide has moved here: URL_http://static.springsource.org /spring-security/site/start-here.html.
|
o
|
thanks, updated the link.
|
o
|
For a purely JAAS tutorial check out URL_http://www.javaworld.com/javaworld/jw-09-2002/jw-0913-jaas.html [this] .
|
o
|
It's old but should help with the JAAS basics.
|
o
|
lsiu's answer is one the few answers here that really "get it" ;) Adding to that answer, a really good reference on this topic is URL_http://java.sys-con.com/node/1002315 [Whatever-Happened-to-JAAS?
|
o
|
] .
|
o
|
It explains how JASPIC is the link in Java EE between the Servlet and EJB security models and potentially a JAAS login module, but that in many cases JAAS' role is reduced to that of a relatively simple username and roles provider in Java EE.
|
p
|
From the same author is URL_http://raymondkng.sys-con.com/node/171477 [JAAS- in-the-Enterprise] , which is an older article but provides a lot of historical background on why the Java SE (JAAS) and Java EE models diverged the way they did.
|
o
|
Overall but a few types from JAAS are directly used in Java EE, basically CODETERM1 , CODETERM2 , and CODETERM3 .
|
o
|
The latter two are mainly used by JASPIC.
|
o
|
I've explained JASPIC in the article URL_http://arjan- tijms.blogspot.com/2012/11/implementing-container-authentication.html [Implementing-container-authentication-in-Java-EE-with-JASPIC] .
|
o
|
What's the best way to share business object instances between Java web apps using JBoss and Spring?
|
o
|
We currently have a web application loading a Spring application context which instantiates a stack of business objects, DAO objects and Hibernate.
|
o
|
We would like to share this stack with another web application, to avoid having multiple instances of the same objects.
|
o
|
We have looked into several approaches; exposing the objects using JMX or JNDI, or using EJB3.
|
o
|
The different approaches all have their issues, and we are looking for a lightweight method.
|
p
|
Any suggestions on how to solve this?
|
o
|
Edit: I have received comments requesting me to elaborate a bit, so here goes: The main problem we want to solve is that we want to have only one instance of Hibernate.
|
o
|
This is due to problems with invalidation of Hibernate's 2nd level cache when running several client applications working with the same datasource.
|
p
|
Also, the business/DAO/Hibernate stack is growing rather large, so not duplicating it just makes more sense.
|
o
|
First, we tried to look at how the business layer alone could be exposed to other web apps, and Spring offers JMX wrapping at the price of a tiny amount of XML.
|
o
|
However, we were unable to bind the JMX entities to the JNDI tree, so we couldn't lookup the objects from the web apps.
|
o
|
Then we tried binding the business layer directly to JNDI.
|
o
|
Although Spring didn't offer any method for this, using JNDITemplate to bind them was also trivial.
|
n
|
But this led to several new problems: 1) Security manager denies access to RMI classloader, so the client failed once we tried to invoke methods on the JNDI resource.
|
n
|
2) Once the security issues were resolved, JBoss threw IllegalArgumentException: object is not an instance of declaring class.
|
o
|
A bit of reading reveals that we need stub implementations for the JNDI resources, but this seems like a lot of hassle (perhaps Spring can help us?
|
o
|
) We haven't looked too much into EJB yet, but after the first two tries I'm wondering if what we're trying to achieve is at all possible.
|
o
|
To sum up what we're trying to achieve: One JBoss instance, several web apps utilizing one stack of business objects on top of DAO layer and Hibernate.
|
o
|
Best regards, Nils .
|
p
|
Could you comment on 1.
|
o
|
What problem you're trying to solve; 2.
|
o
|
The issues you found with the respective approaches you mention.
|
o
|
This would allow a more focused answer...
|
p
|
It was difficult to say it all in 300 characters, so I edited the question to add more details :-).
|
n
|
Are the web applications deployed on the same server?
|
o
|
I can't speak for Spring, but it is straightforward to move your business logic in to the EJB tier using Session Beans.
|
p
|
The application organization is straight forward.
|
o
|
The Logic goes in to Session Beans, and these Session Beans are bundled within a single jar as an Java EE artifact with a ejb-jar.xml file (in EJB3, this will likely be practically empty).
|
o
|
Then bundle you Entity classes in to a seperate jar file.
|
o
|
Next, you will build each web app in to their own WAR file.
|
o
|
Finally, all of the jars and the wars are bundled in to a Java EE EAR, with the associated application.xml file (again, this will likely be quite minimal, simply enumerating the jars in the EAR).
|
o
|
This EAR is deployed wholesale to the app server.
|
o
|
Each WAR is effectively independent -- their own sessions, there own context paths, etc.
|
o
|
But they share the common EJB back end, so you have only a single 2nd level cache.
|
o
|
You also use local references and calling semantic to talk to the EJBs since they're in the same server.
|
o
|
No need for remote calls here.
|
o
|
I think this solves quite well the issue you're having, and its is quite straightforward in Java EE 5 with EJB 3.
|
p
|
Also, you can still use Spring for much of your work, as I understand, but I'm not a Spring person so I can not speak to the details.
|
o
|
Yes, everything is deployed to the same server.
|
o
|
This looks quite interesting, I'll give EJB a shot today.
|
p
|
My point about Spring is that it offers to wrap beans for e.g.
|
o
|
JMX without any code, but apparently not for EJB.
|
o
|
Anyway, I look at the EJB approach today.
|
o
|
What about spring parentContext?Check out this article: URL_http://springtips.blogspot.com/2007/06/using-shared-parent-application- context.html [ URL_http://springtips.blogspot.com/2007/06/using-shared-parent - application-context.html] .
|
o
|
URL_http://www.terracotta.org/ [Terracotta] might be a good fit here (disclosure: I am a developer for Terracotta).
|
p
|
Terracotta transparently clusters Java objects at the JVM level, and integrates with both Spring and Hibernate.
|
o
|
It is free and open source.
|
p
|
As you said, the problem of more than one client web app using an L2 cache is keeping those caches in synch.
|
o
|
With Terracotta you can cluster a single Hibernate L2 cache.
|
o
|
Each client node works with it's copy of that clustered cache, and Terracotta keeps it in synch.
|
p
|
URL_http://www.terracotta.org/web/display/orgsite/Hibernate+Integration
[This-link] explains more.
|
o
|
As for your business objects, you can use Terracotta's URL_http://www.terracotta.org/web/display/orgsite/Spring+Integration [Spring- integration] to cluster your beans - each web app can share clustered bean instances, and Terracotta keeps the clustered state in synch transparently.
|
o
|
You should take a look at the Terracotta Reference Web Application - Examinator.
|
o
|
It has most of the components you are looking for - it's got Hibernate, JPA, and Spring with a MySQL backend.
|
o
|
It's been pre-tuned to scale up to 16 nodes, 20k concurrent users.
|
o
|
Check it out here: URL_http://reference.terracotta.org/examinator [ URL_http://reference.terracotta.org/examinator ] .
|
o
|
Actually, if you want a lightweight solution and don't need transactions or clustering just use Spring support for RMI.
|
p
|
It allows to expose Spring beans remotely using simple annotations in the latest versions.
|
p
|
See URL_http://stati c.springframework.org/spring/docs/2.0.x/reference/remoting.html [ URL_http://static.springframework.org/spring/docs/2.0.x/reference/remoting.html ] .
|
o
|
I have used this approach to access shared Spring beans from a webapp.
|
o
|
It works though I still feel there is probably a better/cleaner solution.
|
p
|
If you don't like RMI, Spring offers a few other remoting options - Hessian, Burlap, and HttpInvoker (Spring's custom remoting solution - Java serialization over HTTP).
|
o
|
Of course there are always web services as well.
|
p
|
Spring does have an integration point that might be of interest to you: URL_http://static.springframework.org/spring/docs/2.5.x/reference/ejb.html [EJB-3-injection-nterceptor] .
|
o
|
This enables you to access spring beans from EJBs.
|
o
|
Thank you for your answers so far.
|
p
|
We're still not quite there, but we have tried a few things now and see things more clearly.
|
o
|
Here's a short update: The solution which appears to be the most viable is EJB.
|
o
|
However, this will require some amount of changes in our code, so we're not going to fully implement that solution right now.
|
o
|
I'm almost surprised that we haven't been able to find some Spring feature to help us out here.
|
o
|
We have also tried the JNDI route, which ends with the need for stubs for all shared interfaces.
|
o
|
This feels like a lot of hassle, considering that everything is on the same server anyway.
|
o
|
Yesterday, we had a small break through with JMX.
|
o
|
Although JMX is definately not meant for this kind of use, we have proven that it can be done - with no code changes and a minimal amount of XML (a big Thank You to Spring for MBeanExporter and MBeanProxyFactoryBean).
|
p
|
The major drawbacks to this method are performance and the fact that our domain classes must be shared through JBoss' server/lib folder.
|
o
|
I.e., we have to remove some dependencies from our WARs and move them to server/lib, else we get ClassCastException when the business layer returns objects from our own domain model.
|
o
|
I fully understand why this happens, but it is not ideal for what we're trying to achieve.
|
n
|
I thought it was time for a little update, because what appears to be the best solution will take some time to implement.
|
n
|
I'll post our findings here once we've done that job.
|
o
|
It's been suggested several times on this thread by myself and others, but have you looked at Terracotta?
|
o
|
Unlike all the other solutions presented thus far, it is designed explicitly for state sharing which is what you asked for.
|
o
|
I'm not really sure what you are trying to solve; at the end of the day each jvm will either have replicated instances of the objects, or stubs representing objects existing on another (logical) server.
|
o
|
You could, setup a third 'business logic' server that has a remote api which your two web apps could call.
|
o
|
The typical solution is to use EJB, but I think spring has remoting options built into its stack.
|
o
|
The other option is to use some form of shared cache architecture... which will synchronize object changes between the servers, but you still have two sets of instances.
|
o
|
Not so if you use Terracotta.
|
o
|
Take a look at URL_http://www.jboss.org/jbosscache/ [JBossCache] .
|
o
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.