gagan narula

Greenhorn
+ Follow
since Nov 05, 2006
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 gagan narula

Hi

I am new to spring MVC. I have created helloworld example using Spring MVC and getting the error as "org.springframework.web.servlet.DispatcherServlet noHandlerFound"

These are the configuration files info:

1. Web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>Spring3MVC</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>

2. spring-servlet.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">


<context:component-scan base-package="net.viralpatel.spring3.controller" />

<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>

3. Index.html:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>

<html>
<head>
<title>Spring 3.0 MVC Series: Index - ViralPatel.net</title>
</head>
<body>
Say Hello
</body>
</html>

4. hello.jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>

<html>
<head>
<title>Spring 3.0 MVC Series: Hello World - ViralPatel.net</title>
</head>
<body>
${message}
</body>
</html>

5. Controller class:

package net.viralpatel.spring3.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class HelloWorldController {

@RequestMapping("/hello")
public ModelAndView helloWorld() {
System.out.println("Hiiiiiiiiiiiiiiiiiiiiiiiii");
System.out.println("testtttttttttttttt");
String message = "Hello World, Spring 3.0!";
System.out.println(message);
return new ModelAndView("hello", "message", message);
}

}



Please help me out. I am trying to run the above program since morning but nothing work out. Thanks in advance.

Gagan
9 years ago
Hey Vijatha

Data is not old.We do archive the data from database once the data set value goes to 200 million. Since the data set value is dependent on the number of cdr pushes from another application and the cdr table creates on hourly basis. Those tables are dynamic table.And we make union on those table. So the only solution to overcome this problem is to make temp table as defined in the problem description. So I just wan to know is there any way that select quest doesn't take lock. One more thing i wan to add that we are not concerned about any stale data related issue in temp table. So cant we set any isolation level in transaction or just pass the instruction to the query to doesn't take lope.

I hope now you are clear with my issue. Please let me know if you need any more detail from my side.

Thanks
Gagan
Hi

In my current project to fetch the report from database, we fire query by using union of multiple tables. As we are using nested query to fetch report, my sql creates a temp file to to do the manipulation of inner query which consists of union of multiple table. Due to this IO operation of the system gets high it results in to many performance issue like slowing down the performance of the other queries due to which transaction time out exception occurs.

So to resolve this issue we are planning to use temporary table instead of inner query. But the problem is we are using "insert in to ..... select * from .." statement. In such cases select statement takes lock on the rows of the table. Since this table is used by other modules of the application it results in to deadlock scenario .

Can any one tell me, how to make changes in the java code or query so that select statement doesn't take lock on the table.

Please let me know if any one need any other input from my side.

Thanks
Gagan
Hi

I am not getting your reply. Connection object has property as connection id by the help of which we can kill the query. There is no method available in the connection class to get the value of that property.

Can you please explain it to me by the help of some example that would be very nice of you.

Gagan
To kill any query on mysql there is a command:

Kill <connection id>

I have created a sample application in Java and execute the same query from Java manually. I am able to kill the query but in the same program, I have got the connection id using watch of eclipse. The connection id is present in the connection object of JDBC but there is no function available to get the same value from program

Thanks
Gagan
But this wont solve my problem. Actually we want to kill queries which are taking more time manually.
Hi

I need to allow user to kill queries running in database(i.e Mysql)from our web application. I have gone tghrough some links and I come to know that we can achieve this by killing connection of connection object.

But I am not able to find any method in JDBC connection object API to get connection id of object in Java Docs

Can any one please let me know any way to get the conncetion id of JDBC connection object or is there any other way by which I can achieve the same.

Please help me out.

Thanks
Gagan
Hi

As i am new to EJB i have created a helloworld application in ejb which is working fine when i try to call it from servlet but when i try to invoke the same ejb from java client (i.e from diff jvm) on jboss i got the following error:

javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]]]
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1399)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:579)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.gl.TestClient.main(TestClient.java:39)
Caused by: javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:254)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1370)
... 4 more
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:228)
... 5 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:266)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:69)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:62)
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:224)
... 5 more

Following is my code:

Home Interface:

package com.gl;

import javax.ejb.CreateException;

public interface testHome extends EJBHome {
String JNDI_NAME = "testBean";
public test create()
throws java.rmi.RemoteException,CreateException;
}

Remote Interface:

package com.gl;

import java.rmi.RemoteException;

import javax.ejb.EJBObject;

public interface test extends EJBObject {
public String welcomeMessage() throws RemoteException;
}

Bean:

package com.gl;

