siddharth das

Ranch Hand
+ Follow
since Aug 17, 2007
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 siddharth das

Hi,

I am trying to do an example of Spring transaction (Programmatically) .

I have 2 db operation.

1st operation: I am going to purchase a product which needs to be updated in PurchaseProduct table as well as updated(2nd operation) in the product table.

I have following code



I would like to test the transaction to be failed. So I did the code accordingly where the 1st operation pass but the 2nd operation should fail so that the whole transaction should be roll back.
But when I run the code, the table PurchaseOrder1 is updated i.e 1st operation pass and Product1  is not updated i.e 2nd operation fail. But the whole transaction is not rolled back.

I expect that PurchaseOrder1  table should not be updated as Product1  is not updated.

I am not able to figure out for the solution.

Please help.

Thanks,
Siddharth
3 years ago
Thanks for the information.
3 years ago
Hi,

Please help me in understanding the following line:

You can use byType or constructor autowiring mode to wire arrays and other typed-collections

I know that Spring can autowire only Object dependenct.
But can spring can autowire a array or other typed collection ?

Thanks,
Sidharth
3 years ago
Hello,
I am new to JAX RS and Jersey 2. My simple rest resource server side program is working fine and I am able to access it by any browser .

But when I have written a JAX RS Jersey 2 client it is giving me HTTP 404 Not found, Below are the details:
Below is rest resource server side program:

Web.xml:



Resource Class


My Server side Jar files list
aopalliance-repackaged-2.4.0-b31.jar
asm-debug-all-5.0.4.jar
hk2-api-2.4.0-b31.jar
hk2-locator-2.4.0-b31.jar
hk2-utils-2.4.0-b31.jar
javassist-3.18.1-GA.jar
javax.annotation-api-1.2.jar
javax.inject-2.4.0-b31.jar
javax.servlet-api-3.0.1.jar
javax.ws.rs-api-2.0.1.jar
jaxb-api-2.2.7.jar
jersey-client.jar
jersey-common.jar
jersey-container-servlet-core.jar
jersey-container-servlet.jar
jersey-guava-2.22.1.jar
jersey-media-jaxb.jar
jersey-server.jar
org.osgi.core-4.2.0.jar
osgi-resource-locator-1.0.1.jar
persistence-api-1.0.jar
validation-api-1.1.0.Final.jar

Here is Client Side:


But when I run this main method getting 404 exeception as follow:
[color=red]FEET_TO_INCH Response: InboundJaxrsResponse{context=ClientResponse{method=GET, uri=http://localhost:8081/RestfulWebServiceExample, status=404, reason=Not Found}}
FEET_TO_INCH Response: InboundJaxrsResponse{context=ClientResponse{method=GET, uri=http://localhost:8081/RestfulWebServiceExample, status=404, reason=Not Found}}
Exception in thread "main" javax.ws.rs.NotFoundException: HTTP 404 Not Found
at org.glassfish.jersey.client.JerseyInvocation.convertToException(JerseyInvocation.java:1008)
at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:816)
at org.glassfish.jersey.client.JerseyInvocation.access$700(JerseyInvocation.java:92)
at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:700)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:444)
at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:696)
at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:420)
at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:316)
at org.arpit.javapostsforlearning.webservice.client.ConversionServiceClient.getOutputAsXML(ConversionServiceClient.java:48)
at org.arpit.javapostsforlearning.webservice.client.ConversionServiceClient.main(ConversionServiceClient.java:38)

Please Help me to fix this issue, I stuck in it.
Thanks in advance !!!
3 years ago
Hi,

Can I configure an object which is present outside of my application(Other module) in my apllication context xml file.

i.e.

If I write


It searches the classes inside x.y.z package and create instance of those.But this x.y.z is in my application (say e.g.MyJavaApp)
But I want to configure an object which is present in the (say e.g. p.q.r package) which is in different application (say e.g HisJavaApp).
Both MyJavaApp and HisJavaApp are different module but they are interdependent.

Please suggest.

Thanks in advance!
4 years ago
then where to use T and where to use ?
4 years ago
Hi,

public <T extends Animal> void takeThing(ArrayList<T> list)

Does the same thing as this:

public void takeThing(ArrayList<? extends Animal> list)

So here is my question: if they are exactly same, why don't we write

public <? extends Animal> void takeThing(ArrayList<?> list)

or

public void takeThing(ArrayList<T extends Animal> list

Also, when would it be useful to use a ? instead of a T in a method declaration ( as above ) with Generics, or for a Class declaration? What are the benefits?


Thanks!
4 years ago
Thanks a lot for the clarification..
4 years ago
Thanks for the reply.

During the type erasure process, the Java compiler erases all type parameters and replaces each with its first bound if the type parameter is bounded, or Object if the type parameter is unbounded.

So in this case the type parameter is unbounded ( type parameter will be replaced by Object). So the class would be like below after type erasure process.


Then what is the problem with Java compiler with the Statement ' private Object t = new Object();'

Object class has its default construtor , means we can write new Object().

Thanks!

4 years ago
Hi,

I have a written a generic class like below:




My question is why there is a compilation error at "private T t = new T();" .. showing cannot instantiate type T

Thanks in Advance!
4 years ago
Hi,

I have a maven project which I import in Eclipse. I want to rename the project.Could you please tell me what are the steps.

Thanks,
Sidharth
4 years ago
It would be better if you give some idea where to use codebase and rmic tool to generate stub and skeleton.
I am new to RMI. I want to implement a rmi program in my machine. So is there any good link to provide such information.

Thanks,
Siddharth
6 years ago
i.e i can use rmic tool to generate stub and skeleton....
and in which case , the codebase property is used?

thanks..
6 years ago
Is it necessary to use codebase as i am using jdk 1.6
6 years ago
Hi,

I need a help.I have developed a RMI prog.like
HelloClient.java
HelloInterface.java
HelloServer.java
RegisterIt.java

I compiled every file.
rmic HelloServer
Start rmiregistry
java RegisterIT

I got following Exception

Obj Instantiated.HelloServer[UnicastServerRef [liveRef: [endpoint:[192.168.1.2:5
0268](local),objID:[50f575b:13e94969dcc:-7fff, -7587787631591497735]]]]
Exception is : java.rmi.ServerException: RemoteException occurred in server thre
ad; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
tion is:
java.lang.ClassNotFoundException: HelloServer_Stub

Attached is the Exception Screenshot.

Please suggest.

Thanks
6 years ago