posted 1 year ago
I'm trying to develop e very simple app based on a running thread creating entities in a DB every second in JavaEE on a Glassfish4 Server.
I'm using an Automatic Timer, where I inject an EJB managing the persistence.
The Timer Service is the following one:
While the EJB is:
But when I try to use the MeasureEJB in the UpdateEJB the app stops on the create method with measureEjb=null. What am I doing wrong?
I'm using an Automatic Timer, where I inject an EJB managing the persistence.
The Timer Service is the following one:
While the EJB is:
But when I try to use the MeasureEJB in the UpdateEJB the app stops on the create method with measureEjb=null. What am I doing wrong?
Sergio Torassa
Greenhorn
Posts: 6
posted 1 year ago
Yes, but when the MeasureEJB cannot be created it can also not be injected. I tried your code and it is perfectly working in my environment.
Try to put a PostConstruct method for the MeasureEJB:
and do you see the MeasureEJB being created?
But the problem cannot be in PersistenceContext, as the EntityManager.persist() method is not even called
Yes, but when the MeasureEJB cannot be created it can also not be injected. I tried your code and it is perfectly working in my environment.
Try to put a PostConstruct method for the MeasureEJB:
and do you see the MeasureEJB being created?
Sergio Torassa
Greenhorn
Posts: 6
Sergio Torassa
Greenhorn
Posts: 6
posted 1 year ago
I tried using the PostConstruct annotation also on the UpdateEJB and I don't find any log as well. So I think there is a more fundamental mistake I'm doing... And there is!! I found that when I deploy my war file in Glassfish the code is not updated. If I delete a System.out.println from the code, make a "mvn package" and then undeploy and redeploy the application, I still see the related logs in server.log Now I should rename this topics in "Issue redeploying war in Glassfish"... What could be the reasons?
Sergio Torassa
Greenhorn
Posts: 6
posted 1 year ago
I tried to deploy the app in another machine and everything works fine. Now I'd like to understand the strange behaviour in my first machine. I modified a string in my logs and then did a grep -rnw '/path to eclipse project/' -e "old string" and removed all the files. I did a 'mvn package' and deployed in Glassfish the target/<filename.war>. But I still see old logs. Why is Glassfish still keeping old code instead? How can I redeploy from scratch the app?

get schwifty. tiny ad:
Thread Boost - a very different sort of advertising
https://coderanch.com/t/674455/Thread-Boost-feature
|