Subhash Bhushan C

Ranch Hand
+ Follow
since Jan 27, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Subhash Bhushan C

Solved your problem with a combination of ArrayList and Map. In fact, I used Arraylist just to illustrate to you. You can very well skip ArrayList completely, and use Map along with your class.

You can read up on Collections here: Trail: Collections (The Java Tutorial)

Here is the class containing your data:


And here is a small implementation to show how the adding is done:


And this is the output I get:

----------------------
ArrayList Data
----------------------
FIRST-1-0-2-0-3-0-4-0
SECOND-3-0-4-0-5-0-6-0
FIRST-5-0-6-0-7-0-8-0
----------------------


----------------------
Map Data
----------------------
SECOND-3-0-4-0-5-0-6-0
FIRST-6-0-8-0-10-0-12-0
----------------------


[ April 22, 2008: Message edited by: Subhash Bhushan ]
15 years ago
Check if your etc/hosts is proper. This problem can occur if this file is corrupted.
15 years ago
This is an excerpt from db2-ds.xml.



Correct me if I am wrong, but dont you specify the schema name and password as part of user-name and password parameters shown above?
[ April 22, 2008: Message edited by: Subhash Bhushan ]
15 years ago
You can find Tutorials on Collections here:Trail: Collections (The Java Tutorials)

Specifically on HashMaps, you can read about the interface here:
The Map Interface
and the implementation here:
Map Implementations

You should also read up on javadoc of HashMap:
HashMap
15 years ago
The way I debug is:

1. Window -> Show View -> Other -> Server -> Servers
2. n Servers window, right-click -> New -> Server -> JBoss Inc -> JBoss AS 4.0, and specify the parameters.
3. After configuration, in Servers window, right click the JBoss server, and select Debug.
4. Server starts up, console messages are shown in Console window.
5. Copy your jar/war/ear files into JBoss\server\default\deploy directory, and console messages indicate the loading of the application file.

Place breakpoints in your application, and whenever they are encountered, you will be taken into a debug perspective.
15 years ago
If I copy and paste your batch file script into my Textpad, I can see that the character '-' in front of Xmx is a special character. But the character in front of classpath seems to be ok.

Just copy the character in front of classpath, and paste it in front of Xmx, and then try.
15 years ago
Here is some sample output I tried...


D:\>java Simple
Hello World!!!

D:\>java -Xmx500m Simple
Hello World!!!

D:\>java -Xmx 500m Simple
Invalid maximum heap size: -Xmx
Could not create the Java virtual machine.

D:\>


You have to specify -Xmx option without a space in between the size and -Xmx.

Are you sure you have added com.mycomp.main.RunGenerator to your CLASSPATH?
15 years ago
Can you please paste the structure of Finance folder inside webapps?

1. What is the URL you are typing to access the application?
2. Do you have a file called index.jsp inside Finance folder?
3. What is the message that you get when you type http://localhost:8080?
15 years ago
Here's another way to do it:

In the JSP page, put if conditions for display of fields (after the first field) to be shown only if the previous field has been set. Write helper classes, with proper constructors to feed data into the combo/select box.

The submit button can invoke the same action. Action class can check whether the last field has been set, if not return a different status like "INCOMPLETE". You will have to declare this in your action class, or ActionSupport class if you have extended from it as follows:
public static final String INCOMPLETE = "incomplete";
You can map the status INCOMPLETE in struts.xml to show the same jsp page again.




But you will have to be very careful to code your helper classes, Cities/Areas etc... to have constructors which take appropriate state/city/area inputs.
[ April 21, 2008: Message edited by: Subhash Bhushan ]
15 years ago
Figured the problem out.

I was using Hibernate reverse engineering plugin to generate entities from MySQL DB. Some of the entities that have been generated do not have @GeneratedValue annotation. Once I put put it in the entity POJO, things started working fine.
Hi,

I am trying to use a OneToMany relationship between my MemberDetail Class and its addresses. Here is the code:

MemberDetail.java:


Address.java:


The Address class does not have any reference to MemberDetail class.

Creating the Member Detail:


I get the following error upon persisting:

19:37:16,671 ERROR [STDERR] javax.persistence.PersistenceException: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.justbooks.common.entities.Address#0]
19:37:16,687 ERROR [STDERR] at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
19:37:16,687 ERROR [STDERR] at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:218)
19:37:16,687 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManager.persist(TransactionScopedEntityManager.java:182)
19:37:16,687 ERROR [STDERR] at com.justbooks.security.activities.ManageProfileBean.createProfile(ManageProfileBean.java:95)




I am using EJB 3.0 persistence with J2EE 1.4/J2SE 5. I assume that Address IDs should be autogenerated. I am using MySQL DB and I have marked the field for autogenerate.

I am sure I am doing something wrong, but not able to pinpoint the problem.

Thanks in advance. Any clues are welcome.
[Copy-Paste]
Solved it...


You guys wont believe what the problem was...
JBoss was not replacing old class files with new files in a new EAR. So, the first version of the file was being reference. Once I cleaned up the deployment directory, everything worked just fine...

Thanks for the help, Anand...
16 years ago
Solved it...


You guys wont believe what the problem was...
JBoss was not replacing old class files with new files in a newly deployed EAR. So, the first version of the file was being referenced. Once I cleaned up the deployment directory, everything worked just fine...

Thanks for the help, guys...
16 years ago
Hi,

Had posted this in the Struts section, but decided this was a better forum to address this issue.

I have an action class ProfileDetailAction, which implements the getter/setter methods related to Profiles. I have 2 classes RegistrationAction and AlterProfileAction extending from it.

I have an EJB 3.0 entity class called ProfileDetail which is mapped to an underlying table in MySQL.

ProfileDetailAction.java:




RegistrationAction.java:



ProfileDetail.java:



The firstName variable in ProfileDetail action is getting filled properly (I am able to see them in debug mode.)
When setFirstName() gets called in RegistrationAction, I get the following error:


java.lang.NoSuchMethodError: com.justbooks.entities.ProfileDetail.setFirstName(Ljava/lang/String



I am not sure whether this is a classloader problem, or I am doing something wrong. I am using JBoss, with MySQL DB. I am using Eclipse, and the IDE does not throw up any errors too.

I have only one Java version on my laptop, jdk1.5.0_01, which is being used by both Eclipse (my IDE) and JBoss (my App Server). I saw quite a number of posts on the net indicating it might be a version mismatch. But I dont think that applies to this situation.

Any clue welcome...
16 years ago

Originally posted by Marimuthu Madasamy:
I got one clue from the error message you got,



see there is 'L' in the parameter class, that means it is expecting a method having a String array as parameter like this,

com.justbooks.entities.ProfileDetail.setFirstName(String[] arg)

- Marimuthu M



Hmm... Actually, the signature seems to be correct. Please refer this link: http://www.rgagnon.com/javadetails/java-0286.html

From that, its clear that my method's signature is right.
-----------------------------------------
public java.awt.Label(java.lang.String);
/* (Ljava/lang/String V */
-----------------------------------------

Anand,
I have only one Java version on my laptop, jdk1.5.0_01, which is being used by both Eclipse (my IDE) and JBoss (my App Server). I saw quite a number of posts on the net indicating it might be a version mismatch. But I dont think that applies to this situation. But will keep looking.
16 years ago