Ameya Thakur

Ranch Hand
+ Follow
since Feb 04, 2004
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 Ameya Thakur

Hello All,

I have started with a small project with JSF / Hibernate which I have tested on my local enviroment and it works fine locally when deployed on the server it is throwing the following exception for the 1st time and If I login again and try to save I get the NoClassDefFoundError

1st Error
java.lang.NullPointerException - Unable to instantiate default tuplizer [org.hibernate.tuple.entity.DynamicMapEntityTuplizer

2nd Error
Caused by:
java.lang.NoClassDefFoundError - Exception while invoking expression #{IOPPRegBean.authenticate}

I have ftp all the classes from local to the server and JSF naviagtion is working fine.. I get this error when from my handler class I try to get the Instance of HibernateUtil for saving the value.... we are been struggling like any thing from last 3 days to get it working on the server.....

Our site is hosted on godaddy.com and it is not a decdicated server....

Snippet from HibernatUtil l


Code ffrom the Handler which call HibernateUtil



Also the problem is only on the server... and everything is same even the database is same....

Any thoughts suggestion , details would be welcomed......

Thanks & Regards,
-Ameya
Hello All,

I am very new to Generics and try to get hold of it.. I am having a small assignent for Adding two methods boolean remove(E obj): and Iterator<E> iterator( ):
in the class given below...


boolean remove(E obj): Remove a piece of data from the binary search tree. Return true if the data was removed, or false if it was not in the tree to begin with. Follow the algorithm involving removing items from binary search trees.

Iterator<E> iterator( ): Return an Iterator that can iterate through the data in the tree. The iteration should be an "in-order" iteration (i.e., ascending order). Recall that iterators have the following methods:
boolean hasNext( )
T next( )
void remove( )


It does additional to the list correctly.

I just want it to return Iterator<E> ... since It looked for the implementation for these methods and found that the implementation of these method is given by in

abstract class AbstractList<E>







11 years ago
thanks for the updates .. I would write a servlet and check it ... apart from that do you see any issues in the code or it is just the container which is setting the output back to html.... is there any way where in we can enforce this behaviour through servlet as I have already set the content type in the JSP

I just looked in the genertated class and here it is .... it sets the content type back to html




Is there any other way in which we can achieve this is JSP ?
Hi I am trying a Simple Ajax Example of Populating a DropDown depending upon the value selected.... It looks pretty Starighforward.. I did most of the changes since last couple of day ....but still not able to identify the problem yet....

This is my JS Code



My HTML CODE






Any Help would be appreciated I am clueless that why I am not getting the XML request Back the code looks ok to me ... even the content type is set to text/xml
On executing following target TESTSQL I am getting following error

The <sql> task doesn't support the nested "path" element.

Is there any way in which i can execute a bunch of SQL together, I am able to execute the SQL individually , but not with the fileset.

<target name="TESTSQL" description="install the sql on dev TestThird">

<sql driver="com.microsoft.jdbc.sqlserver.SQLServerDriver"
urll="jdbc:microsoft:sqlserver://DEV_SQL:1433;
DatabaseName=TESTSQL"
userid="TESTSQL" password="TESTSQL"
classpathref="build.classpath">
<path>
<fileset dir="./">
<include name="*.sql"/>
</fileset>
</path>

Thanks in Advance
-Ameya
13 years ago
Hello Everyone,

I want the alert message which i give using javascript to be bold

I tried with using alert("<b>Hello</b>");

which is not working so is ther any ways in which we could make "Hello" bold

Thanks a lot in advance
-Ameya
Hi !!!
I am wrting a small store Proc for inserting an value and fetching the Id for the value inserted.

i.e I have Id as an identity column (auto incremented) so i wanted to know the ID for which i am doing the insert operation.

My Store Proc goes like this

CREATE PROCEDURE dbo.spInsertStackTrace
(
@StackTraceLog as varchar (4000),
@StackTest as varchar (50),
@StackTraceId as int output
) AS BEGIN
Insert Into StackTrace(StackTraceLog,StackTest)
Values(@StackTraceLog,@StackTest)
Select @StackTraceId = MAX(StackTraceId) from StackTrace

END
GO

Java CODE

Persistor myPersistor = PersistorFactory.createPersistor("ccmaster");
CallableStatement cstmt = null;
cstmt = myPersistor.prepareCall("{call spInsertStackTrace(?,?,?)}");
cstmt.setString(1,"Edwards");
cstmt.setString(2,"Efiller");
cstmt.registerOutParameter(3,java.sql.Types.INTEGER);
cstmt.execute();
int stackTraceId = cstmt.getInt(3);
System.err.println("Stack Trace Id"+stackTraceId);


with the above code i am getting the following error..


java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid parameter binding(s).


It looks pretty simple i am just not able to figure how to register the out parameter..so would some one help me and update me that would be very very great.


Thanks a lot
-Ameya

Originally posted by Henry Wong:


Do you mean something like the client's IP address, or hostname? Because, generally, the client that calls a webservice, doesn't have a URL.

Henry



The WebService is expecting the following params

String test = obj.getUrl(serviceID,sourceID,clientID,contractID,sourcePID,getCurrentURL(),userHostName,userHostAddress);

I have all other information except for the CurrentURL()

I hope i cleared your doubt.

-Ameya
14 years ago

Originally posted by Ulf Dittmer:
What is the "currentURL" of a Web service?



The webservice expects the CurrentURL as a parameter.ie from where the Service has been invoked.

-Ameya
14 years ago
The Webservice expects an Current URL as a parameter...ie from where the request was made to the webservice...I hope i cleared your doubt

-Ameya
14 years ago
I want to call a webservice for which i require the currentURL,how do we get the currentURL

I was trying java.net.InetAddress Package.

Thanks in Advance,
Ameya
14 years ago
Hi Carol!!

Ya I wanted to move from this forum to Other Open Source Projects, I gues this can be only done by the moderator.

Anyways I had tried using

package com.cs.test;
import org.apache.log4j.Category;
import org.apache.log4j.Logger;

import com.cs.core.BaseObject;

/**
* @author athakur
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class TestLog4jProperties extends BaseObject {
/**
*
*/
public TestLog4jProperties() {
super();
// TODO Auto-generated constructor stub
}
private static Logger theClassLogger;
public static void main(String[] args) throws Exception{
//org.apache.log4j.PropertyConfigurator.configure("com.cs.local.properties/log4j.properties");
//theClassLogger = Logger.getLogger(TestLog4jProperties.class);
//theClassLogger.debug("Hey This is Test I am in Log4JEventLogger ============================>222222222");
//System.err.println("Afterlogging");
try {

TestLog4jProperties obj = new TestLog4jProperties();
obj.a();
}
catch (Exception e) {
// TODO: handle exception
}

}
void a(){
System.err.println("11");
log( LOG_LEVEL_DEBUG, 1, "DEBUG ",this );
log( LOG_LEVEL_ERROR, 2, "DEBUG " ,this);
log( LOG_LEVEL_CRITICAL ,3, "CRITICAL " ,this);
log( LOG_LEVEL_WARNING ,4, "WARNING " ,this);
log( LOG_LEVEL_TRACE ,5000, "TRACE" ,this);
log( LOG_LEVEL_DETAIL ,5000, "DETAIL ",this );
System.err.println("22");
log(LOG_LEVEL_DEBUG, 5000, "DEBUG",this );
System.err.println("33");
try {
String a ="Ameya";
int b=0;
int c=5/b;
System.err.println("Erro is "+c);
}
catch (Exception e) {
System.err.println("44");
log(LOG_LEVEL_DEBUG, 5000, "DEBUG",e );
System.err.println("55");
log(LOG_LEVEL_DEBUG, 5000, "This is Event Text","This is Event Details", this,e);
System.err.println("66");
log(LOG_LEVEL_DEBUG, 5000, "This is Event Text","This is Event Details",e);
}
System.err.println("77");
log(LOG_LEVEL_DEBUG, 5000, "This is Event Text","This is Event Details", this);
//log( LOG_LEVEL_TRACE, 500, "Trace Mode" );
//log( LOG_LEVEL_CRITICAL, 500, "Critical" );
}
}



