[EJB 3.0] - Re: MDB destination issues
by weston.priceï¼ jboss.com
anonymous wrote :
| In my deployment scenario I don't know the queue name (i.e. destination) until just prior of load time of my mdb's, i.e. it is unknown at compile time. Is there a way to solve this?
|
Not really. The connection consumer created for your deployment requires the destination to be provided. If you wanted to do a 'trick' I suppose you could provide the value of the destination in your ejb-jar.xml file as a property. At deployment time, JBoss will resolve a property reference to the correct system property. Example
| <destination>${some.destination}</destination>
|
If you take a look at the messagedriven tests in our testsuite, you can see an example of this. Note, for this to work, the name of the destination would have to be set as a system property somehow prior to your deployment. Note, I don't really recommend doing this as it's non standard behavior but it might get you by.
anonymous wrote :
| Also, there may very well be cases where messages that can be handled by the same mdb implementation arrive on different queues, is it possible to deploy an mdb multiple times to receive messages from separate queues?
|
You can't deploy the *same* MDB (ie the same MDB name) to multiple queues, but there is nothing to stop you from deploying the same MDB code with different EJB names to multiple destinations. Example:
| <ejb-name>XListener</ejb-name>
| <ejb-class>org.example.SomeMDB</ejb-class>
|
| <ejb-name>YListener</ejb-name>
| <ejb-class>org.example.SomeMDB</ejb-class>
|
|
Also, there is nothing to stop you from deploying multiple listeners to a single queue, but only one listener will receive a message, not both. Some people use this scheme as a 'poor man's' load balancing for a single destination.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4029135#4029135
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4029135
19Â years, 1Â month
[Installation, Configuration & Deployment] - ClassCastException: $Proxy?? problem
by ebross
I have spent a whole week trying to solve a problem without success. Frankly, I don't know what else to do except to turn for help here.
For development:
JDeveloper
JbossAS
Window 2003 Server
Components:
Entity bean(AddressEntity.java)
Session bean(AddressFacade.java)
Session bean interfaces(AddressFacadeRemote,java, AddressFacadeLocal.java )
JSF page(create.jsp)
JSF backing bean (Create.java)
Deployment:
foopojo.jar contain POJO and persitence.xml
fooejb.jar contains Session bean classes and jboss.xml
odmweb.war contains: jsp files, backing beans, jboss.web, faces-config.xml, web.xml etc.
odmapp.ear contains: foopojo.jar, fooejb.jar, fooweb.war, application,xml and jboss-app.xml
application.xml contains
|
| <module>
| <web>
| <web-uri>fooweb.war</web-uri>
| <context-root>fooweb</context-root>
| </web>
| </module>
| <module> <ejb>fooejb.jar</ejb> </module>
| <module><ejb>foopojo.jar</ejb> </module>
| </application>
|
The application is deployed as EAR (fooapp.ear) to jboss-4.2.0.CR1
I have in my backing bean ( Create.java ):
public String addButton_action() {
| try {
|
| //NOTE: addressEntity is property in this class
| addressEntity.setCreatedBy(user.getUserName());
| java.util.Date timestamp = new java.util.Date(System.currentTimeMillis());
| addressEntity.setDateCreated(timestamp);
| addressEntity.setDateLastModified(timestamp);
| addressEntity.setVersion(1);
| addressEntity.setHits(0);
| getAddressFacadeRemote().createEntity(addressEntity);
| info("Address was successfully created.");
| } catch (Exception ex) {
| ex.printStackTrace();
| error(ex.getLocalizedMessage());
| }
| return "address_create";
| }
|
| public AddressFacadeRemote getAddressFacadeRemote() {
| if(this.addressFacadeRemote == null){
| try {
| Context ctx = new InitialContext();
| //NOTE: RemoteJNDIName is "fooapp/AddressFacade/remote" in the session bean AddressFacade;
| //NOTE: Next is Line# 236 as reported in the exception thrown
| this.addressFacadeRemote = (AddressFacadeRemote) ctx.lookup(AddressFacade.RemoteJNDIName);
| }
| catch (NamingException e){
| throw new RuntimeException(e);
| }
| }
| return addressFacadeRemote;
| }
|
Create.jsp is an input form
1. I start the page
2. Fill the form
3. Click a button to process the data
4. The system check for error but there is no error to display
5. The system throws the following error:
08:49:33,578 ERROR [STDERR] java.lang.ClassCastException: $Proxy117
08:49:33,593 ERROR [STDERR] at com.xxx.vmo.foo.pojo.address.Create.getAddressFacadeRemote(Create.jav
a:236)
08:49:33,593 ERROR [STDERR] at com.xxx.vmo.foo.pojo.address.Create.addButton_action(Create.java:846)
08:49:33,593 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
I can't go past this error no matter what I try. I would appreciate any help.
Thanks in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4029132#4029132
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4029132
19Â years, 1Â month
[JBoss Seam] - Extended Persistence Context without EntityManager
by dan.j.allen
This may be a silly question, but bare with me. Is it possible to have an extended persistence context without using an EntityManager (rather a native Hibernate Session)? By that, I mean that you can retrieve an object, render the view, and on postback, the following will still be true, because the previous Session is restored.
conversationScopedObject == session.get(conversationScopedObject.getId());
The reason I ask is because I am trying to get an understanding of what Seam/EJB 3 provides that Seam/Hibernate does not. I want to avoid using a detached object to do basic CRUD, and to do so I would imagine that the best way is to use the extended persistence context (otherwise known as session-per-conversation pattern). I don't want to go hacking up a solution. I am interested to know if this is something that is supported by Seam without EJB 3. If it isn't, then I will understand why EJB 3 is necessary.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4029126#4029126
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4029126
19Â years, 1Â month