Sunday, September 25, 2011

Linux server copy command

In Linux / UNIX if you want to copy a file or a directory recursively from one server to other server you can use SCP (server copy) command


Synatax :

scp <filename> userName@server:/home/path/

OR

scp -r <foldername> userName@server:/home/path/

It will promt for a password, after entering correct password it will copy files or a directory recursively from specified source server to specified destination server.


Options available :


  • -p : Preserves the modification and access times, as well as the permissions of the source-file in the destination-file
  • -q : Do not display the progress bar
  • -r : Recursive, so it copies the contents of the source-file (directory in this case) recursively
  • -v : Displays debugging messages

The method println(boolean) in the type PrintStream is not applicable for the arguments (void)

I got below mentioned error on my JBOSS console

The method println(boolean) in the type PrintStream is not applicable for the arguments (void)


How to solve this error.

1. Check syntax error.

          Check for any typo around SOP.

          System.out.println("Hello World!");

2. Check for any void function inside SOP.

       System.out.println(obj.voidFunction());
       //Here void function is not allowed. Function must return some value to print

If you need help with java programming. You can contact assignmentoverflow.com.

Friday, September 2, 2011

org.apache.jasper.JasperException

While migration of my code from WebSphere to JBoss i observed below mentioned error.


04:17:20,946 ERROR [ContainerBase] Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /com/test.jsp(15,1) Expecting "jsp:param" standard action with "name" and "value" attributes
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
at org.apache.jasper.compiler.Parser.parseParam(Parser.java:827)
at org.apache.jasper.compiler.Parser.parseBody(Parser.java:1665)
at org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1004)
at org.apache.jasper.compiler.Parser.parseForward(Parser.java:868)
at org.apache.jasper.compiler.Parser.parseStandardAction(Parser.java:1120)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1448)
at org.apache.jasper.compiler.Parser.parse(Parser.java:133)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)

Solution :

Replace old code

<jsp:include flush="true" page="file.jsp">
</jsp:include>
OR
<jsp:forward page="file.jsp">
</jsp:forward>


With new code

<jsp:include flush="true" page="file.jsp"/>
OR
<jsp:forward page="file.jsp"/>

java.util.zip.ZipException

05:39:55,609 ERROR [ContainerBase] Servlet.service() for servlet jsp threw exception
java.util.zip.ZipException: invalid entry size (expected 2504523784 but got 4151 bytes)
at java.util.zip.ZipInputStream.readEnd(ZipInputStream.java:376)
at java.util.zip.ZipInputStream.read(ZipInputStream.java:148)
at java.util.jar.JarInputStream.read(JarInputStream.java:177)
at java.util.zip.ZipInputStream.closeEntry(ZipInputStream.java:92)
at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:70)
at java.util.jar.JarInputStream.getNextEntry(JarInputStream.java:118)
at java.util.jar.JarInputStream.getNextJarEntry(JarInputStream.java:149)
at org.jboss.web.tomcat.service.jasper.TagLibCache.scanJar(TagLibCache.java:324)
at org.jboss.web.tomcat.service.jasper.TagLibCache.processTldsInFileSystem(TagLibCache.java:268)
at org.jboss.web.tomcat.service.jasper.TagLibCache.processTldsInFileSystem(TagLibCache.java:261)
at org.jboss.web.tomcat.service.jasper.TagLibCache.init(TagLibCache.java:101)


This error looks like it is having trouble reading a jar file while looking for a tld. Hence you need to check the files in the WEB-INF/lib directory to make sure they are all valid jar files. Also it may occurs when text file entries in the source jar file contain some non-ASCII characters such as ^I ^Z ^D ^C.

java.lang.IllegalArgumentException

Few days ago i absorbed below mentioned error on JBoss console,

06:34:22,276 ERROR [ContainerBase] Servlet.service() for servlet jsp threw exception
java.lang.IllegalArgumentException: setAttribute: Non-serializable attribute
at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1293)
at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1254)
at org.apache.catalina.session.StandardSessionFacade.setAttribute(StandardSessionFacade.java:130)
at com.vignette.portal.website.internal.HttpSessionWrapper.setAttribute(HttpSessionWrapper.java:107)
at org.apache.jasper.runtime.PageContextImpl.doSetAttribute(PageContextImpl.java:340)
at org.apache.jasper.runtime.PageContextImpl.setAttribute(PageContextImpl.java:319)
at org.apache.jsp.survey.question_jsp._jspService(question_jsp.java:431)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Solution :
I traced back the root cause of the error. I went to that particular JSP file and found that particular java class which was throwing this error.

I implemented interface Serializable for that class

eg :

class Xyz implements Serializable { }