IT Certificaions

Google Cloud Platform

Monday, September 24, 2012

Struts 2 : Warning :No configuration found for the specified action: 'Login.action' in namespace: '/'

No configuration found for the specified action: 'Login.action' in namespace: '/'''. Form action defaulting to 'action' attribute's literal value.

Solution: To remove this warning you need to change following...


See your struts.xml file what name you have specified...

If you are using namespace / and your action name is 'Login' then  replace Login.action to Login as given below...

<s:form action="Login.action" method="post" > 

 Use below with namespace 

1) <s:form action="Login" method="post" namespace="/"> 

 Or 

 2) <s:form action="/Login" method="post" > 

 Now you will not get this warning.

Friday, September 21, 2012

Google App Engine: Java mail API : Mail failed



Uncaught exception from servlet
java.lang.SecurityException: SHA1 digest error for com/sun/mail/smtp/SMTPTransport.class
 at com.google.appengine.runtime.Request.process-c326aa443556893f(Request.java)
 at sun.security.util.ManifestEntryVerifier.verify(ManifestEntryVerifier.java:210)
 at java.util.jar.JarVerifier.processEntry(JarVerifier.java:218)
 at java.util.jar.JarVerifier.update(JarVerifier.java:205)
 at java.util.jar.JarVerifier$VerifierStream.read(JarVerifier.java:428)
 at sun.misc.Resource.getBytes(Resource.java:124)
 at java.net.URLClassLoader.defineClass(URLClassLoader.java:273)
 at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:616)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
 at javax.mail.Session.getService(Session.java:482)
 at javax.mail.Session.getTransport(Session.java:379)
 at javax.mail.Session.getTransport(Session.java:339)
 at javax.mail.Session.getTransport(Session.java:368)
 at javax.mail.Transport.send(Transport.java:67)
 at javax.mail.Transport.send(Transport.java:48)......
........
.......
........

Solution: Please remove all jar related to mail or smpt from your lib and then re-deploy on app engine. Google app engine provides all required.

Thursday, September 20, 2012

Google App engine :Struts 2 : There is no Action mapped for namespace [/] and action name .


here is a code from my web.xml

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

where index.jsp is redirected to a struts 2 action...

But when I access http://localhost:8888 I received the error below:


There is no Action mapped for namespace [/] and action name .

--------------------------------------------------------------------

Solution:   Please edit your struts.xml and enter this action as last action( only after all actions as a default action).


<action name="*">
           <result type="redirectAction">
             <param name="actionName">Home.action</param>
           </result>
</action>

Now this must be the last action and it will work like a default action for your application.




Thursday, September 13, 2012

Google App Engine: java.lang.RuntimeException: java.io.NotSerializableException


java.lang.RuntimeException: java.io.NotSerializableException: com.example.web.dto.SessionObjectDTO
at com.google.apphosting.runtime.jetty.SessionManager.serialize(SessionManager.java:373)
at com.google.apphosting.runtime.jetty.DatastoreSessionStore.createEntityForSession(DatastoreSessionStore.java:71)
at com.google.apphosting.runtime.jetty.DatastoreSessionStore.saveSession(DatastoreSessionStore.java:93)
at com.google.apphosting.runtime.jetty.SessionManager$AppEngineSession.save(SessionManager.java:164)
at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:41)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:249)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:135)
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:447)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:452)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:458)
at com.google.tracing.TraceContext.runInContext(TraceContext.java:698)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:336)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:328)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:456)
at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:251)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.io.NotSerializableException: com.example.web.dto.SessionObjectDTO
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
at java.util.HashMap.writeObject(HashMap.java:1018)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:962)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
at com.google.apphosting.runtime.jetty.SessionManager.serialize(SessionManager.java:370)
... 29 more
-----------------------------------------------------------------------------------------------------

Solution: Please make your object Serializable that you want to put in HttpSession if you are running it on Google App Engine.

Hibernate with Struts 2 : Warning : javax.naming.NamingException


