[jboss-user] [JBoss Seam] - Re: EntityManager not injected in onMessage method

2008-02-13 Thread rmcalderero
As a workaround, we have brought our code reading from the queue out of the 
onMessage method, an put it inside another asynchronous method periodically 
executed (quartz).

And now the entity manager is correctly being injected and we can merge our 
object. 

@Asynchronous
  | public void receiveMessage(@Expiration Date begin, 
  | @IntervalDuration Long 
interval) {
  | 
  | log.debug("Se ejecuta el Servicio de Resultados..");
  | 
  | try {
  | 
  | Message message = consumer.receiveNoWait();
  | 
  | if (message!=null) {
  | 
  | AnalisisCerrado ac = (AnalisisCerrado) 
((ObjectMessage) message).getObject();
  | ac = em.merge(ac);
  | .
  | 
  | }
  | }
  | 
  | }
So it seems there are some kind of issue in the way seam manages injection in 
onMessage methods (or at least we havent found any solution; as i explained we 
have a tipical JPA-tomcat configuration). I think seam people should take a 
look on this.

If any other people can give some feedback on the topic it will be highly 
appreciated.




View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4129013#4129013

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4129013
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: EntityManager not injected in onMessage method

2008-02-11 Thread rmcalderero
I tried adding manually the dependency on the entity manager in the listener 
class, but got the same exception...

In component:
@Name("servicioResultados")
  | @Scope(APPLICATION)
  | @Startup(depends={"em"})
  | public class ServicioResultados implements MessageListener {
  | .

The exception:

  | 12:17:22,567 DEBUG [ServicioResultados] Se ejecuta el Servicio de 
Resultados: Nuevo mensaje..
  | 12:17:22,567 WARN  [ActiveMQMessageConsumer] Exception while processing 
message: java.lang.NullPointerException
  | java.lang.NullPointerException
  | at 
org.fundacionctic.tawmonitor.servicios.ServicioResultados.onMessage(ServicioResultados.java:113)
  | at 
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:854)
  | at 
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:99)
  | at 
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:166)
  | at 
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:117)
  | at 
org.apache.activemq.thread.PooledTaskRunner.access$100(PooledTaskRunner.java:26)
  | at 
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:44)
  | at 
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
  | at 
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
  | at java.lang.Thread.run(Unknown Source)
  | 
  | 

The strange thing about this is that in an asynchronous method (configured with 
quartz) of other component (also application scoped), we read from db with the 
em and we send a message to the queue. And its working ok. However the listener 
method of our serviceReader component is not receiving the entity manager when 
executed. So i also think it has something to do with the way Seam manages 
MessageListener components (at least in a non EJB enviroment).

We also tried to move the inicialization of our servicioResultados component to 
a method observing the seam postInitialization event:

