navneet rajput

Greenhorn
+ Follow
since Sep 01, 2008
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 navneet rajput

Hello All,

I have written log module for generating logs at server side.
Log file created at server side and it is able to write normal logs in to that file, but I have used exception handling and I want to write logs which are throws in my code.
Also I want to write error logs in to that log file.

Please give me some pointers on the same. Any kind of help will be appreciated. Please see the following log4j configuration file for more reference.


########## this is root logger. Logging level set as ERROR ########################

log4j.rootLogger=debug,FILE,stdout
log4j.debug=true

############# This is Appender for writting logs at console #######################

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d{MMM dd HH:mm:ss}] %-4r [%t] %-5p %c %x - %m%n

############ This is appender for writing logs in File ###########################

log4j.appender.FILE=org.apache.log4j.RollingFileAppender
log4j.appender.FILE.file=C:\\MyLog_log\\Info.log
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=[%d{MMM dd HH:mm:ss}] %-4r [%t] %-5p %c %x - %m%n

########### This is Appender for defining Max log file size ######################

log4j.appender.MaxFileSize=1000KB

##################################################################################
Hi Friends,

I have written sample application for file uploading using servlet. I am facing following errors while calling servlet.
Can any one give me pointers related to same. logs are given below.
Thanks in advance

Jul 15, 2009 8:52:37 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:FileUploading' did not find a matching property.
Jul 15, 2009 8:52:37 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SampleFileUploading' did not find a matching property.
Jul 15, 2009 8:52:37 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.6.0_04\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.6.0_04/bin/client;C:/Program Files/Java/jre1.6.0_04/bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin;D:\Softwares\apache-ant-1.7.1\bin;C:\Program Files\Java\jdk1.5.0_05\bin
Jul 15, 2009 8:52:37 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jul 15, 2009 8:52:37 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 329 ms
Jul 15, 2009 8:52:37 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jul 15, 2009 8:52:37 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.20
Jul 15, 2009 8:52:37 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jul 15, 2009 8:52:37 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jul 15, 2009 8:52:37 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/0 config=null
Jul 15, 2009 8:52:37 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 246 ms
14 years ago
Hi All,

I am trying to call servlet from HTml but it giving error like:- The requested resource (/SampleFileUploading/servlet/com.servlet.FileUploadServlet) is not available
I have sample client code as below

<FORM ENCTYPE='multipart/form-data' method='POST' action='servlet/com.servlet.FileUploadServlet'>
<INPUT TYPE='file' NAME='test'>
<INPUT TYPE='submit' VALUE='upload'>
</FORM>

In Action I have given my servlet class path.

And my Web.xml is as below

<servlet>
<description></description>
<display-name>FileUploading</display-name>
<servlet-name>FileUploading</servlet-name>
<servlet-class>com.servlet.FileUploadServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>FileUploading</servlet-name>
<url-pattern>/FileUpload</url-pattern>
</servlet-mapping>

Please give me some pointers related to same.
all kind of help will be appreciated.

Thanks,
Navneet



14 years ago
Hi Friends,

I am trying to upload file using Restlets but I am facing some issues, I am using following code


// Launching a Sever

Component component = new Component();
component.getServers().add(Protocol.HTTP, 8182);

component.getDefaultHost().attach("/essai",
new MyApplication(component.getContext()));
component.start();

/* Launches a simple client */
FileRepresentation rep = new FileRepresentation(
"d:\\temp\\test.txt", MediaType.TEXT_ALL, 0);
EncodeRepresentation encodedRep = new
EncodeRepresentation(Encoding.GZIP,
rep);
Client client = new Client(Protocol.HTTP);
Response response =
client.put("http://localhost:8182/essai/";, encodedRep);
System.out.println("******" + response.getStatus());

component.stop();


I am not getting that what I should written in MyApplication Class.

All king of help will be appreciated.

Thanks,
Navneet



14 years ago
Hey Thanks Bro...for reply.

you are right. I haven given wrong name in property file..
Problem got resolved.

Thanks again for reply.
14 years ago
Hello Friends,

I am facing some problems while writing Hello world application in Restlets using Spring.

Can any please help me to solve this problem. All kind of help will be appreciated.
Error logs are given below:-

log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'sampleRestletServer' defined in class path resource [com/smarttech/nbe/service/sample/restletContext.xml]: Could not resolve placeholder 'nbe.service.sample.startup.protocol'
at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:252)
at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:541)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:515)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:348)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:122)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66)
at com.smarttech.swp.service.ServiceApplicationStarter.start(ServiceApplicationStarter.java:27)
at com.smarttech.nbe.service.sample.SampleServiceApplication.main(SampleServiceApplication.java:12)


Thanks,
Navneet


14 years ago
I have copied all jars in lib folder, now it found servlet container class but it gives some errors.
Please help me I am new to all these things,please find the attachment for error logs.

And I am tring to host following web-service

package com.jersey;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

@Path ("/helloworld")
public class HelloWorldResource {

@GET
@Produces ("text/plain")
public String sayHello() {
return "Hello World";
}
}
14 years ago
Thanks for reply.

Actually I have putted that jar under source folder and I am trying to run application in eclipse, run as->run on server
I don't know what is written inside that ServletContainer class because it is .class file. Basically I have written one sample Web service in JAX-rs
and I wanted to call Web service but it fail to run servlet itself. Please give me some pointer.

Thanks
Navneet
14 years ago
Hi All,

I am trying to run one simple web application. I have imported required jar in which i have defined my servlet class.
and defined servlet name and complete path of class. But when I am running my web application on tomcat it gives me errror like servlet not found.

Please give me some pointers it will be appreciated. Thanks in advance.

Thanks
Navneet


The web.xml file is as below

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>HelloRest</display-name>

<servlet>
<servlet-name>JerseyTest</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JerseyTest</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

</web-app>


I have checked location of following class in my jar it is fine.
com.sun.jersey.spi.container.servlet.ServletContainer



14 years ago
Hi All,

I have just started working on JAX-RS but I stuck at how to make , build and run web-service using eclipse Europa.
Please give me some pointers.

Thanks
Navneet

14 years ago
Thanks for reply Sanghmitra.

Actually,When I am trying to import following packages

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;

Then compiler is not able to find them.
so is there any specific library or jars I need to import.

Thanks in advance,
14 years ago
Hi All,

I have just started working with JAX-Rs web services.
I am trying to build one sample application using JAX-RS but I am not able to find out starting point for the same.

Is any one please help me for which jar's and all I need to import in my eclipse project for running REST application smoothly.
Any kind of help or pointers will be appreciated.


Thanks,
Navneet
14 years ago
sorry for late reply but i got the solution.
now i am able to send message through TCP and after getting that msg in my mail account i can control pc by using some o.s. commands.

Thanks
Navneet
15 years ago
hi, i decide to do one project which should control our pc from mobile device like shut down,sendind files,check status like these kind of things i want to impliment.I just want to know how to add listners after i will send message from mobile device in the form of command and what to write in send option.please send me the steps which i will follow..
15 years ago