My Log4j.properties goes as follow


log4j.rootCategory=DEBUG, R, O
#Stdout
log4j.appender.O=org.apache.log4j.ConsoleAppender
#File
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=log4j.log
# Control the maximum log file
sizelog4j.appender.R.MaxFileSize=100KB
# Archive log files (one backup file here)
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.O.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=[%d{ISO8601}]%5p%6.6r[%t]%x - %C.%M(%F:%L) - %m%n
log4j.appender.O.layout.ConversionPattern=[%d{ISO8601}]%5p%6.6r[%t]%x - %C.%M(%F:%L) - %m%n




My Log4Logger class

public void logEvent(int aEventLogLevel,int aEventCategory,int aEventId,String aEventText,
String aEventDetails,Object aAssociatedObject,Object aObjectInstance,Throwable aThrowable){
String logName;
if (aObjectInstance == null) {
logName = "BaseObject";
}
else {
logName = aObjectInstance.getClass().toString();//.getName();
System.err.println("Log Name "+logName);
}
theClassLogger = Logger.getLogger(logName);

switch (aEventLogLevel) {
case 0 :
log( LOG_LEVEL_DEBUG, aEventCategory, aEventText);
break;
case 3 :
theClassLogger.debug("This is a Test"+aEventText);
break;
case 4 :
theClassLogger.debug("Fatal "+aEventText);
break;
case 5 :
theClassLogger.trace("Hey I am In Trace and My Log Level is"+LOG_LEVEL_TRACE+ "-"+aEventText);
break;
case 6 :
theClassLogger.info("aEventText "+aEventText);
break;
case 7 :
theClassLogger.info("aEventText "+aEventText);
break;
case 8 :
break;
case 9 :
theClassLogger.fatal("Fatal "+aEventText);
break;
case 10 :
theClassLogger.fatal("Fatal "+aEventText);
break;
case 11 :
break;
default :
theClassLogger.debug("This is a Been Defaulted Test"+aEventText + "-" +aEventLogLevel);
break;
}
}
Hi Carol!!!

private static Logger theClassLogger;

public void logEvent(int aEventLogLevel,int aEventCategory,int aEventId,String aEventText,String aEventDetails,Object aAssociatedObject,Object aObjectInstance,Throwable aThrowable){

String logName;
if (aObjectInstance == null) {
logName = "BaseObject";
}
else {
logName = aObjectInstance.getClass().getName();
}
theClassLogger = Logger.getLogger(logName+".class");
switch (aEventLogLevel) {
case 0 :
theClassLogger.debug(LOG_LEVEL_DEBUG, aEventCategory, aEventText);
break;
case 3 :
theClassLogger.trace(LOG_LEVEL_TRACE,aEventCategory, aEventText);
break;
default :
theClassLogger.debug(LOG_LEVEL_DEBUG, aEventCategory, aEventText);


Since we are having our Own Logging mechanism and we wish to move to LOG4J with minimal changes this is the approach which i thought would be right.

But when i try to implement this at the runtime I get an Error stating
log4j:WARN No appenders could be found for logger (com.cs.applications.corconnect.CorConnectServlet.class).
log4j:WARN Please initialize the log4j system properly.


So would you kindly suggest or give me some more inputs on the same

Thanks & have a great weekend Ahead
I am not putting log4j.debug=true, I would just try debug=true and then check it out.

I have removed the invalid appenders and then sent it acorss to you....

Currently i am not facing an issue with the file not found exception as I have created a test Project and working on that as i have lot may things to do using log4j... I have done JDBCAppenders which is good.

Also I whave a scenario over here I know log4j provides a feature where-in you can specify different Logging Level for different classes

i.e ClassA is been logged using Debug Mode and ClassB is been logged using Error mode...
Sorry that I am replying a bit late.....It is a problem and I am curious to know about it , ie why is it throwing Class Not Found Exception after reading from a file.....

I wanted to include Invalid appenders just to check whether my log4j.properties is been properly validated and loaded.Log4j.properties is present in the classpath of the project

For time been My Log4j.properties is the simplest you would find

log4j.rootLogger=DEBUG,File

log4j.appender.File=org.apache.log4j.DailyRollingFileAppender
log4j.appender.File.File=CoreConnectLogs.log
log4j.appender.File.DatePattern='.'yyyy-MMM-dd
log4j.appender.File.layout=org.apache.log4j.PatternLayout
log4j.appender.File.append=true

log4j.appender.File.layout.ConversionPattern = %d | %5p | [%t] | %c:%M(%L) | %m %n


The code from where I am trying to acess the code is
1st Approach
PropertyConfigurator.configure("com.cs.local.properties/log4j.properties");

and
2nd Approach
Properties myProp = ResourceUtils.getResourceAsProperties("com.cs.local.properties/log4j.properties");
System.out.println(myProp);
PropertyConfigurator.configure(prop);

over here my SOP reads from the log4j.properties and prints it..but does not validates it.....


so I was just curious to know about the same

Thanks & Regards,
Ameya