M. Phaneendra Vijay

+ Follow
since Jun 10, 2009
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 M. Phaneendra Vijay


I am using Jboss 6.1.0 for my application. I have two binary files.
Policy.jar and PolicyConverter.ear
I am using log4j 1.2.16 to print the logs to a file.
Unfortunately, all the logs are printed to server.log and not to my own log file.
But the logs generated in PolicyConverter.ear are sent to converter.log correctly,
and the logs generated in Policy.jar are NOT printed in the policy.log file, but are redirected to server.log.
I am using the same logging mechanism in both the binaries.

I have searched the internet and found one answer
to remove the 'mode="On Demand"' attribute from 'bean name="OnDemandJBossLogManagerContextSelector"' tag in JBOSS_HOME/server/<servername>/deployers/jboss-logging.deployer/META-INF/logmanager-jboss-beans.xml

I did that and the problem still persists. (policy.log file is created but logs are not printed to it, instead printed to server.log)

Thanks in advance.
9 years ago
Copy paste this and check if it works. it is the same code as yours (including the logging) but closed the statements in a finally block.


It is not a good practice to close the ResultSet, PreparedStatement objects in a try block, because if a statement before closing them throws an exception, then the ResultSet and PreparedStatment objects will never be closed leaving them open.
Try to close them in a finally block.

try having a separate method for each SQL statement. It will help you identify where the problem is.
Check if this works for you.

Check if you have closed the connection in the following method

Also, It is better you write a single method for each SQL statement you want to execute and call all those methods in a single method by passing the same connection object to all the methods
and close the resultset, statement objects in finally block of the individual methods instead of in the try block and close the connection object in the finally block of the parent method.

I found the problem with my query. The problem was not this timestamp to timestamp column. It was another column which does this
where RESULT_TIME is a timestamp and it cannot be converted to the YYYY-MM-DD format, which is throwing the error "literal does not match format string"

I changed that to CAST(RESULT_TIME AS DATE) and now it is working fine.

In SQL Developer I changed the NLS parameters for DATE format, which is why it was working in the sqldeveloper.

Sorry for troubling and thanks for your reply.
I executed the following query from java and also in SQLPLUS


From java, I got the result: DD-MM-RR HH12:MI:SSXFF AM

In SQLPLUS, I got the result YYYY-MM-DD HH24:MI

In SQLDeveloper, I got the result: DD-MM-RR HH12:MI:SSXFF AM
So in SQLDeveloper Tools -> Preferences -> Database -> NLS, I changed the TIMESTAMP FORMAT to YYYY-MM-DD HH24:MI:SS, and the query worked.

So what change should I make for it to work from Java?

The query and the columns are generated dynamically. Because of this, I posted a general query.
This is the code I use.


Thanks for your reply.
I am using JDK1.6 and I have downloaded the latest jdbc driver file for Oracle 10g from the Oracle site, which suggested me to use ojdbc14.jar (previously I was using the classes12.jar).

After searching on the internet, I found that it could be an issue with the NLS_TIMESTAMP_FORMAT. Now how can I set that from the java code? My java code is 24 * 7 / 365 running program. The program runs every hour.

I have this query


START_DATE1 is timestamp(9) and RESULT_TIME is timestamp(6) and I am using Oracle 10g.
The above query works if i execute it from sql developer or from sqlplus prompt.

The same thing if executed from java program using jdbc (ojdbc14.jar) is throwing the following exception:
java.sql.SQLException: ORA-01861: literal does not match format string

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:113)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:754)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:210)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:963)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1192)
at oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:1662)
at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1631)
at org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:228)
at com.pyro.huawei.bss.pm.dao.BSSDAOImpl.insertIntoMainTable(BSSDAOImpl.java:641)
at com.pyro.huawei.bss.pm.service.BSSServiceImpl.insertIntoMainTable(BSSServiceImpl.java:77)
at com.pyro.huawei.bss.pm.load.BSSOracleLoader.loadFileToDatabase(BSSOracleLoader.java:288)
at com.pyro.huawei.bss.pm.classes.HuaweiBSSUpdater.processFiles(HuaweiBSSUpdater.java:214)
at com.pyro.huawei.bss.pm.classes.HuaweiBSSUpdater.processBSSUpdater(HuaweiBSSUpdater.java:310)
at com.pyro.huawei.bss.pm.classes.BSSUpdaterScheduler.run(HuaweiBSSUpdater.java:490)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:165)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636)

Thanks in advance.
Phaneendra Vijay.
I have checked the thread dumps with a gap of 15 seconds. I don't see anywhere, where the thread is actually blocked or in deadlock.
Could you please help?

I am unable to attach files. It is giving an error saying "Files with the extension .zip are not allowed as attachment in the message."
10 years ago
The thread dump that I have checked, is for the last time (Oct 2nd) that the messages were not consumed from the queue (RHInputQueue). It is actually a production system. Till now, all the messages are consumed from the queue (RHInputQueue) properly. When it stops consuming, I will then take some 3 to 4 thread dumps with a gap of 10 to 15 seconds and analyze that.

And yes, the onMessage method processes the incoming message from RHInputQueue and sends it to another queue (RHOutputQueue).
10 years ago
Sorry for posting such a huge message and thanks for the reply.

I have checked the thread dump and removed the threads that are in RUNNABLE, WAITING and TIMED_WAITING states.
I found that the thread that calls the onMessage is blocked and it is locked on an address. What does it imply and how should I proceed further?

10 years ago
I am using JBoss 5.1 JMS Queues. After processing certain no. of messages, say after a 50,000 messages, the messages in the queue are not consumed. Then the delivering count stays the same and the messaging count goes on increasing. I get around 30 to 40 messages per second. I searched it on google and did the following
1) close the queueSession and queueConnection.
2) changed to mysql db from hsqldb.
3) increased the transaction timeout.

Even after doing all these, my messages are still getting stuck in the queue.

The application is like this.

A c++ application sends the messages over socket. The java converter application receives the messages and puts them in a blocking queue. And some 20 threads access the blocking queue (receivedQ) and puts them in RHInputQueue (Queue). The BL application uses an MDB (ProcessRequest) to consume those messages from RHInputQueue, does some manipulations on the message and puts that message in the RHOutputQueue (Queue). The converter application then uses another MDB to consume those messages in the RHOutputQueue and puts them in another blocking queue. And one thread accesses that blocking queue (processedQ) and sends them over the socket to the c++ application.

Here [Attached] is the thread dump from the jboss jmx console after it stopped processing the messages from the RHInputQueue

Thanks in advance.
10 years ago
Want to share the solution to this problem, in case people are banging their heads like I did from many days

JBoss Messages stuck in queue after processing certain no. of messages; the reason it seems is "When java code doesn’t close its QueueSession and QueueConnection objects".

Worked for me. Check if this is the solution to your problem as well.


10 years ago

I have a program that sends thousands of messages to the queue (Input Queue) and I process them and put them in another queue (Output Queue).
After consuming certain no. of messages (12000 to 13500), the messages are only queued up in the Input Queue. They are not coming out.

I have set the mdb objects min pool to 15 and max pool to 30 in the standardjboss.xml for message-driven-bean.
Also I have checked the thread dump in jboss jmx-console (jboss.system -> type=ServerInfo -> threadDump). It showed all the 15 threads of the mdb are in RUNNABLE state.
Please help.


10 years ago