import java.rmi.RemoteException;

import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;

public class testbean implements SessionBean {

public void ejbActivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub

}

public void ejbPassivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub

}

public void ejbRemove() throws EJBException, RemoteException {
// TODO Auto-generated method stub

}

public void setSessionContext(SessionContext arg0) throws EJBException,
RemoteException {
// TODO Auto-generated method stub

}

public void ejbCreate(){}

public String welcomeMessage(){
return "Welcome to the World of EJB";
}

}

ejb-jar.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>testBean</ejb-name>
<home>com.gl.testHome</home>
<remote>com.gl.test</remote>
<ejb-class>com.gl.testbean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>

jboss.xml:

<?xml version='1.0' ?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">
<jboss>
<enterprise-beans>
<entity>
<ejb-name>testBean</ejb-name>
<jndi-name>testBean</jndi-name>
</entity>
</enterprise-beans>
</jboss>

Client code:

package com.gl;

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;

public class TestClient {

public static void main(String[] args) throws Exception{

try{
/* Properties props=new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming rg.jnp.interfaces");
props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
*/

Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
props.put(Context.PROVIDER_URL, "localhost:1099");

System.out.println("Properties ok");

//env.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.HttpNamingContextFactory");
//env.put(Context.PROVIDER_URL,"http://localhost:8080");
//env.put(Context.SECURITY_PRINCIPAL, "");
//env.put(Context.SECURITY_CREDENTIALS, "");


Context ctx=new InitialContext(props);
System.out.println("context ok");
//testHome home = (testHome)ctx.lookup("testBean");
Object obj = ctx.lookup ("testBean");
System.out.println("ojb = " + obj);

testHome ejbHome = (testHome)PortableRemoteObject.narrow(obj,testHome.class);
test ejbObject = ejbHome.create();
String message = ejbObject.welcomeMessage();
System.out.println("home ok");

System.out.println("remote ok");

System.out.println(message);


}

catch(Exception e){e.printStackTrace();}

}

}

I am able to successfully deployed my ejb on JBOSS but i m getting above error when i am trying to invoke ejb from java client.

I have also added the jar file of ejb in class path of client.

kindly suggest me something to solve this issue.

Regards
Gagan
Regarding Sun Java System Application Server Issue with JVM

Hi

I have installed SJSAS9.1 on solaris system. I m trying to deploy war file which i compiled in windows enviorment by jdk1.5.0_05. Every time i got the following error :


type Exception report

message

descriptionThe server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: PWC6033: Unable to compile class for JSP

PWC6199: Generated servlet error:
[javac] javac: invalid target release: 1.5
[javac] Usage: javac
[javac] where possible options include:
[javac] -g Generate all debugging info
[javac] -g:none Generate no debugging info
[javac] -g:{lines,vars,source} Generate only some debugging info
[javac] -nowarn Generate no warnings
[javac] -verbose Output messages about what the compiler is doing
[javac] -deprecation Output source locations where deprecated APIs are used
[javac] -classpath Specify where to find user class files
[javac] -sourcepath Specify where to find input source files
[javac] -bootclasspath Override location of bootstrap class files
[javac] -extdirs Override location of installed extensions
[javac] -d Specify where to place generated class files
[javac] -encoding Specify character encoding used by source files
[javac] -source Provide source compatibility with specified release
[javac] -target Generate class files for specific VM version
[javac] -help Print a synopsis of standard options





note The full stack traces of the exception and its root causes are available in the Sun Java System Application Server 9.1 logs.


I have cheked jvm version on both system the only difference is :

Solaris points to jdk 1.5.0_09
Windows point to jdk1.5.0_05


Even i tried to run blank jsp also but again i got the same error.


Can any help me to sort out the problem or give me any idea so i can do something by my own.

Thanks in Advance

Gagan
14 years ago
hi
1> can any one please tell me why we have premitive type of data in java rather we already have wrapper for all those data type.

2> if i wan to store the value whose size is grater than 64 bytes i mean greater than the size of evry data type which is available in java can any one please tel me how to store that value and which data type i have to use in that case.

3> how to wire code dynamically in class.

Bye
Gagan
14 years ago
hi
can any one please tell me
the maximum number of data result set can carry at a time and how he handles with that data say number of data is around 1 million.
can any one please tell me
advantage and disadvantaged of overriding a service method in servlet
15 years ago
hi peter can you please send me some demo related to that.
15 years ago
thanks for your rep
15 years ago
can we call rmi method tghrough c++ if yes then how
15 years ago