Manoj Tyagi

Ranch Hand
+ Follow
since Jun 11, 2002
Merit badge: grant badges
For More
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 Manoj Tyagi

Hi All,

I was running a web application in JRun3 successfully. Now I have to port it to JRun 4. But I am getting following error in running few of my JSPs...

jrunx.compiler.DefaultCFE: Compiler errors:
Found 4 semantic errors compiling "/data/jrun/servers/liv2luv/default-ear/dating/WEB-INF/jsp/jrun__profileSrchnew2ejsp13.java":

122. } while(_tag0.doAfterBody() == javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN);
<----------------->
*** Error: No method named "doAfterBody" was found in type "jrun/jsp/tags/Forward".


122. } while(_tag0.doAfterBody() == javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN);
<---------------------------------------------->
*** Error: No field named "EVAL_BODY_AGAIN" was found in type "javax/servlet/jsp/tagext/BodyTag".


193. } while(_tag1.doAfterBody() == javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN);
<----------------

Can anyone let me know why it is coming, Is there some goof-up in installation or what???

Thanks

Manoj
19 years ago
JSP
Hi All,

I was running a web application in JRun3 successfully. Now I have to port it to JRun 4. But I am getting following error in running few of my JSPs...

jrunx.compiler.DefaultCFE: Compiler errors:
Found 4 semantic errors compiling "/data/jrun/servers/liv2luv/default-ear/dating/WEB-INF/jsp/jrun__profileSrchnew2ejsp13.java":

122. } while(_tag0.doAfterBody() == javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN);
<----------------->
*** Error: No method named "doAfterBody" was found in type "jrun/jsp/tags/Forward".


122. } while(_tag0.doAfterBody() == javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN);
<---------------------------------------------->
*** Error: No field named "EVAL_BODY_AGAIN" was found in type "javax/servlet/jsp/tagext/BodyTag".


193. } while(_tag1.doAfterBody() == javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN);
<----------------

Can anyone let me know why it is coming, Is there some goof-up in installation or what???

Thanks

Manoj
19 years ago
Dear All,

I am trying to send mail from JSP page in the following way :

try {
StringBuffer actv_msgstr = new StringBuffer();
Properties props = System.getProperties();
props.put("mail.smtp.host", "my_mail_host");
props.put("mail.smtp.port","25");
Message actv_msg = new MimeMessage(Session.getDefaultInstance(props, null));
InternetAddress[] actv_to = InternetAddress.parse("manoj.tyagi@xxxxxxxx.com");
actv_msg.setRecipients(Message.RecipientType.TO, actv_to);
actv_msg.setFrom(new InternetAddress("manoj_k_tyagi@yyyyyyy.com"));
actv_msg.setSubject("Hi");
actv_msgstr = new StringBuffer();
actv_msgstr.append("I am here too");
actv_msg.setContent(actv_msgstr.toString(),"text/plain");
Transport.send(actv_msg);
System.out.println("Joke-Mail sent to ");
out.println("Mail Sent : ");
} catch(Exception e) {
System.out.println("Error in sending joke-mail to : "+ e);
out.println("Mail Sent Error : "+e );
}

This code run perfectly fine in Tomcat 3(with jdk1.3.1), but when I try to run it in Tomcat 5(with jdk1.4.2), I get the following error :

HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: com/sun/activation/registries/MailcapFile
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
org.apache.jsp.whatever.manoj11_jsp._jspService(manoj11_jsp.java:141)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


root cause

java.lang.NoClassDefFoundError: com/sun/activation/registries/MailcapFile
javax.activation.MailcapCommandMap.<init>(MailcapCommandMap.java:98)
javax.activation.CommandMap.getDefaultCommandMap(CommandMap.java:44)
javax.activation.DataHandler.getCommandMap(DataHandler.java:136)
javax.activation.DataHandler.getDataContentHandler(DataHandler.java:568)
javax.activation.DataHandler.getInputStream(DataHandler.java:222)
javax.activation.DataHandlerDataSource.getInputStream(DataHandler.java:658)
javax.mail.internet.MimeUtility.getEncoding(MimeUtility.java:102)
javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:949)
javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:1608)
javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1589)
javax.mail.Transport.send(Transport.java:76)
org.apache.jsp.whatever.manoj11_jsp._jspService(manoj11_jsp.java:125)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


