EJB / EE :: MQ Messages Getting Re-delivered Infinitely With Exception In System Out
Apr 7, 2014
MQ Issue on the Websphere 7.0.0.25 server ..Same Message is getting redelivered again and again and below exception is coming in System out log. And secondly the messages are not getting processed completely.
[4/7/14 12:14:58:616 GMT+05:30] 0000001e LocalTranCoor E WLTC0017E: Resources rolled back due to setRollbackOnly() being called.
[4/7/14 12:16:14:738 GMT+05:30] 00000062 LocalExceptio E CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "onMessage" on bean "BeanId(myroj#myEJB.jar#MQMessageReceiverMDB, null)". Exception data: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor77.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:599)
at com.ibm.ejs.jms.listener.ServerSessionDispatcher.dispatch(ServerSessionDispatcher.java:47)
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:98)
[code]...
View Replies
ADVERTISEMENT
Dec 14, 2014
The player is defined as having 8 attributes which are in the array. The user enter attribute ratings that are restricted between 1 and 10. The total number of attribute points per player to allocate is 60. So my checks are that the inputted numbers are between 1 and 10 and the sum of them is 60. I continue to get an infinite loop when the code hits the if statement defining jamesTotalQuarter != 60. The code works however if the total is 60. What I want it to do is if the total != 60 revert back to the top of the code to allow the user to re-input their ratings. I've tried different combinations of continue and break statements without the outcome I'm looking for.
[public static void lebronJames() {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
//Declare an array to hold 8 intgers values
int lebronJamesAttributes[] = new int[8];
int attribute = 0;
System.out.println("Please allocate your attribute points for Lebron James in the following order. Your point allocations per attribute should be between 1 and 10. You have a total of 60 points to allocate");
System.out.println("-----------------");
System.out.println("Close Range" + "
[code]....
View Replies
View Related
Jun 11, 2014
I have a small problem with my code that I can't figure out how to make it work the way it is supposed to. The code is supposed to be a game where a user has to guess numbers between 1-1000. The program counts how many times the user tried to guess the number and it displays a certain message if the guess number is less than 10, more than 10 or 10. I was able to write the code using loops. However, the messages will not always get printed on to the screen. The code seems to work fine except for the last part where the messages, "Either you know the secret or you got lucky", "You should be able to do better", "Aha! you know the secret!" are not always displayed like they are supposed to.
import java.util.Scanner;
public class Guess1 {
public static void main(String[] args) {
int secretNumber;
secretNumber = (int) (Math.random() * 999 + 1);
Scanner input = new Scanner(System.in);
int guess;
int replay;
int test;
test=1;
replay=1;
int count=0;
[code]....
View Replies
View Related
Mar 4, 2014
I have the following code that comes directly from the book Core Java vol 1. The last two statements are mine but when I change the last statement's String the message being logged doesn't change. For that manner when I change the level of the last statement the file doesn't update to the correct log level. What am I doing wrong?
Java Code:
public class LogTester
{
public static void main(String[] args)
{
if (System.getProperty("java.util.logging.config.class") == null
&& System.getProperty("java.util.config.file") == null)
[code]....
Forgot to say the file also only logs the old message and level from a previous recompilation
View Replies
View Related
May 25, 2014
I am new to Java/OOP in general, and am trying to implement a multi-threaded system that contains a master thread, and a set of worker threads that are heterogeneous in the work they do. Once they complete the work, the workers indicate to the master by posting the result on to its queue. Here is the problem. The results of each type of work is different, and the master has to process each differently. In C (which I'm familiar with), this can be achieved by having a message type that is a union of all the expected messages, and by using a switch statement.
I thought of doing something similar in Java, by using instance of on each incoming message (each individual message class having been subclassed from a super message class) , and doing switch on that, but it doesn't seem to be the OO way to do things. The only other way I could think of was to implement an abstract method to get the type of each message, and then use the type in a switch statement, or if-then-else. Is there some other Java idiom to do this kind of processing? Also, if this is an acceptable method, why is it superior to using the reflection to find out the message type (instead of using the abstract getType())?
The message types look similar to the code below:
abstract class Message {
abstract String getType();
} class Result1 extends Message {
ResultType1 content;
String getType() {
[Code] ....
View Replies
View Related
Jun 13, 2014
I am using ActiveMq alongwith Spring in my project. I want my queue to be configured to reject the duplicate messages.I tried my level best to do so. I tried googling for the same. but could not get anything.
View Replies
View Related
Mar 1, 2015
I am having issues with a few lines of code and a java.util.UnkownFormaException. Here are the issues:
Exception in thread "main" java.util.UnknownFormatConversionException: Conversion = '1'
at java.util.Formatter.checkText(Unknown Source)
at java.util.Formatter.parse(Unknown Source)
at java.util.Formatter.format(Unknown Source)
at java.util.Formatter.format(Unknown Source)
at java.lang.String.format(Unknown Source)
at Storm.toString(Storm.java:99)
at StormChaser.DisplayStorms(StormChaser.java:149)
at StormChaser.main(StormChaser.java:55)
I have tried a lot of different things but can't seem to figure it out.
import java.io.*;
import java.util.Scanner;
public class StormChaser {
public static void main(String[] args)
[code]....
View Replies
View Related
Sep 19, 2014
I am attempting to maintain separate files for different types of "messages" (user messages, field labels/buttons, data values). In this attempt I am trying to get the description of different data values. For example, a UserStatus "A" might be displayed as Active or Activo.
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="defaultEncoding" value="UTF-8"/>
<property name="basenames">
<list>
<value>WEB-INF/locale/messages/messages</value>
<value>WEB-INF/locale/fields/fields</value>
<value>WEB-INF/locale/values/values</value>
</list>
</property>
</bean>
Here are the relevant entries in the values_en_us.properties file:
user.status.A = Active
user.status.I = Inactive
user.status.P = Pending
I would like to build an Enum for each type of value that I can get the localized value from. In the code below, I have hardcoded the values being passed to the get message to reduce the number of variables when trying to debug this.
import java.util.EnumMap;
import java.util.HashMap;
import java.util.Locale;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public enum UserStatusEnum {
[Code] ....
When this code runs, I get the following message:
org.springframework.context.NoSuchMessageException: No message found under code 'user.status.A' for locale 'en_us'.
On this line of code:
description = appCtx.getMessage("user.status.A", null, new Locale("en_us"));
The application is already showing my custom application error messages I have in the messages localized files, but in that case the ApplicationContext is already available. Because I can get to the contents of the messages_en_us.property files, I'm assuming me config is correct. However, the classes that get the messages content are instantiated by Spring.
The Enums are not created by Spring, so my assumption is that I am doing something wrong in how I am getting a handle on the ApplicationContext or how I am using it.
After looking at the appCtx values in debug mode, I can see that the messageSource > basenames does at least contain my configuration data.
[WEB-INF/locale/messages/messages, WEB-INF/locale/fields/fields, WEB-INF/locale/values/values]
Although I don't see the whole filenames with the file extension anywhere or the property file entries.
View Replies
View Related
Jan 18, 2012
I have some data in the database and values can be added on demand. so when ever the value added to the database i need to promt that message to all users which are accessing my website, so how can i acheive this....
View Replies
View Related
Apr 8, 2014
I'm working on a project that has two separate components. The first is a back end, that will do most of the heavy lifting, the other part is a front end GUI. The GUI will include the back end into it's project as an imported JAR file.
I need to be able to keep these two decoupled, as I might be writing different front ends using the same back end. The challenge in front of me (well one of many) is how to pass messages from the back end to the GUI so I can report things that are happening.
For example, if i call method FOO, FOO might do several different things; connect to a database, divide by zero, solve world hunger. I want to be able to either tie a JTextArea , or another component (or multiple components) to this stack of information, or at the very least, have something listening for this information, and when I see that my back end reports something, my front end is quickly aware of this information, and then I can process it and inform the user of the front end.
It would also be useful to be able to send a message from front end to back end , so perhaps the back end might learn that the front end user is unhappy and would like to stop running the current query.
View Replies
View Related
Jan 28, 2014
I have one row editable datatable.I have implemented email validation to one of the column where error message must display on blur of email field.This is working fine.I have a dialog with form to be displayed in the same page. Validation is implemented to this form also with on blur event. The dialog validation message gets displayed on blur but along with that the main form also displays the same validation message. This should not happen.
JSF page
<h:form id="lpcForm">
<div id="content">
<p:commandLink id="cmdLinkDelete" value="Delete"
style="font-size:15px;padding-left:15px;" ajax="true"
action="#{lpcBean.deleteRecords}" update=":lpcForm:lpcDataTable" />
[Code] ....
The message with id lpcErrMsg is the one that i am displaying on blur in the main page when email format is wrong.And this message gets displayed with dialog field validation also although i have never referred to this id to be rendered in the dialog.
The message with id lpcDlgMsg is the message that i am displaying inside the dialog with widgetvar dlg on blur.As of now i have implemented blur event validation for the first required field in the dialog.
View Replies
View Related
Oct 7, 2014
I have a simple method in Java through which I send commands to a machine over TCP. The problem is:
Machine can't accept more than two connections in 20 seconds.
I need to send 15-20 commands to the machine in 3 minutes.
This is my current method which is not working as it should, 2 commands get transmited but third command hangs because of the machine.
void sendCommand(String command) throws IOException {
String ipaddress = "192.168.0.2";
Socket commandSocket = null;
BufferedWriter out = null;
BufferedReader in = null;
BufferedWriter outToDetailFile = null;
[Code] .....
Basically what i need is:
1st: I need to open the connection by calling method
public void openConnection(String ipaddress, String port){
//Code to start the connection
}
2nd: I need to be able to send commands to the connection I have already opened (i will send multiple messages in time period of 5-10 minutes):
public void sendCommand(String message){
}
3rd: Close that connection
public void closeConnection(){
}
View Replies
View Related
Jan 24, 2014
I was giving a quick skim to some tutorials on the internet where I have found the exception that is handled is also declared in the throws clause of the method wrapping the try-catch block. For a code representation consider the following:
public void methodName() throws IOException {
try {
...
} catch (IOException ex) {
.... TODO handle exception
}
}
View Replies
View Related
Mar 18, 2014
Write a class named FileDisplay with the following methods:
1.) constructor: the class's constructor should take the name of a fil as an arugment.
2.) displayHead: This method should display only the first five lines of the file's contents
Here is the following code I have made so far
import java.io.*;
public class FileDisplay
{
private String filename;
public FileDisplay(String Filename) throws IOException
[Code] ....
First, in my constructor I have taken in an argument and used that argument to open up an output file. Meanwhile, I'm trying to work n the displayhead method to print out information and to read data to. I haven't opened up my input file yet, but I'm not understand how can I read a print data to an output file. in
public void displayHead()
{FileWriter file=new FileWriter(Filename)}
do I make create another instance of the filewriter class to output data?
In simple words, suppose to I want to display some messages on my output file in the displayhead function. Since I already have opened up the file in the constructor, how do I combine that in this method...
View Replies
View Related
Sep 29, 2014
Right, so I got this program. It takes input from the user and assigns it to fields on an object. But, it's meant to check the users input. If the user enters bad input, it's supposed to throw this exception. For each of these exceptions, theres a class specifically for it.
public class PayrollDemo
{
public static void main(String[] args)
{
Payroll pr = new Payroll ("Test Name", 234);
System.out.println("Current Employee Information.
");
System.out.println("Name: " + pr.getName());
System.out.println("ID: " + pr.getID());
System.out.println("Hourly Pay Rate: " + pr.getHourlyPayRate());
[Code] ....
And this is the exception class.
public class InvalidNameException extends Exception
{
/**
No-arg constructor
*/
public InvalidNameException()
{
super("Invalid name");
}
}
PayrollDemo.java:43: error: cannot find symbol
InvalidNameException.InvalidNameException();
^
symbol: method InvalidNameException()
location: class InvalidNameException
1 error
It's just meant to tell the user that they entered an invalid value, which would mean if they entered an empty string instead of a name.
View Replies
View Related
Feb 25, 2015
I have the Java Development Kit downloaded in my C file and my book tells me to compile the program I need to open command windowand change the directory where the program is stored. I tried the command cd to change directory and received this message "The system cannot find the path specified."
I checked the Environment Variables on Windows 7 and the Path says: C:Program Files (x86)Javajre1.8.0_31in
This is after many tries and i still can't change directory and i keep getting the same message.
View Replies
View Related
Jan 6, 2015
I'm making a stock system for the heck of it,so everything was going great until I hit the loop I am trying to use a for loop to add stock to the stock system,any way the question is maily about loops.How come I cannot declare a variable outside a loop and assign a value to it,for example I can declare as follows and I will not get an error,
for(int i=0;i<10;i++){
System.out.println("example");
}
but in my code(and yes its the only error I get I tested it) I get an error and can only declare and assign a value inside the loop,the reason for this is because I wanted to get the value from another class and use it in the loop ok so heres the code from both classes.
public class mainn{
public static void main(String [] args){
stock first = new stock();
int internal;
internal = first.wanted;
[code]....
View Replies
View Related
Jul 22, 2014
it gives me an error at the end class part some syntax error insert "}"..
* Course: IT110 - Introduction to Programming
* Filename: MyCustomShirtsPhase1.java
*
* Purpose: Created a simple online ordering system for My Custom Shirts customers
*/
import javax.swing.JOptionPane;
[code]....
View Replies
View Related
Feb 24, 2015
I have the Java Development Kit downloaded in my C file and my book tells me to compile the program I need to open command windowand change the directory where the program is stored. I tried the command cd to change directory and received this message "The system cannot find the path specified." I checked the Environment Variables on Windows 7 and the Path says: C:Program Files (x86)Javajre1.8.0_31in
This is after many tries and i still can't change directory and i keep getting the same message.The book I am using to learn Java is "Java How to Program: Tenth Edition" from Paul and Harvey Deitel.
View Replies
View Related
Jan 18, 2015
I'm assigned along with two others to make this program for a project.
We need to store data to the program by adding them such as user_id among the 5 criterias that are needed. Lets say I want a new user, I need the program to give me that option and then I would type in the user id and the program would store that data information
As far as I'm aware, boolean, screentokenizer and scanner is involved in the making of this program.
View Replies
View Related
Dec 5, 2013
In my java program I'm changing my IP(using proxy) and sending the request to some sites. Later some point of time, I want to know my current IP address through java program itself. How to get hold of my current IP address? Also which IP address will it show? The proxy one or the original IP ?
View Replies
View Related
Mar 13, 2015
I have designed a code that is aimed at simulating a banking environment using access database. However, there are errors and i am not able to create a new account.
import java.awt.*;
import java.awt.event.*;
import java.awt.FlowLayout;
import java.sql.*;
import javax.swing.*;
public class Bank extends JFrame implements ActionListener
[Code] ......
View Replies
View Related
Jun 1, 2014
I just want to calculate search time for my algorithm . How to get system time in java other than System.nanotime() and System.currenttimemillis() as these methods does not returns consistent time for same input is their another option to get system time???
View Replies
View Related
Feb 15, 2013
This program requires knowledge of manipulation of Java String objects and methods. It also requires knowledge of Number System Conversions.
// Lab16MATH05st.java
// The Number System Converter
// This is the student, starting version of the Lab16MATH05 assignment.
import java.util.Scanner;
public class Lab16MATH05st
{
public static void main (String args[])
{
System.out.println("Lab16MATH05 - Number Conversion Program
[code]....
90-Point Version Specifics: The 90-point version requires that you write both the fromHexToBin and fromBinToDec methods.
90-Point Version Output
95-Point Version Specifics {The 95-point version requires everything from the 90-point version and adds the fromBinToHex method. For this version, you may assume that the binary number will have a multiple of 4 bits.
95-Point Version Output
100-Point Version Specifics: The 100-point version requires the same methods as the 95-point version; however, the fromBinToHex method needs to be improved so it can convert regardless of the number of bits.
100-Point Version Output
105-Point Version Specifics: The 105-point version requires everything from the 100-point version and adds the fromDecToAny method. For this version, the method needs to be able to convert from decimal to any base between 2 and 10. Base 16 is not required for this version.
105-Point Version Output
110-Point Version Specifics: The 110-point version requires the same methods as the 105-point version; however, the fromDecToAny method needs to be improved so it can also convert to base-16.
View Replies
View Related
Oct 27, 2014
I'm in the middle of building A time management system for myself.I'm currently using JodaTime for timing in java. I just can't figure out who to save my data like, the starttime, stoptime and day time.
public void save() throws SQLException {
String checkSql = "select count(*) as count from Time where id=?";
PreparedStatement checkStmt = con.prepareStatement(checkSql);
String insertSql = "insert into Time (id, day, starttime, stoptime, overtime, exception, hours) values (?, ?, ?, ?, ?, ?, ?)";
PreparedStatement insertStatement = con.prepareStatement(insertSql);
String updateSql = "update Time set day=?, starttime=?, stoptime=?, overtime=?, exception=?, hours=? where id=?";
PreparedStatement updateStatement = con.prepareStatement(updateSql);
[code]....
View Replies
View Related
Jul 1, 2014
I am going to try and write a server-client based system.The server will be the design of what I want (e.g: daily advertisements that will be displayed on big monitors connected to the client, with like a slideshow looping). The client will just be receiving information from the server and not doing anything with it except displaying it and perhaps a networking element of the client reporting back to the server if the connection is dropped etc. The administrator can use the server to change the look of the advertisement.
I need the server to PUSH OUT to the client computers.I am on a networking degree so there has to be some elements to networking connections going on and programming is not my strong point. Would I write the server and clients in Java or another program? Will there need to be a "middle" program such as a web server?
View Replies
View Related