Anupam Dee

Ranch Hand
+ Follow
since Oct 18, 2010
Anupam likes ...
Firefox Browser Tomcat Server Windows XP
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 Anupam Dee

Yes of course.

This is creating a big problem for me. I ve to use a lot of jars. I can't write them individually.
7 years ago
Yes I know.

But what is the solution then?
Actually I tried both. with MANIFEST and without MANIFEST.

Is there no way for adding multiple jars from a different directory in classpath and running the jar file?
7 years ago

This is the Stacktrace

Exception in thread "main" java.lang.NoClassDefFoundError: abc/employee/Employee
at abc.printemployee.PrintEmployee.main(PrintEmployee.java:16)
Caused by: java.lang.ClassNotFoundException: abc.employee.Employee
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
... 1 more
7 years ago
I solved the problem by adding the classpath in the MANIFEST itself because the classpath is invalid when we run the jar file from command line.

But the real problem is:
If there are 25 jars in my project that i need to load, How I am going to load them all?
I tried using

Class-Path: jars/* it does not work

But when i use
Class-Path: jars/employee.jar
it works fine.
7 years ago
Hi all,

In Eclipse
I created a simple Employee class.
It consists of String name; and getters and setters
Simply converted it to jar.

Created another project that references the Employee jar.
It consists of main where I am simply setting a name and displaying it.

I converted this project to an executable jar.

Now I took both the jars
Employee.jar
PrintEmployee.jar (executable)

put in a simple directory EMP
and when i used the command

java -classpath employee.jar PrintEmployee.jar
from the EMP directory

It threw the java.lang.NoClassDefFoundError


Please help.

Where am I wrong?
7 years ago
Hi
I am getting a inputstream using
InputStream is = response.getEntity().getContent();
now i want to save it in UTF-8 file that preserves the language codes.
The input stream contains data in a different languages e.g chinese, japanese, hindi.

I tried using IOUtils, OutputStreamWriter but failed. The file is saved but it is something like ऩ Ӓ i want these codes to be actually saved in its equivalent symbol



How can I do this?

Please help.
7 years ago
I want to store parent child, a tree like structure in mongodb.
I followed this link.
http://www.mongodb.org/display/DOCS/Trees+in+MongoDB

But there is no way of how to save the tree in mongodb. Only retrieving is there.

How to do that?
Any help would be appreciable.

Thanks.
7 years ago
I have two classes
Class A
Class B
class B extends A

i m storing it in mongodb as follows

A a=new B();
crud.save(a);

the data is being stored with _class : B

But i want to store it as A,
Is it possible?
Can i store the object with _class as its superclass?
7 years ago
Hi guys,
I am new to hibernate and having a lot of confusions.

I created 3 classes.

User.java
Category.java
Expense.java

I have User and Category properties in Expense.java

Now when i am trying to persist only the expense object after setting the User and Category properties, i am getting TransientObjectException because i am not persisting the User and Category objects to the database.

But when I persist them before persisting the Expense object using session.save(), it works fine.

I have <many-to-one> association in Expense.hbm.xml for both User and Category, because multiple expenses can have single or many users with single or many categories.

So what is the case when we have to explicitly save these objects first and then the final object, and when is not the case.
What is the actual concept behind this? I want the User and the Category objects to automatically get persisted when i call session.save(expenseobject);

I am confused. Please help me.
I have a Customer Class and an Address class as follows

Customer.java


Address.java


Now I want to have two customers with the same address
e.g


//Now when i try to retrieve the Customer Object and iterate over the list i am not getting the address for the second customer. I am getting null there.

These are my HBM files

Address.hbm.xml


Customer.hbm.xml



I am new to hibernate mapping.. please help me...

And i am a bit confused about the mapping strategies in hibernate..please suggest a good link too.
I have two fields in Person Class
firstName
secondName

I want to validate that both the names should be given by the user at the same time

ValidationUtils only gives the method to check on a particular field, how can I validate this?
7 years ago
I want to create a Validator class e.g PersonValidator that implements Validator interface. I want to get the error messages stored in the .properties file (for Internalization).
I am trying to autowire MessageResource to do the same.



this is the xml content


and this is main

and the output is
null
[Field error in object 'person' on field 'name': rejected value [null]; codes [name.required.person.name,name.required.name,name.required.java.lang.String,name.required]; arguments []; default message [null]]

the first null is messageSource getting printed and it is null !
I think i am not able to autowire the messagesource to the .properties file. How should i do it?
Any help would be appreciated.

Thanks in advance.
7 years ago
How can we debug Spring Application or Spring MVC Application?
I have commons-logging.jar. But don't know how to use it?
Or is there any other alternative to step through to debug my application by setting breakpoints.

I am using Spring Tool Suite.
Please help.
7 years ago
Thank you so much.
If you don't mind I really don't know how to set breakpoints and I really need to know. So if you can suggest any links about setting the breakpoints.
Thanks in advance
7 years ago