Annie McCall

+ Follow
since Apr 17, 2003
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Annie McCall

Hi All,

I do have an answer to my JMS Security Exception. I will post the
solution for any JMS newbies like myself.

It was not an application code fix but rather a change in the security
configuration of my JMS queue on my Weblogic Server.

Since there was no "real" user, the user context is "guest". All I
needed to do was add an 'acl entry' for guest in the send action of my
JMS queue.

An 'acl entry' is really adding a row in a table in the realm database.

For example:
insert into weblogic.realm_acl_entries values ('realm_domain','guest', 'JMS QUEUE NAME','send', null);</CODE>

Hope this information helps someone who may encounter the same problem.
My server is BEA WebLogic Server 8.1.
I currently inherited a JMS app where it uses an Asyncronous Message bean.
The logic in this bean is very simple. It has an OnMessage method which looks at the input message. This input message is just a textmessage, depending on it's value it will implement different processes.
For example:

I have a listener which gets kicked off when the server starts.
This listener kicks off a method (let's say around every 10 minutes) that attempts to write to the JMS queue.

Now is where the problem occurs.

Here is the logic that attempts to send a text message to the queue.

The exception occurs on this line:

queueSender = queueSession.createSender(queue);

I get this error:

I think I am getting this because the process is being kicked off on the server rather than from an user.

Does anyone know how to do this?

I tried using an anonymous producer but doing this:

But then I got an invalid destination error.

Has anyone attempted to this before ( Write to a JMS queue from a method which was set off with a timer)?

Any help would be greatly appreciated,

[ February 06, 2008: Message edited by: Annie McCall ]
[ February 06, 2008: Message edited by: Annie McCall ]
I guess I do not know how to handle the refresh itself. I know the appropriate code on how to refresh(ie., create new instance of singleton or synchronize on hash map and recreate it with new data).

I would like to refresh like once a day...or even more often...but I do not know how to do this?

I don't think there is a way to detect if the data changed in the db so I am opting on maybe refreshing every...hour, day. Is there a way to put a timer in singleton???

Example code is appreciated.

[ May 18, 2007: Message edited by: Annie McCall ]
14 years ago

The app I'm working on has a singleton class that needs to be refreshed every so often. Does anyone have any design ideas on how I can achieve this?

The singleton contains a hashmap which reflect data that hardly gets changed in our database. But, if the data does change, we want to refresh hash map without redeploying app. Maybe a timer(??) not sure how to do this.

Any one out there have any ideas... Examples would be great.

14 years ago
Thanks Mihai for your reply. It really help me find my solution.

I will post my solution in case any newbies like me run into the same thing. This might have been obvious to others (but not me) and it could of said to do this in the book (and I missed it) but I had to change the code in both RmiNoFactoryExample and RmiFactoryExample classes.

I made the changes below in the main method in both classes:

Naming.rebind("RmiFactoryExample", new DvdDatabaseFactoryImpl("."));
Naming.rebind("RmiFactoryExample", new DvdDatabaseFactoryImpl("./dvd_db.dvd"));

Naming.rebind("RmiNoFactoryExample", new DvdDatabaseFactoryImpl("."));
Naming.rebind("RmiNoFactoryExample", new DvdDatabaseImpl("./dvd_db.dvd"));

After I made these changes and recompiled, programs worked exactly like they said they should in book (Chapter 6 pg. 182)

I just started to prepare for the SCJD exam and purchased SCJD Exam with J2SE 5 ( second edition). I downloaded the source for DennyDVD project and now I'm reading about Networking with RMI (chapter 6). The book says to run the RmiNoFactoryExample and RmiFactoryExample (p. 182). When I try to run it I get the following error:

C:\mccalla\java\DennyDvd\classes>java sampleproject.remote.RmiNoFactoryExample
Exception in thread "main" java.rmi.RemoteException: . (Access is denied); neste
d exception is: . (Access is denied)
at sampleproject.remote.DvdDatabaseImpl.<init>(
at sampleproject.remote.RmiNoFactoryExample.main(RmiNoFactoryExample.jav
Caused by: . (Access is denied)
at Method)
at<init>(Unknown Source)
at<init>(Unknown Source)
at sampleproject.db.DvdFileAccess.<init>(
at sampleproject.db.DvdDatabase.<init>(
at sampleproject.remote.DvdDatabaseImpl.<init>(
... 1 more

Can anyone tell me what I missed? I am just beginning to study and want to be able to at least follow the examples in the book.

Hibernate version: hibernate 3.2.0.cr2

Mapping documents:Annotations

Name and version of the database: Oracle 92


Before I show you my code....I explain my problem.
It seems like Hib is adding 4 columns to my query.
Below is the actual SQL that is being generated:
select feedlog0_.FEED_ID as col_0_0_,
feedtype1_.FEED_DESC as col_1_0_,
feedlog0_.FEED_ID as FEED1_3_,
feedlog0_.CRTD_DT as CRTD2_3_,
feedlog0_.FEED_TYPE as FEED3_3_,
feedlog0_.RESULT_STATUS as RESULT4_3_,
feedlog0_.value as value3_,
feedlog0_.offset as offset3_,
feedlog0_.count as count3_,
feedlog0_.hash as hash3_
from FEED_LOG_TB feedlog0_, FEED_TYPE_TB feedtype1_
where feedlog0_.FEED_TYPE=feedtype1_.FEED_CODE

(don't understand how hib is getting .value, .count, .hash, and .offset; I don't have those columns in my table or bean)

now my code:
my bean:
package com.annie.hcp.businessbeans;

import java.util.Date;
import java.text.NumberFormat;
import java.util.Locale;
import java.math.BigInteger;

import javax.persistence.*;
query="SELECT fl, ft.feedDesc " +
"FROM FeedLog fl, FeedType ft " +
"WHERE fl.feedTypeCode = ft.feedCode")

public class FeedLog implements Serializable {
private static final long serialVersionUID = 7526472295622776147L;

private BigInteger feedId;
private Date crtdDt;
private String feedTypeCode;
private BigInteger resultStatus;
private String feedName;
private double dblAmount;
private int statusName;
private int noOfRecs;

private String feedDesc;
public String getFeedDesc() {
return feedDesc;

public void setFeedDesc(String feedDesc) {
this.feedDesc = feedDesc;

public Date getCrtdDt(){

return this.crtdDt;

public void setCrtdDt(Date param){

this.crtdDt = param;

/* Feed Type */

public String getFeedTypeCode(){

return this.feedTypeCode;

public void setFeedTypeCode(String param){

this.feedTypeCode = param;

/* Double Amount */

public String getDblAmount(){

NumberFormat n = NumberFormat.getCurrencyInstance(Locale.US);

String s = n.format(dblAmount);
return s;


public void setDblAmount(double param){

this.dblAmount = param;

public String getFeedName() {
return feedName;

public void setFeedName(String feedName) {
this.feedName = feedName;

public int getStatusName() {
return statusName;

public void setStatusName(int statusName) {
this.statusName = statusName;

public int getNoOfRecs() {
return noOfRecs;

public void setNoOfRecs(int param){

this.noOfRecs = param;

public BigInteger getFeedId() {
return feedId;

public void setFeedId(BigInteger feedId) {
this.feedId = feedId;
public BigInteger getResultStatus() {
return resultStatus;

public void setResultStatus(BigInteger resultStatus) {
this.resultStatus = resultStatus;
public void setFeedType(FeedType feedType1) {
this.feedType1 = feedType1;

public FeedType getFeedType1() {
return feedType1;

public void setFeedType1(FeedType feedType1) {
this.feedType1 = feedType1;

public void setFeedType(FeedType feedType) {
this.feedType = feedType;

public String getFeedCode() {
return feedCode;

public void setFeedCode(String feedCode) {
this.feedCode = feedCode;

public FeedType getFeedtype() {
return feedtype;

public void setFeedtype(FeedType feedtype) {
this.feedtype = feedtype;

... Now the code from another class where I call the named query:

BaseHibernateDao dao = DaoFactory.getExpenseDao();
/* get days from web.config */
FacesContext facesContext =
ServletContext servletContext = (ServletContext)
Object[] params = new Object[1];
params[0] =(BigInteger) this.feedDays;
this.feedLogList = (ArrayList)dao.findByNamedQuery ("FeedLog.getFeedsSummary


and here is the error message I receive....
detailMessage= "ORA-00904: "FEEDLOG0_"."HASH": invalid identifier\n"

I have to admit I am new to hibernate and Spring.
Why is hibernate adding those additional 4 columns (.count, .offset, .hash, .value) ??? Query works fine without those columns.

Thanks in advance
I would like to take a 2 dimensional and flatten it to a 1 dimensional.
14 years ago
Does anyone out there know how to flatten a 2 dimensional arraylist?

14 years ago
Ok, I tried all of the them and looks like there are only 2 correct answers - D & E.

I tried /*.do on tomcat and got the same error Alec got.

Hi Darya,
ok. I tested it and I got xE trueE yE which is C.
Hi Darya,
The reason I think <body-content>empty</body-content> may be a problem is because when we hit statement <w:worthless x="<@=Boolean TRUE.toString()%>" />
will cause the doTag to perform
if ("x".equals(x))
return SKIP_BODY;

since x is not equal to "x", the doStartTag will return EVAL_BODY_INCLUDE.

Since the tag is defined as empty, and according to the HFSJ on page 534, it says that if the TLD declares an empty body, doStartTag() MUST return SKIP_BODY. I am assuming maybe a runtime error will occur. I am not sure since I haven't tested it.

Not sure, that's why I thought we couldn't return a EVAL_BODY_INCLUDE if tag is defined as empty.

Let me know what you think.

[ September 23, 2005: Message edited by: Annie McCall ]
[ September 23, 2005: Message edited by: Annie McCall ]
What answer would you give to this question and please explain.

Public class WorthlessTag extends TagSupport {

private String x;
public void setX(String x) { this.x = x; }
public int doStartTag() throws JspException {

try{ pageContext.getOut().print(x);}
catch (IOException e) {}
if ("x".equals(x))
return SKIP_BODY;
public int doEndTag() throws JspException {

try{ pageContext.getOut().print("E");}
catch (IOException e) {}
if ("y".equals(x))
return SKIP_PAGE;
return EVAL_PAGE;


and the given TLD excerpt:

and given this complete JSP page:

<%@ taglib uri="somevaliduri" prefix="w" %>
<w:worthless x="x" />
<w:worthless x="<%=Boolean.True.toString()%>" />
<w:worthless x="y" />
<w:worthless x="z" />

What output does the JSP generate?

A. xE
B. x trueE yE
C. xE trueE yE
D. xE trueE yE zE
E. x <%=Boolean.True.toString()%>E yE
F. xE <%=Boolean.True.toString()%>E yE
G. xE <%=Boolean.True.toString()%>E yE zE

Remember tag's body-content is equal to empty!

[ September 23, 2005: Message edited by: Annie McCall ]
[ September 23, 2005: Message edited by: Annie McCall ]
Hi Darya,

I would say the answer would be B.

Statement 1: req.getSession().setAttribute("key", new X());
This should trigger the valueBound on Object X and print B.

Statement 2: req.getSession().setAttribute("key", new X());
a. This should create a new instance of X and trigger the valueBound
and print B.
b. This statement should also trigger the valueUnbound from the
instance created in statement 1 and print UB.

Statement 3: req.getSession().setAttribute("key", "x");
This should trigger the valueUnbound on Object X (that was created
in statement 2) and print "UB.

Statement 4: req.getSession().removeAttribute("key");
prints nothing since "key" has String Object "x".

So to put it all together, I think it should be ....

Hi Rajaraman,

I think it says in HFSJ on page 375 "Without quotes, it will not work". So, you do need quotes. This pertains to Beans and Maps. If it was an ArrayList, you don't need quotes. I think if you read further on page 375, it says you may see something like this:
request.setAttribute("Genre", "Ambient");
Music is ${musicMap[Genre]}.
(This will work since Genre evaluates to a literal value from
request object.)

Hope this helps.
[ August 30, 2005: Message edited by: Ann McCall ]