In Tomcat, session manager attribute can be given in the context.xml of server.So in JBoss where it can be given - standalone.xml ? Does it support Context descriptor ?
Thanks in Advance
Try this,
create an implementation of the org.jboss.as.clustering.web.DistributedCacheManagerFactory interface (and all dependent interfaces)
create a module that defines a META-INF/services/org.jboss.as.clustering.web.DistributedCacheManagerFactory file that points to your implementation
replace the default implementation (org.jboss.as.clustering.web.infinispan) in $JBOSS_HOME/modules/org/jboss/as/clustering/web/spi/main/module.xml with your custom module.
There are now 2 msm jars you have to put into lib: the core msm jar and the jboss specific one:
http://dl.dropbox.com/u/1439289/msm-all-memcached-session-manager-1.5.0-SNAPSHOT.jar
http://dl.dropbox.com/u/1439289/msm-all-memcached-session-manager-jbossweb2-1.5.0-SNAPSHOT.jar
source links look this and this
Related
The project artifact structure is:
test.ear
--lib - has all log4j2 jars core, web, bridge and JCL
--META-INF -- has app.xml, JBoss specific deployment XML, and manifest file
--a.war -- each war has web.xml with log4jConfiguration and Log4jServletContextListener specified.
--b.war
--c.war
The war creates context with log4jConfiguration, which is "classpath:test.xml". I can see each war creating the context with log4jContextName I have provided in web.xml.I have a few crons, too, which run based on configured time intervals. When crons run, and many of the JMS process run, I observed the log files are not populated with logs(From project-specific classes). While going through the log4j2 code, I understood that log4j2 creates a context for each classloader. And in my case, it creates a context for "test.ear", which is defaulted to error(DefaultContext) as it is not able to find a default log4j2.xml since I have a custom named(test.xml) on in the classpath. The Log4jServletContextListener does not catch the "test.ear" event.
How to inject my "classpath:test.xml" while log4j2 creates a context for the ear file? Since my project can be both deployed to WebSphere and JBoss, I am looking forward to suggestions that are not server-specific. Or is there a way to create a single context for all the war and ear somehow? I have different apps outside this ear in same server so I cannot give an environmental config of -Dlog4j.configurationFile as other apps have there own log4j2 xml's.
One approach that I can think of is to place your log4j config file test.xml in a shared library and configure your application to use the shared library.
The following link describes how to configure a shared library for a server or an enterprise application on WebSphere.
https://www.ibm.com/support/pages/how-create-shared-library-and-associate-it-application-server-or-enterprise-application-websphere-application-server
The shared library should be a generic function for modern Java app servers, so JBoss should also be able to configure this.
Is there a way to perform a communication between WARs within an EAR deployment archive in such a way that it would be possible not just to make usage of JSF Managed Beans (annotated as #ManagedBean or #Named) as well as Facelets resources from one WAR to another and vice-versa?
The JEE container used is the Wildfly 12.
Our project's structure is similar to the following one:
EAR
A.war
B.war
ejb.jar
I've read some articles mentioning the shared session configuration inside jboss-all.xml file descriptor.
Some other articles suggests the ear-subdeployments-isolated usage set to false in the jboss-deployment-structure.xml file descriptor.
Are there other ways to achieve that rather than the suggestions above? More over, is that possible to achieve such communication?
Thanks.
It seems that Liberty uses the default JNDI namespace. I've been using it, and it works fine.
However, I have a utility JAR that I'd like to use (I cannot change it). This external jar does a lookup for a JNDI name like this:
"java:comp/env/jdbc/MAINDB"
Is there a way to declare this name in my application, so that I can use this JAR?
That is a resource ref lookup. Assuming you are in an EE Web or EJB context when you call that code you can simply define a resource-ref in the web.xml or ejb-jar.xml for the calling web or ejb module.
I am using Resin 3.1.9 to run Java Web Application with JPA 2.1.
I have put libraries (JAR) on my WEB-INF/lib folder, and I have include them to resin.conf by this:
<class-loader>
<tree-loader path="${resin.root}/webapps/myapp/WEB-INF/lib"/>
</class-loader>
If I didn't include it in resin.conf, I saw an exception about failed to load some classes (even when in first loading on home page).
OK now when loading home page it is no problem, but I wonder when I try to add some record (via CRUD form), it said:
java.lang.NoClassDefFoundError: javax/persistence/spi/PersistenceProvider
In fact, class javax.persistence.spi.PersistenceProvider is absolutely exist in "WEB-INF/lib" which is in file "hibernate-jpa-2.1-api-1.0.0.Final.jar"
Is there any debugging step how to check loaded libraries during Resin startup?
Or is there something wrong in my resin.conf?
EDIT
After some investigations, it seems my suggestion of an SPI problem is wrong: double JPA implementations not properly declared raise a PersistenceException.
This is probably not a class loading problem but rather an SPI problem. Have you checked the provider element for hibernate in your persistence.xml ? This should be something like this :
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
Perhaps you should also mention an SPI declaration, but you should only do so if you have multiple implementations available. This is probably the case because of the JPA implementation of your Java EE web profile server.
In such a case, you should add a services folder in your META-INF folder and create a javax.persistence.spi.PersistenceProvider text file inside.
This file should list the two persistence provider implementations (hibernate and the one included in Resin, I don't find it in the documentation).
I know how I'd do this using JBoss: create a *-ds.xml file, and drop it into my deploy directory.
Is there a declarative way to do the same with GlassFish (v3.1)?
Am I thinking about this the wrong way? (See next question)
Is there a more-Glassfishy way to get my Java EE application to talk to a database?
Other potentially-revelant info:
I want to connect to a SQL Server 2008 database
I'm using Eclipse + GlassFish Server Tools
I know next to nothing about GlassFish. I'm much more familiar with JBoss
You can define it in application.xml or ejb-jar.xml of your EAR. You can even use annotations.
Long answer short: DataSource Resource Definition in Java EE 6.
BalusC is right (+1), with Java EE 6 you can declare datasource definitions either through annotations or through the use of deployment descriptors in a standard and portable way.
Just in case you'd be also interested by creating other resources than datasources like JMS resources, you can also package a glassfish-resources.xml file as part of your application. See:
Supporting glassfish-resources.xml
4.1.3 Application scoped resources