Uvnik Gupta

Ranch Hand
+ Follow
since Jul 24, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Uvnik Gupta

Hi,

I am trying to create a simple application listed in Begining JavaEE 6 chapter 06. I have been able to compile and deploy successfully but when I try to launch the application using GlassFish3 appclient I get the following error:

org.jvnet.hk2.component.UnsatisfiedDependencyException: injection failed on org.glassfish.appclient.client.acc.AppClient
Container.secHelper with class org.glassfish.appclient.client.acc.AppClientContainerSecurityHelper
at org.jvnet.hk2.component.InjectionManager.error_injectionException(InjectionManager.java:280)
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:161)
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:93)
at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:126)
at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:91)
at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:82)
at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:78)
at org.jvnet.hk2.component.Habitat.getBy(Habitat.java:1056)
at org.jvnet.hk2.component.Habitat.getByType(Habitat.java:1037)
at org.jvnet.hk2.component.Habitat.getComponent(Habitat.java:781)
at org.glassfish.appclient.client.acc.ACCModulesManager.getComponent(ACCModulesManager.java:130)
at org.glassfish.appclient.client.acc.AppClientContainerBuilder.createContainer(AppClientContainerBuilder.java:1
84)
at org.glassfish.appclient.client.acc.AppClientContainerBuilder.newContainer(AppClientContainerBuilder.java:172)

at org.glassfish.appclient.client.AppClientFacade.createContainerForAppClientArchiveOrDir(AppClientFacade.java:4
92)
at org.glassfish.appclient.client.AppClientFacade.createContainer(AppClientFacade.java:454)
at org.glassfish.appclient.client.AppClientFacade.prepareACC(AppClientFacade.java:269)
at org.glassfish.appclient.client.acc.agent.AppClientContainerAgent.premain(AppClientContainerAgent.java:82)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
Caused by: org.jvnet.hk2.component.UnsatisfiedDependencyException: injection failed on org.glassfish.appclient.client.ac
c.AppClientContainerSecurityHelper.secInfo with interface com.sun.enterprise.security.appclient.integration.AppClientSec
urityInfo
at org.jvnet.hk2.component.InjectionManager.error_injectionException(InjectionManager.java:280)
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:161)
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:93)
at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:126)
at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:91)
at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:82)
at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:78)
at org.jvnet.hk2.component.Habitat.getBy(Habitat.java:1056)
at org.jvnet.hk2.component.Habitat.getByType(Habitat.java:1037)
at com.sun.hk2.component.InjectInjectionResolver.getComponentInjectValue(InjectInjectionResolver.java:159)
at com.sun.hk2.component.InjectInjectionResolver.getValue(InjectInjectionResolver.java:90)
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:143)


The main class is:


I have been searching for the past 2 days without any breakthrough. Can you please tell what is going wrong.
Thanks
I have passed the SCJP Beta and have received the certificate issued by the Prometric testing center. But have not yet received the Certificate from Sun. I tried to contact Sun about this but have not yet received a reply. Has anyone received the Certificate for the Beta from Sun ?? Please reply
- Uvnik
I think you are missing the case of 'P' in 'Pet'
Hi,
In my appliction I need to know all the registered data sources so that I can give have an option of connecting to any I choose. How can I do that? Is there some static function available and where can I find information on how to read the registry.
Thanx
Uvnik
Deepak,
You can use "super" only in a derived class. So if you say "class C extends Test" then you can use super.i in "C". For argument sake you CAN use super in any class since all are implicitely derived from Object but then you can only call methods of the Object class.
Hi,
Yesterday I passed the test with 92%. I want to thank everybody who has contrbuted to this site. It's great and the discussions really helps in clearing up many fundas. During the preparation I had read RHE, Khalid and JLS and had taken about 15 mock exams. I had finished the test in 50 minutes and hence I had ample of time for review. Though after the review I had expected a better score but I think I can do with it.
The distribution of the questions were:
4 on Threads
3 on AWT
1 on Collection
2 on I/O
4 fill in the blanks
And lots on Strings, overloading, overriding etc.
Uvnik
AWT
Hi Benli,
The point is that the two snippets posted by you are not equivalent Compile and see the difference.
AWT
Hi Junaid,
I tried all (Grid, GridBag, Card, Flow and Border). But it does not work only with BorderLayout.
AWT
Thanx Satya. I could find a thread that discussed this issue. But am still not clear why doesn't it work only for BorderLayout. It works for all other layouts without changing the position of setVisible().
AWT
The code below shows a blank frame instead of showing a single button named "Center" occupying the whole of the frame. Could anyone please explain?
import java.awt.*;
public class TestFrame extends Frame
{
Button bNorth = new Button("North");
Button bSouth = new Button("South");
Button bEast = new Button("East");
Button bWest = new Button("West");
Button bCenter = new Button("Center");
public TestFrame()
{
setLayout(new FlowLayout());
add(bNorth);
add(bSouth);
add(bWest);
add(bEast);
add(bCenter);
setLayout(new BorderLayout());
setSize(300,300);
setVisible(true);
validate();
}
public static void main(String args[])
{
TestFrame tf = new TestFrame();
}
}

Thanx
Uvnik
Thanx Thomas. I just figured out one more problem with my code. I had the messages for "Double Long version" ans "Double Int Version" written wrongly which added to my confusion.
Can anyone explain the output of the following code :
[pre]public class AQuestion
{
public static void main(String args[])
{
AQuestion question = new AQuestion();
question.method(null);
question.func(12, 2);
question.func(12, 2.2);
}
public void method(Object o)
{
System.out.println("Object Verion");
}
public void method(String s)
{
System.out.println("String Version");
}
public void func(int i, int j)
{
System.out.println("Int Version");
}
public void func(int i, long j)
{
System.out.println("Long Version");
}
public void func(int i, double j)
{
System.out.println("Double Long Version");
}
public void func(long i, double j)
{
System.out.println("Double Int Version");
}
}[/pre]

The O/P is :
String Version
Int Version
Double Long version
According to my understanding the O/P should have been :
Object Version
Long Version
Double Long Version.
Thanx
Uvnik
The following is an exerpt from theMagelang Institute :
In the creation of the Collections Framework, the Sun development team needed to provide flexible interfaces that manipulated groups of elements. To keep the design simple, instead of providing separate interfaces for optional capabilities, the interfaces define all the methods an implementation class may provide. However, some of the interface methods are optional. Because an interface implementation must provide implementations for all the interface methods, there needed to be a way for a caller to know if an optional method is not supported. The manner the framework development team chose to signal callers when an optional method is called was to thrown an UnsupportedOperationException.
It says that some of the interface methods are optional. It also says that an interface implementation must provide implementations for all the interface methods. Aren't the two statements contradictory and isn't the 1st statement wrong.
Can someone help me understand what is being said in the above parragraph.
I too have been confirmed for the Sun Certified Programmer for Java 2 Platform Beta Exam and these questions were in my mind too. Thanx Deepak for clarifying them
A static inner class is called "A top-level Inner Class"