[Datasource Configuration] - Jndi name of persistence unit (persistence.xml)
by Riddick Pu
Riddick Pu [http://community.jboss.org/people/kudlaty15] created the discussion
"Jndi name of persistence unit (persistence.xml)"
To view the discussion, visit: http://community.jboss.org/message/582688#582688
--------------------------------------------------------------
I am using Jboss EJB3/JPA integration to get Hibernate SessionFactory object defined in persistence.xml. I am able to inject SessionFactory to EJB by annotation @PersistenceUnit. But I have to use SessionFactory in one servlet. Here the problems begin. Injection to servlet not working and I cannot use spring injection becouse of the application architecture. Then in jboss logs I saw that automatically server bind SessionFactory described in persistence.xml to JNDI. So I can get SessionFactory object by InitialContext.lookup() and it's work. The problem is in name of the JNDI. Jboss automatically assign unacceptable and ugly name like: INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: persistence.unit:unitName=my_application.ear/my_application-service-1.1.2-JBOSS-SNAPSHOT.jar#hibernateUnitMyApplication. The name is very long and contains for example name and versions of jar and more unnecessary information. The question is HOW I CAN CHANGE THIS NAME? I know that I can use properties like: <property name="jboss.entity.manager.jndi.name" value="java:/Manager1"/> or <property name="jboss.entity.manager.factory.jndi.name" value="java:/Manager1Factory"/> in persistence.xml file to create global JNDI of my persistence unit. This solution is not satisfactory becouse the InitialContext.lookup returns EntityManager object while I want SessionFactory:( Please help:)
On this website You can read about cool Jboss EJB/JPA integration - http://bill.burkecentral.com/2007/07/06/co-existence-with-hibernate-jpa-a... http://bill.burkecentral.com/2007/07/06/co-existence-with-hibernate-jpa-a...
Correction - I have to use SessionFactory object in POJO:) That POJO class use servlet so getting SessionFactory can be "done at two levels" - servlet or pojo.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/582688#582688]
Start a new discussion in Datasource Configuration at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 2 months
[JBoss Messaging] - Messages get stuck in queues with JBoss Messaging cluster setup
by Yanyan Wang
Yanyan Wang [http://community.jboss.org/people/smilingsky] created the discussion
"Messages get stuck in queues with JBoss Messaging cluster setup"
To view the discussion, visit: http://community.jboss.org/message/582648#582648
--------------------------------------------------------------
We have an application that uses queues to connect different components. All the queues sit on a JMS server with their producers and consumers on remote servers. It works fine when we have just one JMS server. Now we want to create a cluster of JMS servers for load balancing and fail over. JBoss Clustering is successfully working. However, messages always get stuck in the queues, also it seems to be random on which queue they get stuck in.
Here is our setup:
- two JMS servers A & B, JBoss AS 5.1.0.GA with JBoss Messaging 1.4.3.GA
- Unique jboss.messaging.ServerPeerID per node (1 and 2 respectively)
- Both servers have queues deployed in farm, with Clustered=true
- Singleton consumer for each queue with message selector, it connects to the queue with the clustered JNDI port (A:1100,B:1100)
- Clustered connection factory is used, with supportsFailOver, supportsLoadBalancing both set to true.
- Based on https://issues.jboss.org/browse/JBMESSAGING-1713 https://issues.jboss.org/browse/JBMESSAGING-1713, added in the dependency on the connection factory for ClusterPullConnectionFactory on JMS servers so that message sucker is enabled to pull messages from one JMS server to another
Also, we found that the consistent way to get around this issue is just to shut down one JMS server, all the stuck messages will be failed over to the other server and get processed fine.
After reading this article (( http://community.jboss.org/docs/DOC-10095 http://community.jboss.org/wiki/JBMCluster), especially the last two notes in the article, my understanding is that our scenario cannot be achieved with JBoss messaging cluster since our singleton consumer may not be able to get all the qualified messages from remote server. Am I understanding it correctly? I have been digging this issue for quite a while, any suggestions and clarification would be greatly appreciated. Thanks!!
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/582648#582648]
Start a new discussion in JBoss Messaging at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 2 months