Kamila Jolan

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

Recent posts by Kamila Jolan

Hi Hebert

I managed to get this working. I had forgot to create the JNDI entries for the JMS resource in Glassfish. Thanks for your help.

Hebert, thanks for answer, I still tried that but I still have that error.

I got the application that works correctly on Glassfish V2, however when I try to migrate it to Glassfish V3 i have following exception:

javax.naming.CommunicationException: Can't find SerialContextProvider [Root exception is java.lang.ClassCastException]
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:164)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:409)
at javax.naming.InitialContext.lookup(InitialContext.java:409)
at com.jmwrti.timetableserver.TimetableHandler.getTimetableImportDAO(TimetableHandler.java:66)
Caused by: java.lang.ClassCastException
at com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:258)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:153)
at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:136)
at com.sun.enterprise.naming.SerialContext.getCachedProvider(SerialContext.java:259)
at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:204
Caused by: java.lang.ClassCastException: Object is not of remote type com.sun.enterprise.naming.SerialContextProvider
at com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:250)

Here is the method that do the lookup:

Here is the the interface:

The bean:

I really dont understand why this is not working on Glassfish V3. I tried to remove the narrow method but the exception is still appearing. I am newbe to Glassfish and EJB so any help would be appreciated.

Stephan thanks for explanation I think i almost got it ,
but then why if I wrote that code:

the value 2 is inserted in the position 0 in the array, I would say that this is happening:

but the value is 2 not 6

Could you please elaborate more why after k += k = 6; the left-most k still has the original value as 1 ? I thought that after assignment k = 6 it would change the value to 6 so it will be 6+6 not 1+6.


I was wondering is it required to know how the overriding/overloading works in generic classes for SCJP exam? I found examples here but this topic is not really covered in the K&B book, so I am confused.

Kindest regards,

I know that it is not possible to create an object with a generic type like this:

It is also wrong to create generic array like:

then can somebody please explain me why it is possible to create an list like that(assuming that this code is in the generic class ):

but not for example an array of lists:
but then if i use a wildcard this works:

Any help will be appreciated.



The following code is from examlab. I dont understand why the IterruptedException is not appearing. I noticed that the wait() method is not within the synchronized context so the IllegalMonitorStateException should be thrown, but why IterruptedException is not appearing before that? It seems that method a.interrupt(); does not cause any effect here.

From the output I get I think that after method main is started the main thread is delayed in the doDelay() method and then thread t is started and delayed as well. Next the main thread wakes up and returns from main doDelay() method but it is being delayed again for at least 2000 milisec. Finally, the thread t wakes up and invokes halt() method but because the wait() is not within the synchronized context the IllegalMonitorStateException is thrown.
Why the interrupt() method does not have any effect here? I thought that when the main thread returns from the doDelay() method and invokes interrupt() while the thread t is still "sleeping" the IterruptedException should be thrown because thread t should be interupted??


Can somebody help me understand why this code:

giving the following results :
I understand why the "Child" is appearing - the overridden method "someMethod()" will be invoked and it will use the "s" variable from the Child class. That is why I don't know why the show() method will use the "s" variable from the Parent class in the second case (line 9). The Child object is created and the show() method is inherited by the Child class.

Any help will be appreciated
Thanks a lot for help! now I got it
Swaraj thanks for the answer, I know that "==" and "!=" preform automatic boxing, but I am not sure what "<" and ">" doing with the wrappers?

I would like to ask why the following code works:

If we use the "==" or "!=" instead of "<" or ">" the code won't compile because two different wrapper type cannot be compared. Are the operators like "<" or ">" preform an automatic cast like compound assignments(e.g. +=)??

Kindest regards,

Thank you very much for reply.

Could you elaborate more why then there are two "" characters at the beginning and none at the end of the result?


I have a problem with understanding the String split() method. I read the documentation but I cannot figure it out how this is

accualy working. If I use this code:

the result is:["a","a"]. Thus, I thought that this method splits the string removing delimiter.

Although when I run the follwing code:

The result is:["","","a","a","","aa","","a"]
..........index: 0 ..1 ..2 ...3 ..4 ...5 . 6 . 7

I dont understand why at the beggining of the output(index 0 and 1) as well as on index 4 when two "bb" letter were, the character "" appeared. It seems like those "bb"characters were replaced by "" but then why at the end of the result the "" is not appiring?The source string has to "bb" at the end as well.

I will be greatfull if somebody could explain me this.