note The full stack trace of the root cause is available in the Tomcat logs.


Is there any thing wrong in the classpath or Tomcat classpath etc. Can anybody help me out what is this problem & How can I get rid of this..

Please help me,

Thanks

Manoj
19 years ago
Dear All,

I am calling EJBs from my tomcat JSP applications.
Earlier I was using Tomcat 3.2.1 with j2se 1.3.1 & EJB was on another server on JoNas.

Now I have changed my Tomcat version to 5.0.2 & all other settings & environment is same.

But I am getting following error while calling EJB :


2004-10-18 10:21:50 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.io.InvalidClassException: JOnASGCRemote_Stub; Local class not compatible: stream classdesc serialVersionUID=-1247224425374412508 local class serialVersionUID=-5817563066907039541
java.io.InvalidClassException: JOnASGCRemote_Stub; Local class not compatible: stream classdesc serialVersionUID=-1247224425374412508 local class serialVersionUID=-5817563066907039541
at java.io.ObjectStreamClass.validateLocalClass(ObjectStreamClass.java:523)
at java.io.ObjectStreamClass.setClass(ObjectStreamClass.java:567)
at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:936)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at JOnASGCHome_Stub.create(JOnASGCHome_Stub.java:38)
at org.apache.jsp.gc.inch8_jsp._jspService(inch8_jsp.java:97)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:742)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:542)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:1002)
at org.apache.jsp.gc.TOI_002dGC20_jsp._jspService(TOI_002dGC20_jsp.java:716)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:509)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:484)


Can any one let me know what is this error.

Is there anything required at JSP end to call EJB (Except home & remote interface and their rmi stubs, which are already thier).

Is there any jar file or so required from the EJB server end (Like some JoNas specific or so).


If any one has some idea please help me out..


Thanks,


Manoj
19 years ago
Hi All,

I have 2 web-applications in Tomcat 5. Now for Java I have j2sdk1.4.2 & j2sdk1.3..

Now One of my application needs j2sdk1.4.2 while other can run only with
j2sdk1.3.. (This is an old project & there are java class package norms - like every class should be in a package to import it now. But earlier it was not strict).

Means this is absoulte for me to run one application with version 1.3 while other with 1.4.

But I can set Java_Home env. varibale only once. How can I tell my each web-application to take thier own jdk version in compiling & running.
Is this allowed in J2EE/Web-Containers.

Please suggest if there is any such setting which makes it possible.

THanks you all in advance...

Manoj
19 years ago
Thanks Ashish for the suggestion..

But issue is that I have to port existing project which has 100-150 jsp files having 1000 of import statements. That does not seems to be feasible.

I want to know whether this is compiler issue & whether I have any way around this my some simple setting or so as code/project is perfectly compiling & running with j2sdk1.3.1 & I just want ot take it to j2sdk1.4.2..

Please sugggest if any thing else i could do......

Thanks & waiting for some more help

Manoj
19 years ago
Hi All,

I am facing a surprising problem. I have 2 java class files. I write the import statement for second one in the first one. There is no package & these are in the same directory. I have compiled the second one. But when I try to compile the First one. Javac throws error at import statement like below :

D:\Clubs\oct\6>javac -d . ManojTest.java
ManojTest.java:1: '.' expected
import SessionBean;
^
1 error


My Java Files are as below :

import SessionBean;
public class ManojTest
{

public static void main(String args[])
{

}
}
//ManojTest.java

******************************
public class SessionBean
{

public static void main(String args[])
{

}
}
//SessionBean.java

I have compiled SessionBean.java successfully but when I try to compile ManojTest.java I get error mentioned above.

However this probelm comes when I use j2se 1.4.2.. but works in j2se 1.3.1..

Another way could be I use package structure.

