JBoss 7.1 and Seam 2.2 -- Caching? - caching

I have configured a JBoss Seam 2.2 application to run on JBoss 7.1. (See here and here) It runs with no problem after using this guide as a reference. However, every reference document that I've read either talks about disabling caching or ignores it altogether. I know that JBoss 7 has a new caching mechanism from previous versions. What do I need to do to leverage this within my Seam app? Or, do I just include the JARs from the previous caching implementation and use that?

Seam 2 as you probably realized has been morphed into CDI and most of the integration going forward will be around CDI.
Having said that there are ways to leverage infinispan (the new Cache used within JBoss AS 7) in your Seam application.
Here are a few references that might help you
http://www.mastertheboss.com/jboss-frameworks/infinispan/infinispan-tutorial-part-1
http://www.mastertheboss.com/jboss-frameworks/infinispan/infinispan-tutorial-part-2
http://infinispan.blogspot.com/2011/09/when-infinispan-meets-cdi.html
Hope this helps.
Good luck!

Related

Payara 5/6 and SpringFramework

I've come to the conclusion that the Spring Web MVC is not compatible with Payara 5 and 6. I have an application that uses Glassfish 3, Spring Web MVC, and EclipseLink JPA. I intend to upgrade the code to Java 17 and Jakarta EE. In the sake of kindness, it hasn't gone well. In all my efforts, it's been Spring's Web MVC that is causing the problems. Spring charges for support and that's not a viable option for me. Before I scrap it's use, let's pick your brain.
If anyone has implemented Spring Web MVC successfully with Payara 5 and/or 6, please share how you made it work.
My first step was to try Payara 6 for Jakarta EE. After creating a VERY small Hello World web app, I included Spring Web MVC jar and did the minimum to activate it's Dispatcher Servlet. I was never able to overcome the error CDI is not available.
Secondly, I backed off to Payara 5. In that attempt, it tries to instantiate a JPA EAO Bean that the app will use in all it's controllers to access the app's DB. The error here appears to be when it attempts to use FasterXML to read the persistence.xml file. That part of the app works fine when I create the EAO object with JUnit.
Rather than providing all the gory details, reviewing the artifacts from a successfully implemented app with help me tremendously.
Thank you for your help!
So after weeks of beating my head against a wall trying all kinds of things to get it working, I wrote to one of the SpringFramework developers, Juergen Hoeller. Here's his response....
Sorry to hear that there is so much trouble on Payara still. We also
have corresponding reports on GitHub:
https://github.com/spring-projects/spring-framework/issues/29718
https://github.com/spring-projects/spring-framework/issues/29743
Unfortunately neither of the two is an actual problem to be solved on
Spring's own side, as far as I can see.
With the CDI issue, it's Payara's CDI implementation not being able to
parse Java 17's new record types. Also, I wonder why Payara needs to
parse every single deployed class file if you are not actually using
CDI. It might be possible to turn that off, but at the very least,
Payara should defensively handle "unknown" types.
With the Hibernate issue, it's a problem with Hibernate 6 initializing
its Jackson configuration on Payara. There does not seem to be a StAX
provider available, and Hibernate insists on one being present for
Jackson.
Overall, this needs to be taken to Payara and Hibernate, we are not
aware of anything Spring can do better. Feel free to add further
comments to the GitHub issues in case there is anything we can do from
our side! Even if our focus is on Tomcat/Jetty these days, we of
course want Spring 6 to work fine on Payara as well.
Thanks for your efforts to try to make this work,
Juergen
So now, how do we get the attention of Oracle's Glassfish developers and Payara's developers to get this resolved???? In the meantime, I think I'll have to install Tomcat or some other free webserver. Thanks, Oracle.
This was reported against Hibernate before, but Glassfish/Payara simply have a broken classpath config. Also see https://hibernate.atlassian.net/browse/HHH-15556
Maybe try using Wildfly, which is also free ;)

Upgrading to Spring 4

I have a spring 3 app deployed in openshift jboss eap6, and I want to upgrade to ver 4. I also want to upgrade to Java8. Has anyone here been successful in doing so? What are the things that must be considered? How can I make the transition easier? I'm so afraid of Jar hell.
Upgrading von Spring 3.0 to 4.0 could need some changes (depending on what you have done and used). I recommend to do it in small steps, so you can check that everything still works more often, so: uprade to 3.1 first, then 3.2, and then 4.0. After that upgrade to Java 8.
The Spring Reference contain some hints in the what is new section and this Wiki: Migrating from earlier versions of the Spring Framework
Attention: if you upgrade Spring Security too, then I strongly recommend to read its upgrade hints in its Migration documentation!
Solution to your Question
Don't worry Spring 4 is 100% compatible with Java 8
For Jars you need to use the Bill of Materials of Spring 4 Jars which can be obtained in this Link. Use only these jars which will take care of your dependencies issues.
Typically replace all these JAR files in your WEB Applications and try to build and deploy your application. You got your JAR upgrade if it runs without any issues. Most probably 100% it will run without any issues.
Then Depending your scenarios you can apply your spring-framework components.

