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)
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.
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.
INSERT INTO MAIN_TABLE(START_DATE1) SELECT RESULT_TIME AS START_DATE1 FROM TEMP_TABLE
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
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).
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?
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
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.