[EJB/JBoss] - EJB Running on JBoss Server
by russray
I have deployed my application on a JBoss server (4.0.5). I have two EJBs that has a reference to a static class called ServiceLocator, The EJBs use this class throughout the lifecycle of the object. The ServiceLocator is a Singleton. Within the ejbCreate method, I check for the ServiceLocator class. If it is null, I call ServiceLocator.getInstance().
My problem is understanding why JBoss does not like this static reference behavior. When I login to my application we go through EJB1. One of the things we do inside EJB1 is call other ejbs for addtional information. This is where the Service Locator becomes involved. Inside individual methods I use the ServiceLocator reference (sl) and fetch the appropriate EJB for use. The problem is the variable sl, is null when I attempt to use it within a business method. When I change the code to call the class like ServiceLocator.getInstance() everything is fine. Additionally, using a static initializer prevents the error, too. What I can see from the log files is the ejbcontainer is calling ejbRemove() just prior to calling the business method.
Can someone share their knowledge in this area? I was under the understanding that ejbCreate was the approach one should take for creating a instance/class-level variable. Having a class level variable seem to make sense and reduced the number of keystrokes in each EJB.
Thank you for taking the time to read and explain.
Russ
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3989656#3989656
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3989656
19Â years, 5Â months
[JBoss Seam] - Re: Error with SeamGen
by stealth_nsk
Yes, I was correct. The error is caused by Postgres arrays.
I think this isse needs to be fixed somehow. At least by skipping fields of non-standard types. Here is the generate class with array:
@Entity
| @Table(name = "tt", schema = "public", uniqueConstraints = {})
| public class Tt implements java.io.Serializable {
|
| // Fields
|
| private long id;
| private String name;
| private Serializable arr;
|
| // Constructors
|
| /** default constructor */
| public Tt() {
| }
|
| /** minimal constructor */
| public Tt(long id) {
| this.id = id;
| }
| /** full constructor */
| public Tt(long id, String name, Serializable arr) {
| this.id = id;
| this.name = name;
| this.arr = arr;
| }
|
| // Property accessors
| @Id
| @Column(name = "id", unique = true, nullable = false)
| @NotNull
| public long getId() {
| return this.id;
| }
|
| public void setId(long id) {
| this.id = id;
| }
|
| @Column(name = "name")
| public String getName() {
| return this.name;
| }
|
| public void setName(String name) {
| this.name = name;
| }
|
| @Column(name = "arr")
| public Serializable getArr() {
| return this.arr;
| }
|
| public void setArr(Serializable arr) {
| this.arr = arr;
| }
|
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3989651#3989651
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3989651
19Â years, 5Â months
[JBoss Seam] - Seam gen or seam framework problem?
by manuel.gentileï¼ itd.cnr.it
I have two table with a parten child relation (FK).
Both the table have an autoincrement integer column as PK.
Seamgen generate two entity with a one to many bidirectional relation.
After I have inserted a new instance of Parent Entity and I try to insert the relative child I have an exception related to this inner exception
| Caused by: org.jboss.seam.framework.EntityNotFoundException
| at org.jboss.seam.framework.Home.handleNotFound(Home.java:95)
| at org.jboss.seam.framework.EntityHome.find(EntityHome.java:66)
| at org.jboss.seam.framework.Home.initInstance(Home.java:80)
| at org.jboss.seam.framework.Home.getInstance(Home.java:68)
| at org.jboss.seam.framework.Home$$FastClassByCGLIB$$76f3c0be.invoke
|
How we have to work with autogenerated id?
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3989649#3989649
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3989649
19Â years, 5Â months