ramaa Vadakattuu

+ Follow
since Oct 12, 2007
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 ramaa Vadakattuu

I have a form where the user has to enter an URL
This enter URL string is automatically converted to URL Object by the default editors which Spring has been provided.

Suppose if i entered a String Other that an URL(or a URL which is not properly formatted)

like "httpwww.javaranch.com" ===> Binding to an URL object is being failed and showing the following errors on the form as

" Failed to convert property value of type [java.lang.String] to required type [java.net.URL] for property 'blogurl'; nested exception is java.lang.IllegalArgumentException: Could not retrieve URL for class path resource [adfaf]: class path resource [adfaf] cannot be resolved to URL because it does not exist"

How to replace the above error with the UserFreindly error?
If any one has any clue please guide me.

Do you have any JSPs in your application?
JSPs, by default create sessions automatically.

Sorry actually Iam moving to the servlet via index.jsp.
This index.jsp is creating the sessions automatically.
THanks for your reply.
11 years ago
no JSPs are there
1) it is an intial request to the servlet.
>>Out of curiosity, why do you want to suppress the creation of sessions?
>>If you're not doing anything with them, their creation

2) Some where in the Java code iam basing my decision on this
for example
for a request
If already session is there (he is logged in user)
//loggedin user
//do some stuff
else if no session is there
//new user
// do some other stuff

the above statements in Java look like this
if(request.getSession(false) is not null)
//logged in User
//New user who has not logged in

As the apache is creating session automatically never i am going to else loop.

I hope your understand the above scenario.

The only this i really need to undestand is why it is creating the session automatically ? Can we prevent such automatic creation?
11 years ago
I am working on Eclipse IDE
I encountered the following problem
1) if i use the absolute path for the parameter File in appender like below
<appender name="ROLLING" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="D:/sample.log"/>

Then i am able to see the log file at that path.
if i use relative path for the parameter File in appender like below

<appender name="ROLLING" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="sample.log"/>

I could not able to find the file no where in the drive where the Web-App is running.

I could not able to find out why it is behaving like this?
Can anyone please guide me on how to resolve the above issue?
11 years ago
In one of my servlets i have written the following code

HttpSession session = request.getSession(false);

(i.e if already session is there then only give me back the session otherwise return null)

The above statement is always returning a session even though i have not created a session explicitly.It is never returning a null.

I assume Tomcat by default is creating session. Can we prevent TOmcat from creating the session automatically?

11 years ago
I have been trying to resolve the above error for the last one day.
But i could not.
The below exception is occuring when iam trying to access Spring-Hibernate XML Configuration files from the controller code.

Below i copied down the
1) Exception Details
2) Spring-hibernate.xml file
3) sample.hbm.xml
4) snippet of COntroller Code.

Can anyone please guide me on how to resolve this issue.
Below are the details of the Exception.

Exception Details
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in class path resource [hibernate/spring-hibernate.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from invalid mapping
org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1174)
org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:425)

Spring-hibernate.xml file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
<property name="driverClassName"> <value>com.mysql.jdbc.Driver</value>
<property name="url">
<property name="username"><value>rama</value></property>
<property name="password"><value>rama</value></property>

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<property name="hibernateProperties">
<prop key="hibernate.dialect">org.hibernate.dialect.MySQ LDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.generate_statistics">true</prop>


<bean id="MyBean2Dao" class="com.prospring.dao.HibernateMyBean2DAO">
<property name="sessionFactory"> <ref local="sessionFactory"/> </property>

sqlmap====>sample.hbm.xml is as below
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"

<hibernate-mapping auto-import="true" default-lazy="false">
<class name="com.prospring.controller.MyBean2" table="test">
<property name="a1" column="a1" type="java.lang.String"/>
<property name="a2" column="a2" type="java.lang.String"/>


Snippet of Controller COde is as below
ApplicationContext context = new ClassPathXmlApplicationContext("/hibernate/spring-hibernate.xml");
MyBean2DAO m2 = (MyBean2DAO)context.getBean("MyBean2Dao");

I rechecked the xml configuration file many times still i could not able to find out the error. Can anyone please guide me on how to resolve this issue?