@Observer("org.jboss.seam.postInitialization")
  | public void postInitialization() {
  | 
  | servicioResultados.config();
  | ...
  | 
But again the same problem.

I think this is a quite typical scenario, so i hope someone can give some 
insight on this issue.


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128322#4128322

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128322
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: EntityManager not injected in onMessage method

2008-02-10 Thread rmcalderero
We have not used any datasource.xml so far. 
Below the persistence.xml

  | http://java.sun.com/xml/ns/persistence"; 
  |  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  |  xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"; 
  |  version="1.0">
  | 
  |
  |
  |   org.hibernate.ejb.HibernatePersistence
  | 
  | 
  | org.fundacionctic.tawmonitor.model.Analisis
  | ..
  | 
  | 
  |   
  | 
  |  
  |  
  |   
  |  
  |  
  |  
  |
  |   
  |  
  |  
  | 
  | 
  | 
  | 
  | 
  | 
  |  
  |  
  |   
  |
  | 
  | 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128201#4128201

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128201
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: EntityManager not injected in onMessage method

2008-02-10 Thread rmcalderero
No. The configuration we used is copied from the jpa example of the booking 
application. Something like this:

Components.xml

  | .
  | 
  | 
  | 
  | 
  | 
  | ..

And as i said, this is been working correctly so far for our application.  

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128159#4128159

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128159
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - EntityManager not injected in onMessage method

2008-02-09 Thread rmcalderero
This is our first Seam application (Seam 2.0.0 GA on Tomcat 6) and we need now 
to persist in DB the data received from a jms queue.

The jms connection works ok but then we get a NullPointerException in the last 
line bellow, because the entity manager is not been injected

Are we missing something? In other asynchronous calls in other methods
in the project the entity manager is been injected correcly. Any help would be 
appreciated.

Our class: 

  | @Name("serviceReader")
  | @Scope(APPLICATION)
  | @Startup
  | public class ServicioResultados implements MessageListener {
  | 
  | @In
  | private EntityManager em;
  | 
  | @In(value = "JMSConnectionFactory")
  | ConnectionFactory connectionFactory;
  | 
  | .
  | 
  | @Create
  | public void init() {
  | 
  | try {
  | connection = connectionFactory.createConnection();
  | connection.start();
  | 
  | session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
  | 
  | .
  | 
  | public void onMessage(Message message) {
  | 
  | log.debug("Se ejecuta el Servicio de Resultados: Nuevo 
mensaje..");
  | 
  | try {
  | AnalisisCerrado ac = (AnalisisCerrado) ((ObjectMessage) 
message).getObject();
  | ac = em.merge(ac);
  | 
  | 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128100#4128100

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128100
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Richfaces with Maven and Tomcat 6

2008-01-02 Thread rmcalderero
Hello,

Is there any working 'mavenized' seam application with richfaces as one of its 
dependencies?

I've tried different dependencies in the pom based on some non official blogs, 
but none worked. Maybe some can provide one.

Our app was based on the jboss-seam-jpa example and is deployed under tomcat6. 
The app runs ok when the jars are included manually.

pom.xml

  | 
  | http://maven.apache.org/POM/4.0.0";
  | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
  | 
  |   4.0.0
  |   org.fundacionctic.seam
  |   monitor
  |   war
  |   monitor
  |   0.1
  |   http://fundacionctic.org
  | 
  |   
  | 
  | 
  | monitor
  | 
  | 
  | maven-war-plugin
  | 
  | 
WebContent
  | 
  | 
  | 
  | 
  | org.apache.maven.plugins
  | maven-compiler-plugin
  | 
  | 1.5
  | 1.5
  | utf8
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | jboss.org
  | jboss.org
  | http://repository.jboss.com/maven2
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | junit
  | junit
  | 3.8.1
  | test
  | 
  | 
  | 
  | 
  | org.testng
  | testng
  | 5.0
  | jdk15
  | test
  | 
  | 
  | 
  | javax.servlet
  | servlet-api
  | 2.5
  | test
  | 
  | 
  | 
  | javax.el
  | el-api
  | 1.0
  | test
  | 
  | 
  | 
  | 
  | org.jboss.seam
  | jboss-seam
  | 2.0.0.GA
  | 
  | 
  | el-api
  | javax.el
  | 
  | 
  | 
  | 
  | 
  | org.jboss.seam
  | jboss-seam-ui
  | 2.0.0.GA
  | 
  | 
  | el-api
  | javax.el
  | 
  | 
  | 
  | 
  | 
  | org.jboss.seam
  | jboss-seam-debug
  | 2.0.0.GA
  | 
  | 
  | servlet-api
  | javax.servlet
  | 
  | 
  | el-api
  | javax.el
  | 
  | 
  | 
  | 
  | 
  | org.jboss.seam
  | jboss-el
  | 2.0.0.GA
  | 
  | 
  | el-api
  | javax.el
  | 
  | 
  | 
  | 
  | 
  | org.jboss.seam
  | jboss-seam-mail
  | 2.0.0.GA
  | 
  | 
  | 
  | 
  | org.hibernate
  | hibernate-validator
  | 3.0.0.ga
  | 
  | 
  | 
  | org.hibernate
  | hibernate-annotations
  | 3.3.0.ga
  | 
  | 
  | 
  | org.hibernate
  | hibernate-entitymanager
  | 3.3.1.ga
  | 
  | 
  | 
  | 
  | org.springframework.ldap
  | spring-ldap
  | 1.2
  | 
  | 
  | 
  |   com.sun
  |   ldapbp
  |   1.0
  |
  | 
  | 
  | 
  |