How to integrate Spring AOP in CDI - any examples

I would implement a Spring aspect in a j2ee application, can someone post some tutorials?
I've just used Spring in web application but I've not idea how to invoke a cross cutting concern in CDI container.
Thanks in advance
Is there a special need for combining Spring and CDI? If not, I'd suggest to stick to standard Java EE as long as you can solve your problem with it and only if not, look for external components (and even then, you should first check the "sort-of-standard" CDI extensionf from the Apache Deltaspike project.
Cross-cutting concerns can be solved via pure CDI - check our for example the Java EE 7 tutorial about the topic.
Small note: Don't use J2EE anymore if not maintaining an ancient application.

Stable Spring version release

Right now I am trying to research on how stable Spring release are right now. I'm having problems determining whether the most current Spring release (3.1.1) is the best choice for a base architecture. Are there any differences between 3.0 and 3.1? If so are there any impact in terms of coding structure just like migrating from spring 2.0 to 3.0. Currently we have a base architecture for Spring 2.0 and we are thinking of migrating to 3.X for integrated AJAX support and integrated REST support as well. Are there any other perks in migrating to 3.X? Is it good idea to migrate to Spring 3.0? If yes are there any drawbacks in migrating also which version is the best to migrate to? Thanks for taking time in reading this, have a nice day.
Are there any differences between 3.0 and 3.1?
http://static.springsource.org/spring/docs/3.1.x/changelog.txt
EDIT:
ok, it that's too technical, try this:
http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/new-in-3.1.html
EDIT 2:
no, you do not have to use annotations. That's just a convenience feature mostly.
EDIT 3:
in Implementing Controllers all annotation based configurations have their XML-schema based counterparts. That said, unless you have very good reasons against annotations, you might try to gradually switch to this paradigm, as it is easier to read thus easier to maintain. (at least in in my opinion)
I've migrated some projects from spring 2.5.6 to spring-3.1 without any major problems. I can't speak to spring-3.1.1, but if its a non-milestone release I would be comfortable upgrading myself.
Here's a link to spring-3.1 features: http://static.springsource.org/spring/docs/3.1.0.M2/spring-framework-reference/html/new-in-3.1.html
If you're moving up from 2.x to 3.x I don't see any reason why you would NOT upgrade to 3.1, even if you don't see immediate use for 3.1 features.
Yes, there are some minor differences between Spring 3.0 and 3.1, some of them are well documented through the book Pro Spring 3, basically the JPA support has been improved with helper features like the spring-data project, the support of some standard compliant Java EE annotations and the possibility to create beans "profiles" inside your xml configuration that can be handy when used alongside with maven, among others features.
Migrating from 2.0 to 3.x shouldn't be problematic if you stick to the old xml based configuration

Enterprise Application

I am thinking about a platform for study application (it is team work). I mean standard Java EE 5 (or maybe try raw Java EE 6) and Spring. What is your choose? (I don't mean Spring MVC but Spring Beans and EJB 3.0)
Also I would like to know what app server you use? (now I use GlassFish v2)
I would recommend Spring without EJBs.
My favorite choice of Java EE app server is WebLogic, but I don't know if Oracle is as generous as BEA was about making it available to developers.
I'd recommend using Tomcat as your app server. If you need JMS, add ActiveMQ.
As duffymo says, look at Spring without EJBs. Spring is very powerful, regardless of how much/little you use. I don't know of anyone using EJBs now. Having said that, EJBs have changed dramatically over the years, and now resemble ORMs such as Hibernate (which is worth checking out in itself).
For app servers, check out JBoss. It's free/open-source, and you can choose the web component between Tomcat and Jetty. It's JMX backbone allows you to easily monitor its state and to integrate your own JMX beans into that backbone (if you're using Spring, you can JMX-enable any bean with a simple configuration).
If you want Java EE 6 then the choice appears to be either Glassfish 3 or the beta of JBoss 6. As some of the others have said, I also prefer Spring to Java EE's EJBs.
I don't see much point in looking at Java EE 5, unless you think you will be working with it in the future (possible as some companies are conservative in using newer versions of technology).

Resources