But I can't do any of these, as I have to port my big project to j2se1.4.2.. from j2se1.3.1.. (Live project is running on Tomcat).

Problems is similar in Unix & Windows both.

Is this javac compiler issue or there is some setting which I can make.
I have already included . (dot) in PATH & CLASSPATH environment varibales.

Please help me out if there is any way around this, as i am stuck up in between

thank you

Manoj
19 years ago
Hi All,

I am facing a problem in calling Bean with useBean tag in JSP in Tomcat environment.

The problem comes when I use NetBeans 3.5.1 , internal tomcat server as well as Sun J2EE 1.3 server - internal tomcat server.

Surprising the code perfectly works in JRun enviornment. I am putting code here......

My Bean :

public class SampleBean extends Object implements java.io.Serializable {

private static final String PROP_SAMPLE_PROPERTY = "SampleProperty";

private String sampleProperty;

private PropertyChangeSupport propertySupport;

/** Creates new SampleBean */
public SampleBean() {
propertySupport = new PropertyChangeSupport( this );
}

public String getSampleProperty() {
return sampleProperty;
}

public void setSampleProperty(String value) {
String oldValue = sampleProperty;
sampleProperty = value;
propertySupport.firePropertyChange(PROP_SAMPLE_PROPERTY, oldValue, sampleProperty);
}


public void addPropertyChangeListener(PropertyChangeListener listener) {
propertySupport.addPropertyChangeListener(listener);
}

public void removePropertyChangeListener(PropertyChangeListener listener) {
propertySupport.removePropertyChangeListener(listener);
}

}

My JSP :

<%@page contentType="text/html"%>
<jsp:useBean id="id" class="SampleBean" />
<html>
<head><title>JSP Page</title></head>
<body>
<table>
<tr>
<td>JSP is running!
</td>
</tr>
<td>
<jsp:getProperty name="id" property="sampleProperty" />
</td>
</tr>
</table>
</body>
</html>

I got compilation error in JSP as below :

TestJSP$jsp.java [60:1] cannot resolve symbol
symbol : class SampleBean
location: class org.apache.jsp.TestJSP$jsp
SampleBean id = null;
^
TestJSP$jsp.java [63:1] cannot resolve symbol
symbol : class SampleBean
location: class org.apache.jsp.TestJSP$jsp
id= (SampleBean)
^
TestJSP$jsp.java [68:1] cannot resolve symbol
symbol : class SampleBean
location: class org.apache.jsp.TestJSP$jsp
id = (SampleBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "SampleBean");
^
TestJSP$jsp.java [105:1] cannot resolve symbol
symbol : class SampleBean
location: class org.apache.jsp.TestJSP$jsp
out.print(JspRuntimeLibrary.toString((((SampleBean)pageContext.findAttribute("id")).getSampleProperty())));
^
4 errors
Errors compiling TestJSP.

I have put my JSP in web-base directory & SampleBean.class file in \web-inf\classes directory as per the standard structure way.

It runs perfectly in JRun, But gives problem in Tomcat...

Is there any extra setting for Tomcat ( for classpath etc though I believe above \web-inf\classes directory automatically comes in classpath) or is there any other location for Java Beans in Tomcat....

Can any one help me out as every time I face this problem with Tomcat while code works in JRun..

Please suggest some way...


Thanks,

Manoj
19 years ago
JSP
Dear All,

I have to display the running length of Audio clip (in seconds) before playing it.

java.applet package does not give any such method.

I was also looking into javax.sound.sampled package but could not figure out the exact way.

Can any one offer me some solution for getting the audio length.


Thanks,

Manoj
20 years ago
Thanks Gregg,

I agree with you , it may make a mess. But actually I was simulating a GUI which was made in C++ (may be) & it was having Menu (Items) in Title bar.

Moreover, what happened with me. I have completed my whole GUI & in most of the cases I have used Null Layout. Initially there was no need for Menu options like File>Save, Help>About etc.

But now in the end there is a need for all this. I have no space to do it & also I do not what to disturb Null layout. Only space seems to be in Title bar only.

