Reputation: 18757
I am working on J2EE (Message Driven Beans) and Weblogic 10.3 and I am totally new to both of these. I am trying to read a properties file within a Message Driven Bean file. When I call a function which reads this properties file, I get the following error:
.
.
.
"[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'" daemon prio=6 tid=0x2c686c00 nid=0x708 in Object.wait() [0x2ef1f000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0d8df8d8> (a weblogic.work.ExecuteThread)
at java.lang.Object.wait(Object.java:485)
at weblogic.work.ExecuteThread.waitForRequest(ExecuteThread.java:162)
- locked <0x0d8df8d8> (a weblogic.work.ExecuteThread)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:183)
"Timer-1" daemon prio=6 tid=0x2c60e400 nid=0x9b0 in Object.wait() [0x2eecf000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0d8dfae8> (a java.util.TaskQueue)
at java.util.TimerThread.mainLoop(Timer.java:509)
- locked <0x0d8dfae8> (a java.util.TaskQueue)
at java.util.TimerThread.run(Timer.java:462)
"Timer-0" daemon prio=6 tid=0x2be8b800 nid=0x688 in Object.wait() [0x2ce6f000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0d5303d8> (a java.util.TaskQueue)
at java.lang.Object.wait(Object.java:485)
at java.util.TimerThread.mainLoop(Timer.java:483)
- locked <0x0d5303d8> (a java.util.TaskQueue)
at java.util.TimerThread.run(Timer.java:462)
"Low Memory Detector" daemon prio=6 tid=0x009a7000 nid=0x1538 runnable [0x00000000]
java.lang.Thread.State: RUNNABLE
"CompilerThread0" daemon prio=10 tid=0x009a0c00 nid=0x1e0 waiting on condition [0x00000000]
java.lang.Thread.State: RUNNABLE
"Attach Listener" daemon prio=10 tid=0x0099f400 nid=0xc30 runnable [0x00000000]
java.lang.Thread.State: RUNNABLE
"Signal Dispatcher" daemon prio=10 tid=0x0099e000 nid=0x5fc runnable [0x00000000]
java.lang.Thread.State: RUNNABLE
"Finalizer" daemon prio=8 tid=0x0098d800 nid=0xdc in Object.wait() [0x2adcf000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0d5305f0> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
- locked <0x0d5305f0> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
"Reference Handler" daemon prio=10 tid=0x00988c00 nid=0x1334 in Object.wait() [0x2ad7f000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0d5300d8> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:485)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
- locked <0x0d5300d8> (a java.lang.ref.Reference$Lock)
"main" prio=6 tid=0x002bb400 nid=0x11a8 in Object.wait() [0x0090f000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0d5306a0> (a weblogic.t3.srvr.T3Srvr)
at java.lang.Object.wait(Object.java:485)
at weblogic.t3.srvr.T3Srvr.waitForDeath(T3Srvr.java:981)
- locked <0x0d5306a0> (a weblogic.t3.srvr.T3Srvr)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:490)
at weblogic.Server.main(Server.java:71)
"VM Thread" prio=10 tid=0x00986400 nid=0xcec runnable
"VM Periodic Task Thread" prio=10 tid=0x009a9800 nid=0xc14 waiting on condition
>
Here is the Java code:
@MessageDriven(
messageListenerInterface = javax.jms.MessageListener.class,
name = "MdbA",
mappedName = "qA",
activationConfig = {
@ActivationConfigProperty(
propertyName = "connectionFactoryJndiName",
propertyValue = "connectionFactoryV"),
@ActivationConfigProperty(
propertyName = "destinationType",
propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(
propertyName = "destinationJndiName",
propertyValue = "qA"
)})
public class MdbA implements MessageListener {
private static int fileCount = 0;
private String[] aryReadingType;
private long sleepMs;
private String persistenceDirectory;
private String tomcatServerInstance;
private String tomcatStatusScript;
private String readingsProcessorInstance;
private String logServiceURL;
private static Logger log = Logger.getLogger(MdbALIreadings.class.getName()); // log4j logger
/**
* Default constructor.
*/
public MdbALIreadings()
{
System.out.println("In onMessage of MdbALIreadings as of " + new Date());
setProperties(); // fails if I call this function here
}
/**
* @see MessageListener#onMessage(Message)
*/
public void onMessage(Message message)
{
.
.
.
setProperties(); // fails if I call this function here
}
private void setProperties() {
.
.
.
try {
date = new Date();
fis = new FileInputStream("ReadingsProcessor.properties");
properties.load(fis);
}
If I do not call the setProperties()
function anywhere in this file, it does not fail.
Any thoughts about why I cannot read a file within a Message Driven Bean? What causes the entire server to fail?
Upvotes: 0
Views: 925
Reputation: 118734
Your "error" isn't an error, it's a thread dump. It doesn't show an error at all.
Your FileInputStream is failing because "ReadingsProcessor.properties" is not in the current working directory. What is your current working directory? Who knows, it's unspecified and WLS can put it anyplace it pleases (which is likely not someplace you expect).
You might have better luck finding someplace handy in your deploy that is on the classpath and using a class loaders getResourceAsStream method to load your property file. Where that is, I can't say either -- I don't know what you're deploying, or how it's deployed, and I don't know the standard directories that WLS may put on the classpath. You can always add your own directory to the containers classpath and stick the property file in there.
Upvotes: 1