Kaustav Ganguly

Greenhorn
+ Follow
since Dec 14, 2009
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
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Kaustav Ganguly

Hi ,

I created a zip file using java. I have attached the code below. But when I am trying to open it by using 7zip or windows extract all feature they are not able to open the file.
Is it not possible to open zip files created in java by using an archiving tool ? Do I need to write a java code to unzip it ?



Thanks
Kaustav
6 years ago
I understood that for static methods instance does no make any difference. But what for instance variable ? Instance variables are specific to a particular instance, why are they as per the declaration ?
6 years ago
I dont know if this question or doubt I am having is already answered before in this forum, so please excuse me if it has been or if it is a sily question. But I could not understand the behaviour of the following code snippets.



And the output was

10Test
20TestChild1

I could not understand why test.a and test.b would print the superclass value but when we invoke the method it is the other way round. Really confused.

6 years ago


Solved. Works with

<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
6 years ago
JSF

I get an Illegal argument exception when I give the servlet mapping as

<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>

But when I use the servlet mapping with the complete file name it works fine.

<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/xyz.xhtml</url-pattern>
</servlet-mapping>

The stack trace is as follows

java.lang.IllegalArgumentException: null source
at java.util.EventObject.<init>(Unknown Source)
at javax.faces.event.SystemEvent.<init>(SystemEvent.java:67)
at javax.faces.event.ComponentSystemEvent.<init>(ComponentSystemEvent.java:69)
at javax.faces.event.PostRestoreStateEvent.<init>(PostRestoreStateEvent.java:69)
at com.sun.faces.lifecycle.RestoreViewPhase.deliverPostRestoreStateEvent(RestoreViewPhase.java:256)
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:245)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)

Any pointers please.

6 years ago
JSF
Hi,

I have defined some custom page tag and trying to use it in my application. I am running my server in eclipse and the component class is present in a jar file. While I try to load the page I am getting the exception "SEVERE: JSF1068: Cannot instantiate component with component-type page". Seems that it is not able to load the page component class present inside the jar file.

Interestingly when I extract the component classes and put them directly under the Web Application project in eclipse it works fine.

Please let me know if there is any pointer to the issue.

My web.xml has the following entry

<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/XYZ-taglib.xml</param-value>
</context-param>

Tag defination is

<tag>
<tag-name>page</tag-name>
<component>
<component-type>page</component-type>
</component>
<attribute>
<name>src</name>
<required>true</required>
</attribute>
<attribute>
<name>localName</name>
<required>false</required>
</attribute>
</tag>

And the tag component class is



The error stack trace is

SEVERE: JSF1068: Cannot instantiate component with component-type page
13:01:11,471 ERROR [XYZRenderingManager] render: handleException(RenderingException)
13:01:11,471 ERROR [XYZRenderingManager] Unhandled exception thrown during rendering
6 years ago
JSF
I agree with David. we have also used selenium via junit and failure of one test case do not stop the execution of further tests. But it has happened once when test cases were not executed and we found it was due to out of memory on the selenium server. So make sure the exception you are getting is not something which halts the selenium server itself.
8 years ago
try invoking join() method on the runner thread in between line 11 and 12 , then the output should be 5.

Actually we have two threads here , the main thread and the one you are creating , now which one will be executed first is not gauranted.


So try using join as following

Singleton is used when only one instance of the class should be initialised, typical example would be to maintain cache.

Now the same could be acheived by using a class with all methods as static but the problem in this case is nothing stops you from creating multiple instances of the non singleton class.
8 years ago
You can try invoking the third party API from your own Thread and then interrupt your own thread when you require to interrupt the third party thread.
Only the main thread will wait for thread 'a' to complete its execution. and that is because you have invoked join from the main thread. Try having a print statement in your main method after you invoke join, it would execute after thread 'a' completes.
I agree with Pat, its better to throw exception in case of an error and handle it in the calling method.
8 years ago