Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adjusting ejb-jar.xml settings with Admin UI

 
Terry Jeske
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am fairly new to WS, and am working on an application where a previous developer added code that looked at the ejb-jar.xml file for settings. I guess the hope was/is that certain values can be adjusted w/o a redeploy. However, I cannot find any place on the production environment to adjust these values. Does anyone know if it is possible to ajust these values through some sort of UI on the Admin Console? (our client wants to fiddle with some settings).
TIA
 
Rufus BugleWeed
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most of the settings in ejb-jar.xml and web.xml are modifiable through the normal administration or deployment of an application. If you would list the code where the developer performed data driven development, I think we could tell you how to mod the app or appserver.
 
Terry Jeske
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi thx for the response,
Still getting my feet wet with WS, so I am not quite sure what you were asking for. Here is the node in the ejb-jar.xml entry. the value that is being read is for blockSize.
<session id="SequenceSession">
<ejb-name>SequenceSession</ejb-name>
<home>il.dba.ejb.sb.SequenceSessionHome</home>
<remote>il.dba.ejb.sb.SequenceSession</remote>
<ejb-class>il.dba.ejb.sb.SequenceSessionBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<env-entry id="EnvEntry_14">
<env-entry-name>blockSize</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>10</env-entry-value>
</env-entry>
<env-entry id="EnvEntry_15">
<env-entry-name>retryCount</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>5</env-entry-value>
</env-entry>
</session>
It is read using the following method in SequenceSessionBean.java
/**
* setSessionContext
*/
public void setSessionContext(javax.ejb.SessionContext ctx) {
mySessionCtx = ctx;
try {
javax.naming.Context namingContext = new javax.naming.InitialContext();
Object o1 = namingContext.lookup("java:comp/env/blockSize");
Object o2 = namingContext.lookup("java:comp/env/retryCount");
_blockSize = ((Integer) namingContext.lookup("java:comp/env/blockSize")).intValue();
_retryCount = ((Integer) namingContext.lookup("java:comp/env/retryCount")).intValue();

_sequenceHome = (il.dba.ejb.eb.SequenceHome) namingContext.lookup("il/dba/ejb/eb/SequenceHome");
}
catch(javax.naming.NamingException e) {
throw new javax.ejb.EJBException(e);
}
}
Hope that is what you were looking for.
 
Rufus BugleWeed
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In ejb-jar.xml these are in DTD syntax
<!ELEMENT env-entry (description?, env-entry-name, env-entry-type,
env-entry-value?)>
where in your case something like
env-entry-name == blockSize
env-entry-type == java.lang.Integer
env-entry-value == 10
Normally this value is set at deployment.
On a given machine the deployment descriptor might be located in a
directory like
C:\ws5\AppServer\config\cells\DELL\applications\
petstore.ear\deployments\petstore\petstore-ejb.jar\META-INF
Now a client can edit this file, stop the application, and restart it through the admin console.
I think that this possible. Hopefully one of the gurus will correct me if I am wrong.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic