ganesh pol

Ranch Hand
+ Follow
since Apr 29, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by ganesh pol

problem

I want to use hibernate with JTA transaction in weblogic application server
where my service layer is designed in pojo and wants to handle programmetic JTA transactions

my configuration file for hibernate is



for above config file i got messages on my server console as

18:22:41,432 INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions)18:22:41,448 INFO TransactionManagerLookupFactory:38 - instantiating TransactionManagerLookup: org.hibernate.trans
action.WeblogicTransactionManagerLookup
18:22:41,464 INFO TransactionManagerLookupFactory:42 - instantiated TransactionManagerLookup

looking for earliest response from your end
[ August 06, 2008: Message edited by: ganesh pol ]
i am facing some problem while uploading multiple files

attributes in my form bean
private Collection carImages;
//getters and setters

i tried with FormFile array , also with ArrayList but it throws me following exception


java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1773)
at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:1759)
at org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1648)
at org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1677)
at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1022)
at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298)

i tried to post my jsp code but it creates problem while posting hence

view related code is at this
location

looking for earliest help
[ November 26, 2007: Message edited by: ganesh pol ]
17 years ago
i want to load page as follows

var frame = document.createElement('iframe');
frame.src = "/birthDayReminder/search.htm";

here i am giving context name as hard coded value

is there any way to get this context name dynamically

some work around in java is
1] define hidden variable like
<input type="hidden" id="contextName" value="<%=request.getContextPath()%>">

2] access this variable in java script as follows
var contextName=document.getElementById("contextName");frame.src = contextName.value+"/search.htm";
[ October 29, 2007: Message edited by: ganesh pol ]
17 years ago
JSP
Thanks for both of your reply

some more questions comes in my mind

consider following use case

1] user logged in
my login controller or service object will use following business logic when user is authenticates
i]when username password provided by user matche with any record in my user table i will keep that record in HttpSession in some value object
ii]i am updating flag for user record that he/she logged in and updating his last logged in time

now consider following 2 scenarios
2.1]user is using my application and then he clicks logged out
i] in my logout service or controller i will update flag for user record that he has logged out
ii]i will terminates user's HttpSession object
here we get success as we expect

2.2]user started application and browser is idle for long time
i]session get terminated
imp note i observed one thing although my session is terminated HttpSession object is not null

is there is any way that when server terminates user's session how to update this user is logged out

i.e. is there is any way that when server wants to terminate user session my code will intercept and updates is logged out flag in database

[ October 01, 2007: Message edited by: ganesh pol ]
17 years ago
while accessing my net banking account
i observed one nice thing
once by mistake i close the net banking window without logout(i know this is not nice thing)

i tried to login again after somewhere around 2 min in that case my net banking application gives me message like your last logging is not properly terminated
and make me unable to access system.

i am not the hardcore client side developer but this thing increase my curiosity how to implement this logic in some simple application

can any one give me some kind of hint to solve this issue

how could it possible for my server side code that some one closed window without logout

[ September 29, 2007: Message edited by: ganesh pol ]
[ September 29, 2007: Message edited by: ganesh pol ]
17 years ago
hi ,

i am using
bea weblogic 8.1
servlet specifications 2.3
and struts

Following JSP works fine in Apache Tomcat 5.5.23 and JBOSS
application server 4.2


<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>


<html>

<head>
<title>Login</title>
</head>
<body>
<html:form action="/login">
<table align="center" width="50%">
<table align="center" width="50%">
<tr>
<td>
User Name
</td>
<td>
<html:text property="userName" value="" />
</td>
</tr>
<tr>
<td>
Password
</td>
<td>
<html assword property="password" value=""/>
</td>
</tr>
</table>
<table align="center" width="50%">
<tr align="center" width="50%">
<td align="center" width=25%>
<input type="submit" value="login"/>
</td>
</tr>
</table>
</table>
</html:form>
</body>
</html>


similarly web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>


<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>30</session-timeout>
</session-config>

<taglib>
<taglib-uri>/WEB-INF/tld/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/tld/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/tld/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>
</taglib>

<welcome-file-list>
<welcome-file>/WEB-INF/views/common/login.jsp</welcome-file>
</welcome-file-list>

</web-app>






but when i deployed this application on bea weblogic 8.1
weblogic console gives me following exception


<May 16, 2007 6:17:58 PM IST> <Warning> <HTTP> <BEA-101248> <[C:\bea\user_projects\domains\mydomain\sc.war]: Deployment descriptor
"web.xml" is malformed. Check against the DTD: org.xml.sax.SAXParseException: The content of element type "web-app" must match "(
icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session
-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,s
ecurity-role*,env-entry*,ejb-ref*,ejb-local-ref*)". (line 44, column 11).>

<May 16, 2007 6:17:58 PM IST> <Warning> <HTTP> <BEA-101247> <C:\bea\user_projects\domains\mydomain\lesson1.war: Public ID referenc
es the old version of the Servlet DTD. You must change the public ID in web.xml file to "-//Sun Microsystems, Inc.//DTD Web Applic
ation 2.3//EN".>
<May 16, 2007 6:17:58 PM IST> <Warning> <HTTP> <BEA-101248> <[C:\bea\user_projects\domains\mydomain\lesson1.war]: Deployment descr
iptor "web.xml" is malformed. Check against the DTD: org.xml.sax.SAXParseException: The content of element type "web-app" must mat
ch "(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,se
ssion-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-conf
ig?,security-role*,env-entry*,ejb-ref*)". (line 19, column 11).>
log4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResources).
log4j:WARN Please initialize the log4j system properly.
<May 16, 2007 6:17:58 PM IST> <Notice> <WebLogicServer> <BEA-000331> <Started WebLogic Admin Server "myserver" for domain "mydomai
n" running in Development Mode>
<May 16, 2007 6:17:58 PM IST> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>
<May 16, 2007 6:17:58 PM IST> <Notice> <WebLogicServer> <BEA-000355> <Thread "ListenThread.Default" listening on port 7001, ip add
ress *.*>
<May 16, 2007 6:19:12 PM IST> <Error> <HTTP> <BEA-101020> <[ServletContext(id=14763676,name=sc,context-path=/sc)] Servlet failed w
ith Exception
weblogic.servlet.jsp.JspException: (line 1): Error in using tag library uri='/WEB-INF/tld/struts-bean.tld' prefix='bean': The Tag
class 'org.apache.struts.taglib.bean.IncludeTag' has no setter method corresponding to TLD declared attribute 'name', (JSP 1.1 spe
c, 5.4.1)
at weblogic.servlet.jsp.StandardTagLib.tld_jspException(StandardTagLib.java:1245)

at weblogic.servlet.jsp.StandardTagLib.parseTagDD(StandardTagLib.java:1373)
at weblogic.servlet.jsp.StandardTagLib.parseDD(StandardTagLib.java:1271)
at weblogic.servlet.jsp.StandardTagLib.<init>(StandardTagLib.java:292)
at weblogic.servlet.jsp.TagLibHelper.loadTagLib(TagLibHelper.java:314)
at weblogic.servlet.jsp.JspLexer.loadTagLib(JspLexer.java:145)
at weblogic.servlet.jsp.JspLexer.mTAGLIB_DIRECTIVE_BODY(JspLexer.java:5004)
at weblogic.servlet.jsp.JspLexer.mTAGLIB_DIRECTIVE(JspLexer.java:4842)
at weblogic.servlet.jsp.JspLexer.mDIRECTIVE(JspLexer.java:4688)
at weblogic.servlet.jsp.JspLexer.mSTANDARD_THING(JspLexer.java:2093)
at weblogic.servlet.jsp.JspLexer.mTOKEN(JspLexer.java:1879)
at weblogic.servlet.jsp.JspLexer.nextToken(JspLexer.java:1752)
at weblogic.servlet.jsp.JspLexer.parse(JspLexer.java:962)
at weblogic.servlet.jsp.JspParser.doit(JspParser.java:105)
at weblogic.servlet.jsp.JspParser.parse(JspParser.java:228)
at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:120)
at weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java:258)
at weblogic.servlet.jsp.JspStub.compilePage(JspStub.java:364)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:220)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:172)
at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:504)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:349)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:431)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6310)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3622)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2569)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
>




can any one give me solution for it
[ May 16, 2007: Message edited by: ganesh pol ]
17 years ago
I am new to web servcies .
On the net i found various implementaions
of ESB(Enterprise service bus) such as Open ESB(sun's implementaion),Service Mix(apache's implementaion)
how should i compare these various ESBs which are using JBI (Java Business Integration)
I have'nt find proper section on java ranch for JBI or ESB hence i am posting this message here since these technologies are related to web services
[ May 03, 2007: Message edited by: ganesh pol ]
17 years ago
Hay... someone should give answer to it
I am searching for it from last 2 days on web also
17 years ago
Hi All,
I am new to portals and experimenting with available portlets

I want to know what is subtle difference between local and remote preference

The idea behind asking this question is as follows

1] i got success in configuring my wsrp proxy with edit Local Preferences
as steps explained in this url
http://content.liferay.com/4/docs/ppt/wsrp/wsrp-portlets.ppt

2] now i tried following to access remote portlet
2.1] started second instance of liferay on other machine
in this case this other machine will act as producer
and my machine will act as consumer

2.2] through browser i just call my machine
and added wsrp proxy content to my page

2.3] now page shows me 2 links
edit local preferences
and edit remote preferences

2.4]since i want to access portlet running on other machine
i click edit remote preferences
i got error message like
Portlet is temporarily unavailable

2.5] so i moved back to same page which shows me two links
edit local preferences
and edit remote preferences

2.6] and clicked on edit local preferences
at this time i got proper window
here i just change
http://localhost:8082/c/wsrp
to
http://ps2740:8082/c/wsrp
where ps2740 is machine name on which 2nd instance of liferay is running
now my question is that how to call remote preferences
[ April 25, 2007: Message edited by: ganesh pol ]
17 years ago
This is one of the main issue in designing the javascript.
i want to know is it possible for me to check if client's browser support javascript
i am having requiremnt for getting id value of my html element
eg.

<th id="test1" width="5%">Attempted RRC Connection</th>

in above case test1 is value of my th element
how should i get it using javascript
following is part of my code for creating JAR File

public class JarFileManager {

/**
*
*/
public JarFileManager() {
super();
// TODO Auto-generated constructor stub
}

public static JarOutputStream getJarOutPutStream(String fileLocation){
JarOutputStream jarOutPutStream=null;
try{
jarOutPutStream=new JarOutputStream(new FileOutputStream(fileLocation));
}catch(IOException ioException){
ioException.printStackTrace();
}
return jarOutPutStream;
}

public static void createJarFile()throws Exception{
String directoryLocation="/home/g.pol/projects/practice/binaryTransfer/classes";
String outFileLocation="/home/g.pol/Desktop/Out.jar";
JarOutputStream jarOutPutStream=getJarOutPutStream(outFileLocation);

FileInputStream in = new FileInputStream(directoryLocation);
}

/**
* @param args
*/
public static void main(String[] args)throws Exception {
createJarFile();

}
}

initially i was just thinking that if we provide directory location then java code will create jar with all the folders beloow that directory

but i got following exception i know this is not correct way to create FileInputStream for directory
bu how should i create jar which contains my packages
Exception in thread "main" java.io.FileNotFoundException: /home/g.pol/projects/practice/binaryTransfer/classes (Is a directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at JarFileManager.createJarFile(JarFileManager.java:42)
at JarFileManager.main(JarFileManager.java:49)

my question is that how to create jar file if i know that at
/home/g.pol/projects/practice/binaryTransfer/classes

i have all my .class files in package struture
18 years ago
Dear friends,
i want some hint if i have diffenet images files of type .jpeg, bmp etc then can any one tell me how should i convert it to .png file
i searched the java api but i did not got any clue
similarly i have requirement for conversion of audio files to .midi format
and video files to .3gp format can any one send me java code or link to write such type of conversion code
it would be great help to me
18 years ago
This is reply to my post

now my code works fine


i have made some changes in my jsp code which my tagLibs Guru Mahesh has explained me some time before




<%
String requestURI="request.getContextPath()/a.c";
%>


<display:table name="users"
id="user"
class="dataTable"
export="true"
requestURI="<%=requestURI%>"
requestURIcontext="true"
pagesize="2"
decorator="org.displaytag.decorator.TotalTableDecorator">
<display:column title="Record Number" headerClass="th1" class="cellText">
<%=pageContext.getAttribute("user_rowNum")%>
</display:column>
<display:column property="firstName" title="firstName" maxLength="10" headerClass="th1" class="cellText" />
<display:column property="middleName" headerClass="th1" class="cellText"/>
<display:column property="lastName" headerClass="th1" class="cellText"/>
<display:column property="email" headerClass="th1" class="cellText"/>
<display:column property="age" headerClass="th1" class="cellText"/>
<display:column property="dateOfJoin" headerClass="th1" class="cellText"/>
<display:setProperty name="paging.banner.placement" value="bottom" />
</display:table>


where requestURI is nothing but my controllers url mapping


which i did in web.xml as

<servlet-mapping>
<servlet-name>displayTagTest</servlet-name>
<url-pattern>*.c</url-pattern>
</servlet-mapping>

a.c is url mapping of my controller from where i got list
[ November 24, 2006: Message edited by: ganesh pol ]
18 years ago
JSP
you can use display tag libs

we can do pagination in jsp with help of it

http://displaytag.sourceforge.net/10/install.html

https://coderanch.com/t/291051/JSP/java/display-tag-pagination
[ November 24, 2006: Message edited by: ganesh pol ]
18 years ago
JSP