Vamsi Mohan Pemmaraju

Greenhorn
+ Follow
since Jul 15, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Vamsi Mohan Pemmaraju

Hi,
I am using springs IOC in my application. When starting my server it is throwing an exception as given below:

org.springframework.beans.factory.BeanDefinitionStoreException: Parser configuration exception parsing XML from ServletContext re
source [/WEB-INF/applicationContext.xml]; nested exception is javax.xml.parsers.ParserConfigurationException: Unable to validate
using XSD: Your JAXP provider [org.apache.crimson.jaxp.DocumentBuilderFactoryImpl@484c6b] does not support XML Schema. Are you ru
nning on Java 1.4 or below with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support.
Caused by: javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.crimson.j
axp.DocumentBuilderFactoryImpl@484c6b] does not support XML Schema. Are you running on Java 1.4 or below with Apache Crimson? Upg
rade to Apache Xerces (or Java 1.5) for full XSD support.

I am using JDK 1.4 and sun one application server.

Request any one to guide me.

Thanks
Vamsi
16 years ago
Hi kesav,

I have tried that but I am facing the same problem saying "Cannot find the bundle".

Regards,
Vamsi
16 years ago
I have placed the properties file in classes folder earlier. But I am receiving the same error.
17 years ago
Hi,

I have ApplicationResources_en_US.properties placed in WEB-INF/.
<message-resources> tag is also declared in struts config.xml.
When accessing the application. I recieve an error message saying:

Can't find bundle for base name D:\Sun\AppServer7\domains\domain1\server1\applications\j2ee-modules\request_1\properties\ApplicationResources_en_US.properties, locale en_US

How do I resolve the problem?

Thanks
Vamsi
17 years ago
Hi

I would like to know the coverage of the OOP's concept in scjp5.0 exam.

Regards
Vamsi Mohan
Hai,

Firstly I am not sure this topic falls under this section. Guide me regarding this.

I am using Sun One Application Server 7.0. I would like to know how to create certificates using openssl and install in Appserver.

Regards,
Vamsi Mohan
17 years ago
Thanks for the reply Ben,

I am using Sun One Application Server 7.0

regards
P. Vamsi Mohan
17 years ago
JSP
Hi,

I am new to spring MVC. I am facing problem with the tab libraies.

I have include.jsp as :

<%@ page session="false"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>

index.jsp as :

<%@ include file="/ui/jsp/include.jsp" %>

<%-- Redirected because we can't set the welcome page to a virtual URL. --%>
<c:redirect url="/hello.htm"/>

When I start running the application an Error is fired saying:

SEVERE: StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
org.apache.jasper.compiler.CompileException: /ui/jsp/index.jsp(0,0) This absolute uri (http://java.sun.com/jstl/core) cannot b
e resolved in either web.xml or the jar files deployed with this application
at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEventListener.java:822)
at org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingListener.java:125)
at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:255)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1147)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1105)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1101)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:239)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:227)
at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.loadJSP(JspServlet.java:641)
at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.access$000(JspServlet.java:501)
at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:322)
at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:287)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)

I would be thankful for any help.

Regards,
P. Vamsi Mohan
17 years ago
JSP
What is the diference between Arraylist<String> and ArrayList>?

Of course I understand that ArrayList<String> specifies that it holds objects of type String.

Any Implementation differences when using Generics??

Regards
P.Vamsi Mohan
Hi,
I have just started peeping into jdk 1.5.

Generics were introduced so as to avoid the type casting for objects when retrieved from a collection. This feature is quite helpfull but i need some clarifications.
I have written a class as :

public class Test {
public static void main(String args[]) {
Test t = new Test();
ArrayList<String> a = new ArrayList();
a.add("a");
a.add("b");
a.add("c");
a.add("d");
a.add("e");
t.arrayListTest(a);
}
//******* generics in Collections **********//
public void arrayListTest(ArrayList a) {
for (int i=0; i < a.size();i++) {
String str1 = a.get(i);
System.out.println(str1);
}
}
}

When the java class is compiled,
I recieve an error saying "Cannot convert from Object to String"
at
String str1 = a.get(i);

I would like to know why is the generic type set for ArrayList a in main() is not applicable inside arrayListTest() method.

Regards
P. Vamsi Mohan
Hi,

In hibernate updation of data is done using session.save() or session.saveOrUpdate().

In addition in Hibernate there is a provision for executing queries explicitly using session.createQuery().

After using session.saveOrUpdate() or the other method I found hibernate executing a select query and then a update or delete query.

Which method is preferred? I suppose the first way will be causing an overhead to the DB.

regards,
Vamsi Mohan
Problem with <composite-id>
---------------------------

I have two table definitions:

COMPONENT : CMPNT_ID NUMBER(3), CMPNT_TECH_ID, CMPNT_NM VARCHAR2(50)
COMPONENTTECH : CMPNT_TECH_ID NUMBER(3), CMPNT_TECH_NM VARCHAR2(60)

