[JBoss-user] [EJB/JBoss] - Re: JBoss problem? Or Entity Bean's problem?

2005-07-26 Thread jamesstrachan
Brian, Surely the problem has very little to do with JBoss or EJB's. Both Entity Beans and Message Driven Beans operate in a transaction context set by the EJB server. So, when your entity bean reads row #0 (or whichever), it takes a database lock on this row in case the entity bean intends to

[JBoss-user] [EJB/JBoss] - Re: Worker thread count

2005-05-10 Thread jamesstrachan
Andy, This sort of problem is always a real hassle. I don't know the Tomcat internals at all. You may be able to switch on Log4J logging for some of the Tomcat internal classes to get a clue. The timing of the problem - after days of application usage - strongly suggests a problem somewhere w

[JBoss-user] [EJB/JBoss] - Re: Worker thread count

2005-05-09 Thread jamesstrachan
Andy, This feels like (but may not be) the problem of not properly releasing a connection after use. I assume that you are using BMP. Your code should look like :- | public void ejbLoad() { | | Connection conn = null; | PreparedStatement statement = null; | InitialCon

[JBoss-user] [J2EE Design Patterns] - Re: send messages from Statefull to anoteher one.

2005-04-08 Thread jamesstrachan
I don't know why you need two stateful session beans. Most design problems resolve themselves to stateless session beans that invoke operations on (or send messages to) entity beans that represent the business data. You should be able to send messages to the consumer session bean B by producer

[JBoss-user] [EJB/JBoss] - Re: What sort of a bean, if any sort of bean, for a custom d

2005-03-31 Thread jamesstrachan
Also see this discussion on February 14th. in the design patterns area :- http://www.jboss.com/index.html?module=bb&op=viewtopic&t=60216 James View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3872044#3872044 Reply to the post : http://www.jboss.org/index.html?

[JBoss-user] [J2EE Design Patterns] - Re: JBoss Mail

2005-03-20 Thread jamesstrachan
I would suggest Eclipse (free) with the JBoss plugin. See the separate forum on Eclipse. If you adopt Eclipse, make sure that you install a stable, tested version. Don't use alpha or beta releases. James View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=38708

[JBoss-user] [EJB/JBoss] - Re: Stateless Session Bean versus static method calls

2005-03-12 Thread jamesstrachan
Static method calls are a very useful tool but have limitations. You cannot access a static method from outside the JVM in which the class resides. And there are potential concurrency issues if your static methods access shared data. One thread may change data on which another thread relies.

[JBoss-user] [EJB/JBoss] - Re: Reloading stateless session beans programmatically in JB

2005-03-11 Thread jamesstrachan
There isn't a good way to reload stateless Session Beans, and there isn't meant to be. Suggestions :- a)Move the read only data from the Session Beans to a singleton Java class within the application Server. Reload data in the Singleton either when a timestamp expires or by touching the s

[JBoss-user] [J2EE Design Patterns] - Re: Database access from the web tier

2005-02-23 Thread jamesstrachan
Hi, See also my response to your other query. Direct access from the web tier is probably undesirable because it breaks the model and will probably make it difficult to generate ther correct HTML within Struts. A better solution is to introduce an application server tier and to store the vari

[JBoss-user] [J2EE Design Patterns] - Re: Web tier - App tier separation

2005-02-23 Thread jamesstrachan
Hi. If anybody has firm metrics on this, they are keeping them to themselves. There are definite advantages in introducing an application tier. It allows you to set up entity beans representing validation data (see your other query) which greatly reduces the load on the database and thus respo

[JBoss-user] [EJB/JBoss] - Re: Removing a Stateless Session Bean