[13-09-2012 16:25:41] [WARN ] - Could not bind factory to JNDI
javax.naming.NamingException: Name is not valid
at org.apache.naming.NamingContext.bind(NamingContext.java:836)
at org.apache.naming.NamingContext.rebind(NamingContext.java:208)
at org.apache.naming.SelectorContext.rebind(SelectorContext.java:207)
at javax.naming.InitialContext.rebind(InitialContext.java:412)
at org.hibernate.util.NamingHelper.bind(NamingHelper.java:74)
at org.hibernate.impl.SessionFactoryObjectFactory.addInstance(SessionFactoryObjectFactory.java:90)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:306)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at com.example.persistence.dao.impl.HibernateConnection.<init>(HibernateConnection.java:74)
at com.example.persistence.dao.impl.HibernateConnection.<init>(HibernateConnection.java:68)
at com.example.persistence.dao.impl.HibernateConnection.getInstance(HibernateConnection.java:55)
at com.example.persistence.dao.impl.HibernateBaseDAO.createSession(HibernateBaseDAO.java:35)
at com.example.persistence.dao.impl.HibernateBaseDAO.getSession(HibernateBaseDAO.java:24)
at com.example.persistence.dao.impl.PostalCodeDAO.getAllCitiesPostCodes(PostalCodeDAO.java:45)
at com.example.web.util.exampleProperties.<clinit>(exampleProperties.java:74)
at com.example.web.action.WelcomeHomeAction.mobileView(WelcomeHomeAction.java:73)
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:597)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:128)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)


-------------------------------------------------------------------------------------------

Solution: Please see your hibernate-cfg.xml and see <session-factory name=""> name attribute. Remove it.

Thursday, September 6, 2012

Java IO Package: Convert byte[] data array to InputStream

If you want to make InputStream using data array of bytes like byte [], you can use following,
Let's suppose your file data is copied in following byte array.

byte []  newImageData contains all data which have been read from some file.
InputStream inputStream = new ByteArrayInputStream(newImageData);


Google App engine: Image Scaling


You can use following app engine classes to resize images using Java.
-------------------------------------------------------------------------


import com.google.appengine.api.images.Image;
import com.google.appengine.api.images.ImagesService;
import com.google.appengine.api.images.ImagesServiceFactory;
import com.google.appengine.api.images.Transform;
----------------------------------------------------------------------




public  byte[]  resizedImage(byte[] oldImageData,int width,int height) throws IOException{

ImagesService imagesService = ImagesServiceFactory.getImagesService();
        Image oldImage = ImagesServiceFactory.makeImage(oldImageData);
        log.info(this.getClass()+":oldImage height:"+oldImage.getHeight()+" and width:"+oldImage.getWidth());
       Transform resize = ImagesServiceFactory.makeResize(width,height);
        Image newImage = imagesService.applyTransform(resize, oldImage);
        byte[] newImageData = newImage.getImageData();
       
        log.info(this.getClass()+"After resize newImage height:"+newImage.getHeight()+" and width:"+newImage.getWidth());

      

        return  newImageData ;
}

Wednesday, September 5, 2012

Upload file on Google cloud storage using Java servlet on google app engine



Hopefully you have configured all jars and settings to run and deploy your project on google app engine using eclipse,

if not then visit google app engine-->google cloud storage java api link..
https://developers.google.com/appengine/docs/java/googlestorage/overview

-----------------------------------------------------------------------------
1) index.html
------------------------------------------------------------------------------

<html>
<body>
   <div>
      <form action="testStorage.do" method="post" enctype="multipart/form-data">
         <p> Please write a file to test cloud storage... </p>
         <input type="file" name="cloudFile" />
         <input type="submit" value="Write a  file on cloud Storage">
      </form>
   </div>
</body>
</html>

--------------------------------------------------------------------------------
2) web.xml


<?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">

   <servlet>
<servlet-name>CloudStorageServlet</servlet-name>
<servlet-class>com.vicwalks.web.servlet.TestCloudStorageServlet</servlet-class>
</servlet>
  
<servlet-mapping>
<servlet-name>CloudStorageServlet</servlet-name>
<url-pattern>/testStorage.do</url-pattern>
</servlet-mapping>
  
<welcome-file-list>
   <welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
-------------------------------------------------------

3) appengine-web.xml


<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
  <application>your-app-engine-id</application>
  <version>1</version>



  <threadsafe>true</threadsafe>
  <sessions-enabled>true</sessions-enabled>

  <!-- Configure java.util.logging -->
  <system-properties>
    <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
  </system-properties>

  <!--
    HTTP Sessions are disabled by default. To enable HTTP sessions specify:

      <sessions-enabled>true</sessions-enabled>

    It's possible to reduce request latency by configuring your application to
    asynchronously write HTTP session data to the datastore:

      <async-session-persistence enabled="true" />

    With this feature enabled, there is a very small chance your app will see
    stale session data. For details, see
    http://code.google.com/appengine/docs/java/config/appconfig.html#Enabling_Sessions
  -->