THE DEFINITIONS FOR THE *.HBM.XML ARE AS BELOW:
1) COMPONENT.HBM.XML
<hibernate-mapping>
<class name="events.Component" table="COMPONENT">
<composite-id name="cmpnt_id" class="events.Component">
<key-property name="cmpnt_id"/>
<key-property name="cmpnt_tech_id"/>
</composite-id>
<property name="cmpnt_nm"/>


<many-to-one name="cmpnt_tech_id" class="events.ComponentTech" insert="false" update="false">
<column name="cmpnt_tech_id"/>
</many-to-one>
</class>
</hibernate-mapping>

2) COMPONENTTECH.HBM.XML
<hibernate-mapping schema="PRTL_S01">
<class name="events.ComponentTech" table="COMPONENTTECH">
<id name="cmpnt_tech_id" type="long" unsaved-value="null">
<column name="cmpnt_tech_id" sql-type="number" not-null="true"/>
</id>
<property name="cmpnt_tech_nm" type="string" column="CMPNT_TECH_NM" not-null="true"/>
</class>
</hibernate-mapping>

My code was:
public String retrieve(Long cmpnt_id) {
Component e = (Component)session.load(Component.class.getName(), cmpnt_id);
return e.getCmpnt_nm();
}

I was not succesful in executing with the above configurations. the error was:
org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class events.Component, got class java.lang.Long

Another thing is, do we need to have individual .hbm.xml for each class or can we club two class definitions in one. If yes, are there any restrictions or conditions.

Regards,
Vamsi Mohan
Thanks Mark,

Your suggestion was very useful. I have solved the my problem.

Regards,
Vamsi Mohan
[ July 16, 2007: Message edited by: Vamsi Mohan Pemmaraju ]
Hi,
I am new to hibernate and have come across some hurdles which I could solve.
I am stuck with one error saying Table is not mapped. I am using Oracle DB.

Event.hbm.xml:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="events.Event" table="Event" schema="test">
<id name="event_id" type="string" unsaved-value="null">
<column name="EVENT_ID" sql-type="varchar2" not-null="true"/>
</id>
<property name="event_nm" type="string" column="EVENT_NM" not-null="true"/>
</class>
</hibernate-mapping>

HIBERTNATE.CFG.XML:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>

<!-- Database connection settings -->
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver </property>
<property name="connection.url">jdbc racle:thin:@test:1521:TEST</property>
<property name="connection.username">test</property>
<property name="connection.password">test</property>

<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>

<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.OracleDialect</property>

<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>

<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>

<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>

<mapping resource="Event.hbm.xml"/>

</session-factory>

</hibernate-configuration>

EVENTMANAGER.JAVA:
package events;
import org.hibernate.Session;
import org.hibernate.impl.QueryImpl;
import java.util.Date;
import java.util.ArrayList;
import java.util.Iterator;
import java.sql.SQLException;

import util.HibernateUtil;

public class EventManager {

public static void main(String[] args) {
EventManager mgr = new EventManager();
try {
//mgr.store(new Integer(1), new Integer(1));
mgr.store("5","abc");
} catch(Exception sqle) {
sqle.printStackTrace();
}

HibernateUtil.getSessionFactory().close();
}

private void store(String env_id, String title) {

Session session = HibernateUtil.getSessionFactory().getCurrentSession();

session.beginTransaction();


QueryImpl impl = (QueryImpl)session.createQuery("from EVENT");
Iterator it = impl.iterate();
while(it.hasNext()) {
Event event = (Event)it.next();
System.out.println(event.getEvent_id());
System.out.println(event.getEvent_nm());
}

session.getTransaction().commit();
}
}

Aftr executing the above script; I recieve the message:

D:\projects\springHibn>ant run
Buildfile: build.xml

prepare:
[copy] Copying 1 file to D:\projects\springHibn\war\WEB-INF
[copy] Copying 1 file to D:\projects\springHibn\war\properties

compile:

run:
[java] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
[java] log4j:WARN Please initialize the log4j system properly.
[java] org.hibernate.hql.ast.QuerySyntaxException: TEST.EVENT is not mapped [from EVENT]
[java] at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:158)
[java] at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:87)
[java] at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:70)
[java] at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:255)
[java] at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3056)
[java] at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945)
[java] at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
[java] at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
[java] at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
[java] at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
[java] at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
[java] at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
[java] at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
[java] at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
[java] at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
[java] at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
[java] at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
[java] at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
[java] at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:324)
[java] at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
[java] at $Proxy0.createQuery(Unknown Source)
[java] at events.EventManager.store(EventManager.java:44)
[java] at events.EventManager.main(EventManager.java:17)

It would be nice if anyone provides me the solution.