2005-02-19 Thread jamesstrachan
Kalyan, I'm not quite sure where you are coming from. The code sample that you include won't compile (attribute home is not defined). The class is not a session bean (doesn't implement the SessionBean interface). The class is not a singleton (doesn't have a private constructor and a getInstanc

[JBoss-user] [J2EE Design Patterns] - Re: global config file design pattern

2005-02-19 Thread jamesstrachan
kevliang, I think that everything you suggest will work, except that I don't know whether you can register an mbean with JNDI. I have found it possible to use an entity bean as a singleton by defining a single constant value as the primary key. The constant value is defined somewhere in the p

[JBoss-user] [EJB/JBoss] - Re: EJB QL and time comparison

2005-02-10 Thread jamesstrachan
An alternative approach is to strip all the time information from the date before storing the date in the database. This works well in commercial applications but may not suit your application. James View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3866049#386

[JBoss-user] [EJB/JBoss] - Re: remote call from jboss 4.0.1 (client) to jboss 3.2.3 (se

2005-02-09 Thread jamesstrachan
James, This problem comes up quite frequently. Java requires the serialVersionUID of the class to be identical on the object sent across the network by RMI and the locally loaded class that is meant to rebuild the object. As you are using two different versions of JBoss, you are getting difere

[JBoss-user] [J2EE Design Patterns] - Re: Facade to embeded database or something?

2005-01-14 Thread jamesstrachan
Hi, Don't worry too much. Apache Derby is IBM (ex Sybase) Cloudscape donated to the open source community and rebadged. If you use stand alone processes, only one process can access Cloudscape/Derby databases - as you know. But IBM also provided a server that would allow multiple connections,

[JBoss-user] [EJB/JBoss] - Re: One BMP for several postgresql tables

2004-12-13 Thread jamesstrachan
Well Nicolas, BMP won't go back to reload from the database because it sees a primary key "2" that it believes that it has already loaded. I suggest that you prefix each ID field in the BMP entity bean with the name of the table as below :- table1/2 | table2/2 | This gives each combinati

[JBoss-user] [EJB/JBoss] - Re: Removing a Stateless Session Bean

2004-11-04 Thread jamesstrachan
Brian, It doesn't quite work like that ! With Stateless Session Beans, the container maintains a pool of Stateless Session Beans in the container. Each client instance that calls a method on the SSB is handed a reference to one of the idle SSB's in the pool. So there should never be two clien

[JBoss-user] [EJB/JBoss] - Re: Entity Perfomance(The Proper way)

2004-11-02 Thread jamesstrachan
Presumably you are using CMP. My guess is that the client.getOrders().iterator() statement is getting a set of Primary Keys for the order. As you progress through the iterator, each order in turn is loaded in a separate SQL statement. So, for n orders, the application is making n+1 SQL operati

[JBoss-user] [EJB/JBoss] - Re: Why an ejbLoad() call for each get* method?

2004-10-28 Thread jamesstrachan
This is one that comes up regularly, and there are several areas that you need to check. The fact that you are getting two ejbLoad() calls and one ejbStore() call suggests that the entity bean may not be taking part in the transaction that you have declared. Check in the deployment descriptor

[JBoss-user] [J2EE Design Patterns] - Re: Managing access to hierarchies

2004-10-06 Thread jamesstrachan
Villo, A cursory look at OJB suggests that it should successfully load and store objects of the different classes. My approach to this problem would be to create an abstract super class above all the actual user classes. so you have a hierarchy :- | public abstract class AbstractUser {

[JBoss-user] [EJB/JBoss] - Re: Concurrency and Entity EJBs

2004-10-04 Thread jamesstrachan
So we are envisaging a posdition where SLSB C1 calls in turn A, B, C, D and then calls B again. Meanwhile SLSB C2 has deleted B. You can do one of several things :- | 1. By locking A,B,C and D in a transaction you can prevent C2 deleting B. | 2. Your code can anticipate and recover fro

[JBoss-user] [EJB/JBoss] - Re: Concurrency and Entity EJBs

2004-10-03 Thread jamesstrachan
But it is usually a bad idea to make the solution more complex than the problem. I normally stamp an object with the username of the interested user. This allows me to produce error messages such as :- | Order H0013 is locked by user jamesstrachan | The users involved can then sort it

[JBoss-user] [EJB/JBoss] - Re: Bean Managed Persistence and ejb method mappings.

2004-09-29 Thread jamesstrachan
Iain, Pleased to help. The commit-option of A, B or C controls reading from the database (not writing). If you go the Wiki page and searcvh for "commit option", you will find a page that explains this. James View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3

[JBoss-user] [EJB/JBoss] - Re: Bean Managed Persistence and ejb method mappings.

2004-09-28 Thread jamesstrachan
Iain, Going through your topics in order :- Method names create, load, store, findByPrimaryKey and remove in the remote interface are remapped by the container to ejbCreate() etc. Presumably this is to make sure that the container can perform operations such as storing an in-memory copy, looki

[JBoss-user] [EJB/JBoss] - Re: Accessing business methods from EJB

2004-09-20 Thread jamesstrachan
Sanju, I think that I see where you are having a problem. The create() method on an entity bean does real work - it creates an object and persists it. The create() method on a session bean creates the session bean (which may initialse variables etc.) but doesn't create the underlying object.

[JBoss-user] [EJB/JBoss] - Re: Many small EJB's vs large EJB

2004-09-16 Thread jamesstrachan
James, I'll dig siomething out and post - but not till I get back home at the weekend ! James View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3848452#3848452 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3848452 -

[JBoss-user] [EJB/JBoss] - Re: Accessing business methods from EJB

2004-09-16 Thread jamesstrachan
Sanju, If the deployment script is for a Session Bean, then it will prevent anybody who does not have a role of "system" from accessing the bean. If "HelloAssyt" was an entity bean representing persistent data (which seems unlikely from the name of the EJB and the method name), it would allow a

[JBoss-user] [EJB/JBoss] - Re: Accessing business methods from EJB

2004-09-15 Thread jamesstrachan
Sanju, You need to get the remote interface to execute any business methods. So, if you don't have permission to execute the ejbCreate() method, you can't get the remote interface and you can't execute a business method. Don't forget that stateless and stateful session beans behave in a differe

[JBoss-user] [EJB/JBoss] - Re: Many small EJB's vs large EJB

2004-09-15 Thread jamesstrachan
Dave, The trouble is that the answer is "it depends", not least because it depends on what you are doing with the EJB's. At one extreme, you may be using a set of session beans that have a little business logic and JDBC statements to interact with the database. In that environment, it probabl

[JBoss-user] [EJB/JBoss] - Re: transaction rollback instead of wait

2004-09-08 Thread jamesstrachan
I guess that you could get a race between MDB2 starting and MDB1 committing if (a) you use a file based JMS persistence manager and (b) you are not including the JMS messages in the transaction. Then it is possible for the thread running MDB2 to start before the thread in MDB1 has finished. Th

[JBoss-user] [EJB/JBoss] - Re: transaction rollback instead of wait

2004-09-08 Thread jamesstrachan
It's very difficult to tell what is happening here. It could be a database locking problem. You can test this using SQL commands outside the application server. Or it could be a JBoss locking problem, as JBoss also operates a locking strategy on entity beans. Or it could be a locking problem

[JBoss-user] [EJB/JBoss] - Re: why i can't invoke bmp method

2004-08-20 Thread jamesstrachan
You found the bug, not me. I missed that one. James View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3845777#3845777 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3845777 --

[JBoss-user] [EJB/JBoss] - Re: why i can't invoke bmp method

2004-08-20 Thread jamesstrachan
Are you getting any errors when you deploy the jar file ? If you get any messages similar to :- Instance of primary key not located that would indicate a problem. And are you getting any error messages or stack traces when you call the ejbCreate() method ? James View the original post : ht

[JBoss-user] [EJB/JBoss] - Re: why i can't invoke bmp method

2004-08-19 Thread jamesstrachan
Although you are returning an AccountPK object from your ejbCreate() method, you are not storing an AccountPK object inside the Entity Bean itself. So JBoss cannot locate or handle the Entity Bean. You need to add as shown below :- | System.out.println("ejbCreate() Called."); |

[JBoss-user] [EJB/JBoss] - Re: Performance issue , 2 local String getXXX(32Byte) take

2004-08-04 Thread jamesstrachan
If we take out the timing code, what you are doing is :- | For each entry in index { | Get entity bean for index | Get ID | Get value | } | Getting the entity bean involves network I/O, and also requires that the server works to create the Entity Bean and to load its dat

[JBoss-user] [EJB/JBoss] - Re: OutOfMemoryError - Singleton PK Generator

2004-07-29 Thread jamesstrachan
You are suggesting three alternatives :- 1. Restart from 1 after each purge; 2. Use a unique generated number - a GUID (Global Unique ID); 3. Use a two part number. All three are workable, although (2) would probably meet serious resistance from users. They like to see understandable, sequen

[JBoss-user] [EJB/JBoss] - Re: Same SLSB with different jndi name and different env-ent

2004-07-29 Thread jamesstrachan
Therion, You need to use a different EJB name as well as a different JNDI name. The partial deploymeent descriptor below is an example :- | | Audit Logging SSB | AuditLoggingReceiver | com.syntegra.nhs.nasp.tms.logging.LoggingReceiverHome | com.syntegra.nh

[JBoss-user] [EJB/JBoss] - Re: How to implement a global persistent singleton in a stat

2004-07-25 Thread jamesstrachan
Adrian, I suspect that you will need to code and deploy your socket link to COM as a JMX MBean - rather like a database source. But I've never tried this. Anyone from JBoss who can contribute ? James View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3843204#3

[JBoss-user] [Installation & Configuration] - Re: Log4J configuration (again!)

2004-07-21 Thread jamesstrachan
Try something like this, which uses package names to separate the streams :- | |etc. | | | |etc. | | | | | | | | | | | | | The example is incomplete but shows the principle. All events fron classes in packages commencing "co

[JBoss-user] [EJB/JBoss] - Re: Multiple EJB deployments with same name

2004-07-21 Thread jamesstrachan
Phil, What I think is happening is this :- Your reference in the ejb link shows that you are expecting to look up an EJB with a JNDI name of Customer. You can confirm in the JNDI view, or in the MBean view, that you are actually deploying one entity bean with the JNDI name Customer. Assuming

[JBoss-user] [EJB/JBoss] - Re: Multiple EJB deployments with same name

2004-07-21 Thread jamesstrachan
Phil, It would seem that both EJB's have the same JNDI name. Deployment of the second EJB overwrites the first JNDI name so that only the second is referenced. Presumably, as the deployer, you haver control of the Deployment Descriptors. You can do one of two things. Either change the ejb-ref

[JBoss-user] [EJB/JBoss] - Re: Is this a bug? stateful session bean is acting like stat

2004-07-21 Thread jamesstrachan
This requires a longer explanation. For stateless session beans, JBoss uses a pool of beans and supplies the client with any instance. In a idle system (normal developer mode), JBoss will create a pool with one instance and give you that instance on each call. Your client does a create() and t

[JBoss-user] [EJB/JBoss] - Re: EJB's + Java Preferences

2004-07-19 Thread jamesstrachan
The timer code is, as you have guessed, in the onMessage() method. The timeout is checked before doing work so that anything out of date can be refreshed. You can then read directly from Preferences, a Properties file, or an Entity bean as I suggested. You may have problems reading a file as t

[JBoss-user] [EJB/JBoss] - Re: EJB's + Java Preferences

2004-07-16 Thread jamesstrachan
Let's start with the timer, as that's simple. You use an environment variable in the deployment descriptor to set a reload interval in seconds. You then read that and covert it to milliseconds | | Integer temp = context.lookup( "java:comp/env/ReloadInterval"); | reloadInterval = temp.get

[JBoss-user] [EJB/JBoss] - Re: EJB's + Java Preferences

2004-07-15 Thread jamesstrachan
I would suggest :- Use an Entity Bean to hold the configuration data. This will give you persistence. The Entity Bean can be either a singleton (see earlier discussion) or a set of Entity Beans with a key for each parameter. The Entity Bean can then be updated from a web client or Java clien

[JBoss-user] [Security & JAAS/JBoss] - Re: Drivel design?

2004-07-13 Thread jamesstrachan
Roll, The first thing to release is that, once you apply security, ALL EJB method calls must be accompanied by principal and credentials. Your client (assuming that it is a heavy client) has to store principal and credentials in the client context and supply these with every call. You could w

[JBoss-user] [EJB/JBoss] - Re: How to map a single BMP instance with multiple rows retu

2004-07-08 Thread jamesstrachan
Vishal, Have a look at the discussion chain on topic :- http://www.jboss.com/index.html?module=bb&op=viewtopic&t=50863 That provides a complete solution to a similar problem with two differences. Diff. 1 That problem was for a singleton solution, in which only one Entity Bean exists in the

[JBoss-user] [EJB/JBoss] - Re: Marking transactional boundaries

2004-07-07 Thread jamesstrachan
Gareth, The EJB Specification mandates that (a) ejbLoad() must be called before a business method in a transaction is executed, and that (b) ejbStore() must be called after a business method is executed. a) is designed to prevent a business method in a transaction being executed on data that

[JBoss-user] [EJB/JBoss] - Re: OutOfMemoryError - Singleton PK Generator

2004-07-02 Thread jamesstrachan
I forgot to mention that the next ticket number bean should also implement the "Singleton EJB" pattern as you should enforce a rule that only one component issues next numbers. I suggest that you persist the last number used. You should then get a uniformly fast response to each query, at the

[JBoss-user] [EJB/JBoss] - Re: JavaBean passing to a session between two different VM

2004-06-30 Thread jamesstrachan
Elementaries 1. Check that there is no transient modifier on variables in the Javabean. 2. Check that the Javabean class, and any classes that it references, are on the classpath in the remote JVM. 3. Supply sample code for servlet, Javabean and session bean to see if anybody can spot a

[JBoss-user] [EJB/JBoss] - Re: OutOfMemoryError - Singleton PK Generator

2004-06-30 Thread jamesstrachan
John, If I had known you were going to do this, I would have given you different advice ! You are obviously running out of memory in the heap because of the number of integer ticket numbers stored and the overheads (hidden to you) of the objects in the tree set. You can increase the size of the

[JBoss-user] [EJB/JBoss] - Re: EJB Deployment

2004-06-27 Thread jamesstrachan
I don't know whether you are trying to deploy a session bean or entitry bean, but here is an example of both xml descriptors that works. | | Fragment from ejb-jar.xml | | | Menu Option Use Case Session Bean | milton/appmenu/optionmaint | org.mil

[JBoss-user] [EJB/JBoss] - Re: EJB creation fails after server restarts

2004-06-27 Thread jamesstrachan
I have tested this on another J2EE server (no names, no pack drill) and found that the home interface appears to contain data specific to the server instance - perhaps a memory address or object within the server. Stopping and restarting the server makes this reference invalid, leading to the er

[JBoss-user] [EJB/JBoss] - Re: Which Bean fits this scenario?

2004-06-27 Thread jamesstrachan
John, >From your description, what you need is an entity bean that contains the entire list >of numbers. The bean acts as a singleton (if you know the Gang of Four book) with only one bean ever present in the server. You enforce the singleton rule by using a published primary key with a const

[JBoss-user] [EJB/JBoss] - Re: how can I keep a kind of

2004-06-16 Thread jamesstrachan
Brace yourselves, here is the complete code :- | //Package: Security Objects | //Class:SecurityRoleSetBean | //Version: 1.0 | //Copyright:Copyright (c) 2002 | //Author: James Strachan | //Company: Milton Software Components | //Description: Entity B

[JBoss-user] [EJB/JBoss] - Re: jndi lookup/referencing question

2004-06-15 Thread jamesstrachan
Nano, I have just had to deal with a very similar problem in another application server. I would suspect that your home reference, which you get as you initialise the servlet, contains internal information which becomes out of date when your colleague does a hot deploy. This will then lead to

[JBoss-user] [EJB/JBoss] - Re: how can I keep a kind of

2004-06-15 Thread jamesstrachan
David, I would suggest that you use an Entity Bean that contains the contents of the view. The Entity Bean should have an artificial key, as shown below, so that one and only one instance ever exists. /** * This static string will be used to define the key for the Singleton Role Set. */