Accenture NJ mostly ask question on Collection like
1)How to sort Objcts and how treeset sort them
2)Explain mechanism of Hashcode finding in Java
3)Name some of the Sorted collection.
Hi frnd can i any one kindly can post for me portlet,hibernate
and spring example application and with flow explantion
configuration using Jdeveloper.and related links ar tutorials
kindly please send me .its urgent for me .thanks in
advance...........else can any one send to kondaiah.goddeti@gmail.com
kindly can any one post for me portlet,hibernate,spring
example code and configuration,and some related tutorials plz
its urgent for me....thanks in advance ............
Hi frnds iam new to struts wen iam running helloworld
application using struts iam getting the error as belwo
kindly any one can solve it plzz .....thanks in
advance.........
Nov 18, 2009 9:27:46 PM
org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING:
[SetPropertiesRule]{Server/Service/Engine/Host/Context}
Setting property 'source' to
'org.eclipse.jst.jee.server:StrutsExample1' did not find a
matching property.
Nov 18, 2009 9:27:46 PM
org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING:
[SetPropertiesRule]{Server/Service/Engine/Host/Context}
Setting property 'source' to
'org.eclipse.jst.jee.server:Struts1' did not find a matching
property.
Nov 18, 2009 9:27:46 PM
org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which
allows optimal performance in production environments was
not found on the java.library.path: C:\Program
Files\Java\jre6\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\sys
tem32;C:\WINDOWS;C:/Program
Files/Java/jre6/bin/client;C:/Program
Files/Java/jre6/bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOW
S\System32\Wbem;C:\Program Files\Java\jdk1.5.0_18\bin;
Nov 18, 2009 9:27:46 PM
org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8081
Nov 18, 2009 9:27:46 PM org.apache.catalina.startup.Catalina
load
INFO: Initialization processed in 678 ms
Nov 18, 2009 9:27:46 PM
org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Nov 18, 2009 9:27:46 PM
org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.20
Nov 18, 2009 9:27:46 PM
org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet action as unavailable
Nov 18, 2009 9:27:46 PM
org.apache.catalina.core.ApplicationContext log
SEVERE: Error loading WebappClassLoader
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@ca2dce
org.apache.struts.action.ActionServlet
java.lang.ClassNotFoundException:
org.apache.struts.action.ActionServlet
at
org.apache.catalina.loader.WebappClassLoader.loadClass(Webap
pClassLoader.java:1387)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(Webap
pClassLoader.java:1233)
at
org.apache.catalina.core.StandardWrapper.loadServlet(Standar
dWrapper.java:1095)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrappe
r.java:993)
at
org.apache.catalina.core.StandardContext.loadOnStartup(Stand
ardContext.java:4149)
at
org.apache.catalina.core.StandardContext.start(StandardConte
xt.java:4458)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.j
ava:1045)
at
org.apache.catalina.core.StandardHost.start(StandardHost.jav
a:722)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.j
ava:1045)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine
.java:443)
at
org.apache.catalina.core.StandardService.start(StandardServi
ce.java:516)
at
org.apache.catalina.core.StandardServer.start(StandardServer
.java:710)
at
org.apache.catalina.startup.Catalina.start(Catalina.java:583
)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:2
88)
at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:41
3)
Nov 18, 2009 9:27:46 PM
org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /Struts1 threw load() exception
java.lang.ClassNotFoundException:
org.apache.struts.action.ActionServlet
at
org.apache.catalina.loader.WebappClassLoader.loadClass(Webap
pClassLoader.java:1387)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(Webap
pClassLoader.java:1233)
at
org.apache.catalina.core.StandardWrapper.loadServlet(Standar
dWrapper.java:1095)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrappe
r.java:993)
at
org.apache.catalina.core.StandardContext.loadOnStartup(Stand
ardContext.java:4149)
at
org.apache.catalina.core.StandardContext.start(StandardConte
xt.java:4458)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.j
ava:1045)
at
org.apache.catalina.core.StandardHost.start(StandardHost.jav
a:722)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.j
ava:1045)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine
.java:443)
at
org.apache.catalina.core.StandardService.start(StandardServi
ce.java:516)
at
org.apache.catalina.core.StandardServer.start(StandardServer
.java:710)
at
org.apache.catalina.startup.Catalina.start(Catalina.java:583
)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:2
88)
at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:41
3)
Nov 18, 2009 9:27:46 PM
org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8081
Nov 18, 2009 9:27:46 PM org.apache.jk.common.ChannelSocket
init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Nov 18, 2009 9:27:46 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/31 config=null
Nov 18, 2009 9:27:46 PM org.apache.catalina.startup.Catalina
start
INFO: Server startup in 616 ms
My application URL :
http://localhost:8080/Application/Login.jsp. When a user
enter this url in IE then, how it get Login.JSP Page
exactly? what are the processes will happen from when we
submit the URL to get Login.jsp?
I need some details about an employee. i have only the
employee id in my presentation layer(JSP).I entered that ID
and click "Show Details" Button. Question is how the JSP
pass that id to Controller layer and DAO and what mechanism
we are using to retrive data from DB and how the data
passed to JSP as a Output. Please explain in detail.
which is advanced deep technology in java launched by the
sun microsystem??? The answer is very logical
If u need correct answer mail me at priya_gupta@gmail.com
Given:
11. public static void main(String[] args) {
12. Integer i = uew Integer(1) + new Integer(2);
13. switch(i) {
14. case 3: System.out.println(”three”); break;
15. default: System.out.println(”other”); break;
16. }
17. }
‘What is the result?
1 three
2 other
3 An exception is thrown at runtime.
4 Compilation fails because of an error on
line 12.
Given:
1. package test;
2.
3. class Target {
4. public String name = “hello”;
5. }
What can directly access and change the value of the
variable name?
1 any class
2 only the Target class
3 any class in the test package
4 any class that extends Target
84. try {
85. ResourceConnection con =
resourceFactory.getConnection();
86. Results r = con.query(”GET INFO FROM CUSTOMER”);
87. info = r.getData();
88. con.close();
89. } catch (ResourceException re) {
90. errorLog.write(re.getMessage());
91. }
92. return info;
Which is true if a ResourceException is thrown on line 86?
1 Line 92 will not execute.
2 The connection will not be retrieved in line
85.
3 The resource connection will not be closed
on line 88.
4 The enclosing method will throw an exception
to its caller.
11. static class A {
12. void process() throws Exception { throw new Exception();
}
13. }
14. static class B extends A {
15. void process() { System.out.println(”B”); }
16. }
17. public static void main(String[] args) {
18. new B().process();
19. }
What is the result?
1 B
2 The code runs with no output.
3 Compilation fails because of an error in
line 12.
4 Compilation fails because of an error in
line 15.
Question 7 [8]
Consider the following class and answer the questions below
it:
public class StackWithGuard extends Stack {
public StackWithGuard(int size) {
super(size);
}
synchronized public boolean isEmpty() {
return super.isEmpty();
}
synchronized public boolean isFull() {
return super.isFull();
}
synchronized public int getSize() {
return super.getSize();
}
synchronized public void push(Object obj) {
try {
while (isFull()) {
wait();
}
} catch (InterruptedException e) {}
super.push(obj);
COS2144/102
11
notify();
}
synchronized public Object pop() {
try {
while (isEmpty()) {
wait();
}
} catch (InterruptedException e) {}
Object result = super.pop();
notify();
return result;
}
public static void main(String args[]) {
StackWithGuard stack = new StackWithGuard(5);
new Producer(stack, 15).start();
new Consumer(stack, 15).start();
}
}
Note: The Stack class is provided in the Appendix.
Note also: The following questions all refer to the pop()
method of the StackWithGuard
class given above.
7.1 What does the synchronized keyword ensure for this
method? (2)
7.2 Why is a while loop used to test whether the stack is
empty? In other words, why
wouldn't the following if statement be sufficient?
if (isEmpty()) {
wait();
}
(2)
7.3 Why is the result of popping (provided by the inherited
pop() method) stored in a
temporary variable? In other words, why wouldn't the
following statement be
sufficient?
return super.pop();
(2)
7.4 Why is the while loop placed in a try-catch structure?
(2)
Appendix
The LinkedQueue class:
public class LinkedQueue implements Queue {
private Node first, last;
private int count;
public LinkedQueue() {
first = last = null;
count =0;
}
public int size() {
return count;
}
public boolean isEmpty() {
return (count == 0);
12
}
public void enqueue(Object o) {
Node node = new Node();
node.element = o;
node.next = null;
node.prev = last;
if (last != null){
last.next = node;
}
else {
last = first = node;
}
last = node;
count++;
}
public void dequeue() {
if ((first!= null) & (first.next!=null)) {
first = first.next;
first.prev = null;
count--;
}
else {
first = last = null;
count--;
}
}
public Object front() {
return first;
}
}
class Node {
Object element;
Node next, prev;
}
The Stack class:
public class Stack {
protected Object rep[];
protected int top = -1;
protected int size = 0;
protected int count = 0;
public Stack(int size) {
if (size > 0) {
this.size = size;
rep = new Object[size];
}
}
public boolean isFull() {
return (count == size);
}
public boolean isEmpty() {
return (count == 0);
}
public int getSize() {
return size;
}
public void push(Object e) {
if (e != null && !isFull()) {
COS2144/102
13
top++;
rep[top] = e;
count ++;
}
}
public Object pop() {
Object result = null;
if (!isEmpty()) {
result = rep[top];
top--;
count--;
}
return result;
}
}
27
Realized?
136
where singleton classes are used in j2ee web application.can
we use it for connection pooling.
52
what is bmg file and how to create that files?what will it
contailn?
What are the conditions applies to varchar variable, when
using in procedures?
144
howmany types in garbage collection
56
I want to use the markerfor playing a video using the
jmf.Suppose my video length is of 2 hours.I want it to play
ex-15 mintue or 20 mintue and should stop after assigning
the time.I am providing my piece of code............please
help me....
package com.jha.cdac.lila.praveen;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.net.URL;
import javax.media.ControllerAdapter;
import javax.media.Manager;
/**
*
* @author vinays
*/
import javax.media.Player;
import javax.media.RealizeCompleteEvent;
import javax.media.Time;
import javax.swing.JFrame;
public class PlayVideo extends javax.swing.JFrame{
Player player;
Component center;
Component south;
// this code is required for playing the video file of
mpeg,mp4,mp3,3gp,rm,flv,
//wmf,mpv,vob,qt and the asf extension
public PlayVideo() {
File file = new File("Lesson1.mpg");
try {
load(file);
// load()
}
catch (Exception ex) {
//Logger.getLogger(LessonNarrative.class.getName
()).log(Level.SEVERE, null, ex);
System.out.println("Error while loading
file............"+ex);
}
}
//the piece of code given below is used to load the
file which user want to play.
public void load(final File file) //load the file
throws Exception {
URL url = file.toURL();
final Container contentPane =
getContentPane();
if (player != null) {
player.stop();
}
// MediaLocator mediaLocator=new MediaLocator
(file.toURL());
// DataSource dataSource=Manager.createDataSource
(mediaLocator);
// player=Manager.createPlayer(url);
player = Manager.createRealizedPlayer(url);
ControllerAdapter listener = new ControllerAdapter()
{
@Override
public void realizeComplete(
RealizeCompleteEvent event) {
Component vc = player.getVisualComponent();
player.getVisualComponent();
if (vc != null) {
contentPane.add(vc,
BorderLayout.CENTER);
center = vc;
} else {
if (center != null) {
contentPane.remove(center);
contentPane.validate();
}
}
Component cpc = player.getControlPanelComponent();
if (cpc != null) {
contentPane.add(cpc,
BorderLayout.SOUTH);
south=cpc;
} else
{
if (south != null) {
contentPane.remove(south);
contentPane.validate();
}
}
pack();
// //setTitle(file.getName()); //to get the
title of Video or Audio File
}
};
Time tm=new Time(30.4402403);
Time tm1=new Time(5.7256199);
player.addControllerListener(listener);
player.setMediaTime(tm1);
player.setStopTime(tm);
// player.setMediaTime(new Time(5.0));
//player.setStopTime(new Time(73));
player.realize();
player.start();
}
public static void main(String args[]) throws
ClassNotFoundException {
PlayVideo pv = new PlayVideo();
JFrame f = new JFrame("Lesson1");
f.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0); }
});
f.getContentPane().add("Center", pv);
f.pack();
Dimension screenSize = Toolkit.getDefaultToolkit
().getScreenSize();
int w = 420;
int h = 140;
pv.setLocation(screenSize.width/2 - w/2,
screenSize.height/2 - h/2);
pv.setSize(w, h);
pv.setVisible(true);
}