</appengine-web-app>



=====================================================================

4) TestCloudStorageServlet.java

------------------------------------------------------
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Logger;


import javax.servlet.http.*;

import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemIterator;
import org.apache.commons.fileupload.FileItemStream;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;


public class TestCloudStorageServlet extends HttpServlet{

private static final long serialVersionUID = 1L;
private StorageService storage = new StorageService();
private static final int BUFFER_SIZE = 1024 * 1024;
private static final Logger log = Logger.getLogger(TestCloudStorageServlet.class.getName()); 
@Override
 public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
   log.info(this.getServletInfo()+" Servlets called....");
   resp.setContentType("text/plain");
   resp.getWriter().println("Now see here your file content, that you have uploaded on storage..");
   
   ServletFileUpload upload = new ServletFileUpload();
   FileItemIterator iter;
try {
iter = upload.getItemIterator(req);
while (iter.hasNext()) {
       FileItemStream item = iter.next();
       String fileName = item.getName();
       String mime = item.getContentType();
       
       storage.init(fileName, mime);
       InputStream is = item.openStream();

       byte[] b = new byte[BUFFER_SIZE];
       int readBytes = is.read(b, 0, BUFFER_SIZE);
       while (readBytes != -1) {
           storage.storeFile(b, readBytes);
           readBytes = is.read(b, 0, readBytes);
       }

       is.close();
       storage.destroy();
       
resp.getWriter().println("File uploading done");

       //resp.getWriter().println("READ:" + storage.readTextFileOnly(fileName));
       
                         log.info(this.getServletName()+" ended....");        

}
} catch (FileUploadException e) {
System.out.println("FileUploadException::"+e.getMessage());
log.severe(this.getServletName()+":FileUploadException::"+e.getMessage());
e.printStackTrace();
} catch (Exception e) {
log.severe(this.getServletName()+":Exception::"+e.getMessage());
System.out.println("Exception::"+e.getMessage());
e.printStackTrace();
}
}

}

========================================================================

5) StorageService.java

--------------------------------------------------------------------------
import com.google.appengine.api.files.*;
import com.google.appengine.api.files.GSFileOptions.GSFileOptionsBuilder;
import java.io.*;
import java.nio.channels.Channels;
import java.util.logging.Logger;

public class StorageService {

public static final String BUCKET_NAME = "mybucket";  

private FileWriteChannel writeChannel = null;
FileService fileService = FileServiceFactory.getFileService();
private OutputStream os = null;
private static final Logger log = Logger.getLogger(StorageService.class.getName());

public void init(String fileName, String mime) throws Exception {
System.out.println("Storage service:init() method:  file name:"+fileName+" and mime:"+mime);
log.info("Storage service:init() method:  file name:"+fileName+" and mime:"+mime);
    
    GSFileOptionsBuilder builder = new GSFileOptionsBuilder()
            .setAcl("public_read")
            .setBucket(BUCKET_NAME)
            .setKey(fileName)
            .setMimeType(mime);
    AppEngineFile writableFile = fileService.createNewGSFile(builder.build());
    boolean lock = true;
    writeChannel = fileService.openWriteChannel(writableFile, lock);
    os = Channels.newOutputStream(writeChannel);
}

public void storeFile(byte[] b, int readSize) throws Exception {
    os.write(b, 0, readSize);
    os.flush();
}



// Only to read uploaded text files

public String readTextFileOnly(String fileName) throws Exception{  
log.info("Reading the txt file from google cloud storage...........");
String filename = "/gs/" + BUCKET_NAME + "/" + fileName;
    AppEngineFile readableFile = new AppEngineFile(filename);
    FileReadChannel readChannel = fileService.openReadChannel(readableFile, false);
    BufferedReader reader = new BufferedReader(Channels.newReader(readChannel, "UTF8"));
    String line = reader.readLine();
    readChannel.close();
    return line;

}
public void destroy() throws Exception {
log.info("Storage service: destroy() method");
    os.close();
    writeChannel.closeFinally();
}
}
========================================================================

Now deploy your project on app engine and upload file.