Thats why this idea came. Any way thanks for your suggestions....


Manoj
20 years ago
Dear All,

I have a problem with my GUI. Actually in Java generally we put menu & menu-items in menubar which is shown just below the Title bar ( in a JFrame )

But I want to put my Menu ( & further menu-item through pop-up or so) in Title bar so that I do not have to put the Menu-bar.

I am using swing version of Java GUI.....


Is there any way to do it.

Please help me out.........

Thanks,

Manoj
20 years ago
Hi All,
I have made a JPanel which contains five labels each one of them has an image set an icon. Means ultimately there are 5 images displayed on the panel.
Now I want to save it (the panel contaning five images) as an new JPEG image.
How can i do it , plese help me out........

Manoj
20 years ago
Dear All,
I have 3-4 images which are to be overlapped. Infact I have 3-4 JLabels which have these images as their icon set. Now when i overlap them one image rectangular area covers the other images means this does not look transparent. Means if i properly put the one image over other only one is seen.
I have tried with BufferedImage & Alpha-Composite etc but what happen with this if i make it total transparent(0.0) it becomes black (rectangle), if i make it total opaque(1.0) , it covers the other image. If i kept this value in between, some undesired background comes with image.
Please help me out if you have even some idea.
Thanks,
Manoj
20 years ago
Hi All,
I am having problem in giving the functionality for Dragging, Resizing of images in Canvas.
Actually , I have drawn an image in canvas & now I want that it should be able to be selected by user so that he can resize it , shear it, rotate it etc.
I am trying Graphics2D for it.
I have modified paint method of my canvas class as below :
public void paint(Graphics g) {
System.out.println("In paint of RefreshCanvas");
int w = 25;
int h = 20;
Graphics2D g2 = (Graphics2D)g;
AlphaComposite ac = AlphaComposite.getInstance (AlphaComposite.SRC_OVER,(float)0.8);
g2.scale(0.8,0.8);
g2.setComposite(ac);

if(img==null || img.size()<1) { }
else {
System.out.println("Image found");
for(int i=0; i<img.size(); i++)
{
g2.drawImage((Image)img.elementAt(i),(w*(i+1)),(h*(i+1)),this);
}
if (RText==null || RText.trim().length()<1) {
} else {
//g2.setColor(Color.blue);
g2.setStroke(new BasicStroke(5.0f));
g2.scale(1.4,1.4);
g2.drawString(RText,100,100);
}
}
In above code img is the Vector containing Image objects & RText is the text message entered by user.
With the above code, I am able to display multiple overlapping images & also
some text over it.
But what I want that user should be able to select any of images & can resize, reshape and/or drag it. (A bit similar to as we can select image (Object) in MS PowerPoint and can replace & resize it).
Can anybody help/guide me in achieving this functionality.
Thanks & Waiting for some input.

Manoj Tyagi

20 years ago
Hi all,
I have to give an applet where user can make colored images. Now what is my problem is - i have to save pixels of this image in DataBase (MS - SQLServer 2000) so that later on I can retrieve these pixels & show the image to user (may be on further requests).
My image sizes may range from 72*14 to 112*56 or may other range. Now if take the example of the smallest image that is 72*14, it amounts to the 1008 pixels. Now when i grab these pixels through Pixel Grabber, each integer value is almost 8 to 10 integer (means like 987766678, 98877666 or something like this). I can reduce this length by converting these integers to hex but still it will be 5 to 6 digits like (FFFFFF, FFAAEE like that).
Means 1008 pixels will take almost the length of 5000 to 6000 (if i take this in varchar or text field of SQL Server). I am using Java in the front end (AWT package).
How should i save this information in DB. Can i save the complete java array in SQL Server & retrieve later on. How much burden it will create on DB. Whether this will reduce the retrieval later on. These are the few points about which i am confused a lot.
Can any one help me out & suggest the strategy for the same.
For black & white images that is not an issue as in this case all can be taken as 0's & 1's & hence length is reduced a lot. But for colored images it seems to be a problem.
Waiting for any suggetion / help........
Manoj Tyagi

20 years ago