Jakarta Commons Lang 1.01 vs. 2.0?

I looked through the newsgroup, but didn't see this question come up.
Currently, the latest version of the Jakarta Commons Lang package is 2.0,
though Kodo 3.2.4 includes 1.0.1. Are there any known problems or
incompatibilities with using Lang 2.0 with Kodo 3.2.4? We'd like to only
include the Lang 2.0 package in our application.
Also, the link in the documentation (Appendix F) to the Jakarta pages are
broken:
http://jakarta.apache.org/commons/collections.html should be
http://jakarta.apache.org/commons/collections/
http://jakarta.apache.org/commons/lang.html should be
http://jakarta.apache.org/commons/lang/
and
http://jakarta.apache.org/commons/pool.html should be
http://jakarta.apache.org/commons/pool/
(basically, replace the .html with a /).
;ted

There are no known incompatibilities, but in Kodo 3, we're actually
repackaging all our open-source dependencies to get away from random
appearances of incompatibilities.
-Patrick
Ted M. Young wrote:
I looked through the newsgroup, but didn't see this question come up.
Currently, the latest version of the Jakarta Commons Lang package is 2.0,
though Kodo 3.2.4 includes 1.0.1. Are there any known problems or
incompatibilities with using Lang 2.0 with Kodo 3.2.4? We'd like to only
include the Lang 2.0 package in our application.
Also, the link in the documentation (Appendix F) to the Jakarta pages are
broken:
http://jakarta.apache.org/commons/collections.html should be
http://jakarta.apache.org/commons/collections/
http://jakarta.apache.org/commons/lang.html should be
http://jakarta.apache.org/commons/lang/
and
http://jakarta.apache.org/commons/pool.html should be
http://jakarta.apache.org/commons/pool/
(basically, replace the .html with a /).
;ted

Similar Messages

  • Jakarta Commons Lang

    Hi,
    I am using JSP and Mysql for my application. I have a form with textarea fields. When user clicks submit, the values entered, are stored into the database. Currently am not able to use escape characters such as "'" or " "" "..
    I have already download Jakarta Commons Lang jar file and have also updated my classpath. My problem is, how will I use this jar file with JSP to solve the problem.
    Pls Help,
    Aarushi

    What exactly is the problem?
    Saving the value to the database?
    Displaying the value back on the screen?
    How are you saving the value?
    Are you using a prepared statement with parameters or just concatenating together a SQL string?
    If the problem is that you need the user to be able to type ' and " into the textfields, then PreparedStatements should solve that issue.
    Cheers,
    evnafets

  • Trying a comprehensive jakarta-commons PKGBUILD....

    Hey there!
    I would like to build a PKGBUILD for a nice java banking program. On the way to a Arch-conform PKGBUILD I stumbled over the Java Package Guidelines and investigated the libs which are shipped with the program a bit further.
    There I found that some jars from the jakarta commons package were used but not yet packaged in AUR or the official repos. So first I wanted to build them separately, but then I found that it would make more sense to have one comprehensive package of (currently) 30MB instead of 33 single packages.
    What do you think about the idea? I am willing to support this meta package as well as the single ones if I just knew how the implementation would be more sensible.
    Since it would be a huge amount of work to pack every packag on its own, I wrote a PKGBUILD for all packages that are in Jakarta Commons.
    I hope, if it is generally desired to have any package in a single file, that I at least learnt a bit from writing this PKGBUILD
    # Contributor: jakob
    pkgname=jakarta-commons-all
    pkgver=1.0
    pkgrel=1
    pkgdesc="This packag includes all Jakarta Commons Proper packages."
    url="http://jakarta.apache.org/commons/"
    license="APACHE"
    depends=()
    makedepends=()
    conflicts=()
    source=(http://www.apache.org/dist/jakarta/commons/attributes/binaries/commons-attributes-2.2.tar.gz
    http://www.apache.org/dist/jakarta/commons/beanutils/binaries/commons-beanutils-1.7.0.tar.gz
    http://www.apache.org/dist/jakarta/commons/betwixt/binaries/commons-betwixt-0.7.tar.gz
    http://www.apache.org/dist/jakarta/commons/chain/binaries/commons-chain-1.1.tar.gz
    http://www.apache.org/dist/jakarta/commons/cli/binaries/cli-1.0.tar.gz
    http://www.apache.org/dist/jakarta/commons/codec/binaries/commons-codec-1.3.tar.gz
    http://www.apache.org/dist/jakarta/commons/collections/binaries/commons-collections-3.2.tar.gz
    http://www.apache.org/dist/jakarta/commons/configuration/binaries/commons-configuration-1.2.tar.gz
    http://www.apache.org/dist/jakarta/commons/daemon/binaries/commons-daemon-1.0.1.tar.gz
    http://www.apache.org/dist/jakarta/commons/dbcp/binaries/commons-dbcp-1.2.1.tar.gz
    http://www.apache.org/dist/jakarta/commons/dbutils/binaries/commons-dbutils-1.0.tar.gz
    http://www.apache.org/dist/jakarta/commons/digester/binaries/commons-digester-1.7.tar.gz
    http://www.apache.org/dist/jakarta/commons/discovery/binaries/commons-discovery-0.2.tar.gz
    http://www.apache.org/dist/jakarta/commons/el/binaries/commons-el-1.0.tar.gz
    http://www.apache.org/dist/jakarta/commons/email/binaries/commons-email-1.0.tar.gz
    http://www.apache.org/dist/jakarta/commons/fileupload/binaries/commons-fileupload-1.1.1.tar.gz
    http://www.apache.org/dist/jakarta/commons/httpclient/binary/commons-httpclient-3.0.1.tar.gz
    http://www.apache.org/dist/jakarta/commons/io/binaries/commons-io-1.2.tar.gz
    http://www.apache.org/dist/jakarta/commons/jelly/binaries/commons-jelly-1.0.tar.gz
    http://www.apache.org/dist/jakarta/commons/jexl/binaries/commons-jexl-1.1.tar.gz
    http://www.apache.org/dist/jakarta/commons/jxpath/binaries/commons-jxpath-1.2.tar.gz
    http://www.apache.org/dist/jakarta/commons/lang/binaries/commons-lang-2.2.tar.gz
    http://www.apache.org/dist/jakarta/commons/latka/binaries/latka-1.0-alpha1.zip
    http://www.apache.org/dist/jakarta/commons/launcher/binaries/commons-launcher-1.1.tar.gz
    http://www.apache.org/dist/jakarta/commons/logging/binaries/commons-logging-1.1.tar.gz
    http://www.apache.org/dist/jakarta/commons/math/binaries/commons-math-1.1.tar.gz
    http://www.apache.org/dist/jakarta/commons/modeler/binaries/commons-modeler-2.0.tar.gz
    http://www.apache.org/dist/jakarta/commons/net/binaries/commons-net-1.4.1.tar.gz
    http://www.apache.org/dist/jakarta/commons/pool/binaries/commons-pool-1.3.tar.gz
    http://www.apache.org/dist/jakarta/commons/primitives/binaries/commons-primitives-1.0.tar.gz
    http://www.apache.org/dist/jakarta/commons/scxml/binaries/commons-scxml-0.5.tar.gz
    http://www.apache.org/dist/jakarta/commons/transaction/binaries/commons-transaction-1.1.tgz
    http://www.apache.org/dist/jakarta/commons/validator/binaries/commons-validator-1.3.0.tar.gz)
    md5sums=('47d037449aa38b6c8e181abcfaf36b2b' 'd1571ce9d6ec3d1795364cc44f3d116e'
    '707af78be5ed2518dd2eada9afefb238' 'e688f648a5fd324f591669ca70ebe96d'
    '6c28bdee998fe4d9e76c7cf40e7f4691' 'aad3948be13476d9599cadaf146bc92a'
    '030a1c1d08f47a6c9be000fc611714b4' '6c8bc440de20b7c9b5b3b5315d50316b'
    '591fceeb4feab1094a78c9c5decd8cca' 'd333fc11abb532be2487338cb452b583'
    'b437ea809d320378fc05af9f29e2636f' '717239578dfcd05bde0dfd1d3e8f319f'
    '2273f5f83a477f4f18fccf3a00e2b48c' 'fb856b9689bdc4c52f8ae999057f89fc'
    '4fb252cd4bcee57b573937e3c88974cc' '3b851898d3347cd4d6890b79c9a8a0f0'
    '58167f247e8f8ad8fb1def97c1de8f07' '52b42b61593def482dc968ffdd27f113'
    'e9e3ba84a214d2bcf96aa31b24f3bb5f' '9bdf02d9b659a70b7f327c923c1f4d80'
    '1730dae5f0ef0594a47ead5d1a4ac41b' '4f683f7b6970babb8c9f09bb12b7c1a6'
    'fbf479099aa252989fe4c81511abf4bf' '7ed65e08e8c952c4d9f6db0d73ef5426'
    'c2bd7cc1fa08d78ec5aa80632c21152b' '37c43d1d0c08c1b753a7bf952c763eb3'
    'ba74fdf4aca98f01579eca11acc6d882' '577e90cc40328c287acc921dae344c12'
    '1bdae6c015689349b704daebda924a5b' '2ce92656204f2fa63dad6dfa88e1458b'
    '091e2dc0efcb9155c2b4a05792d49a77' 'fe946d1775d58ded6050dec6af648f38'
    '221d924fb85f3597d8be0708d45f0f5a')
    build() {
    mkdir -p $startdir/pkg/usr/share/java/jakarta-commons
    cd $startdir/src/
    rm -rf *gz docs LICENSE*
    mv *.txt doc
    mv * $startdir/pkg/usr/share/java/jakarta-commons
    Since there are sometimes when copy&pasting PKGBUILDS (especially the ""s, IIRC), here a link to a pastebin
    My questions are: Are the jars to be put in /usr/share/java/jakarta-commons/$package/*.jar or plainly under jakarta-commons?
    Is it ok to delete all the docs, licenses + readmes?
    Sorry but it's very late now so I'll stop here and wait for your suggestions and tips, which will come hopefully..
    Greetings and good night,
    jakob

    Your absolutely right saying that never all commons packages would be used by just one program.
    I read the Java Packaging Guidelines again and it says that only commoly used and major libs should be sourced out to single packages. So the question is: Do any other packages in AUR or the official repos use some of the jakarta-commons projects so it would eventually pay to make single packages for them, or isn't it worth the hussle?
    I for my part now will leave the libs that are bundled with the package I wanted to upload at first in the package and use them.
    Thanks for your reply

  • Please no jakarta-commons-collections-3.1.jar in Kodo 3.2!!

    As far as I know jakarta-commons-collections-3.1.jar is not backward
    compatible with 2.x version of jakarta collections. Many things (such as
    Struts) are shipped with collections 2.1 and might not work with 3.1
    collections. Is it possible to keep 2.1 collections in Kodo. And eventually
    get rid of it all together if possible! IMHO jakarta collections (and lang?)
    libraries are bad dependency since they can't keep it backward compatible
    and went through 3 versions of it in short time

    Use servlet filter to clean up your PMs
    1. Create Disposable interface
    2. Create PMHolder which implement Disposable and make sure when you create
    instance of PMHolder you attach it to http request as an attribute (I
    suggest passing request as parameter to PMHolder constructor and
    autoregister new instance with the request)
    3. Create filter which inspects all request attributes and call
    Disposable.close() on all attributes which implement Disposable
    It will let you create PMs lazily in your struts forms and not to worry
    about closing them and it will let you to use PMs directly in your JSPs if
    you have to again without worry about leaks
    "Tim Holloway" <[email protected]> wrote in message
    news:[email protected]...
    Abe White wrote:
    http://jakarta.apache.org/commons/collections/compatibility.html
    Also commons beanutil have a new version which can run against both 2.1and
    3.x codebases. I think there is lots of confusion in thius area. We
    trued
    our struts apps with 3.1 collections they seem to be ok.
    Thanks for the link! It's particularly good to hear that struts seems towork
    with 3.1.If it didn't, I'd be in deep trouble. I've got a major webapp using Struts
    1.1 which I rewrote using KodoJDO. The only tricky part was allowing for
    pages that would gather data from 4 or 5 places (some of them collections)
    and push them out to the view, since I needed to release the Persistence
    Manager in the Struts Action Processor or I'd either have to put logic on
    the JSPs or leak Persistence Managers.
    // Disconnect display data from PM so we can close PM.
    pm.makeTransient(info);
    pm.makeTransient(info.getOfacMain());
    pm.makeTransientAll(info.getOfacMain().getOfacAddress());
    pm.makeTransientAll(info.getOfacMain().getOfacAlias());
    pm.makeTransient(info.getOfacSourceData());
    pm.close();
    I did have issues about a large browse set, but Stephen Kim set me on the
    right track on that one.
    Kodo 3.2 Beta didn't have any Struts-related problems either.
    Tim Holloway
    EverBank

  • Jakarta Commons -- File Upload does not work with Application Server

    Hi ALl,
    I tried Jakarta Commons file upload. In the netbeans, I copied the common jar files "commons-io-1.2.jar" and "commons-fileupload-1.1.1.jar" in the
    netbeans-5.5\enterprise3\apache-tomcat-5.5.17\common\lib and set the class paths. It is working correctly when I compile and run from the netbeans. However, when I deployed in Sun Application Server PE 9.0, I am receiving the following errors. In Sun application I copied the above jars files to "C:\Sun\AppServer\jdk\jre\lib\ext"..
    I have read in several postings that it does not work this way but could find any solution. Any idea will be greatly appreciated.
    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: java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:930)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:863)
         org.apache.jsp.fileUpload_jsp._jspService(fileUpload_jsp.java:109)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:353)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:409)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:317)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
         com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
         org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
         com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
         com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
         com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
         com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
         com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
         com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
         com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
    root cause
    java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream
         org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:116)
         org.apache.jsp.fileUpload_jsp._jspService(fileUpload_jsp.java:76)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:353)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:409)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:317)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
         com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
         org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
         com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
         com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
         com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
         com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
         com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
         com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
         com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
    note The full stack trace of the root cause is available in the Sun Java System Application Server Platform Edition 9.0 logs.
    Sun Java System Application Server Platform Edition 9.0
    Thank you,
    --Sam                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Hi All,
    I solved this few minutes after I posted this question. Thought I should share with everybody, just in case some one else need it.
    I copied these three files in the folder C:\Sun\AppServer\jdk\jre\lib\ext
    1. servelet-api.jar
    2. commons-io-1.2.jar
    3. commons-fileupload-1.1.1.jar
    No need to set any class path.
    Thanks

  • Problem with jakarta commons email

    i am using in addition to the javamail libary the jakarta commons libary.
    do anyone of you havee anyxpieriences with this libary??
    here is my code for send a simple mail:
    String host=null;
            SimpleEmail email = new SimpleEmail();
            try {
                 host=DbJdbc.getSetting("SmptHost");
                try {
                    email.setHostName(host);
                    email.addTo(emailadress);
                   email.setFrom("[email protected]");
                    email.setSubject("Ears mail scheduler");
                    email.setMsg("test");
                    email.setAuthentication("test","test");
                    email.send();
                } catch (EmailException eex) {
                LoggerLars.log("[SendMail] : Error" + eex.getMessage(),4);
                throw new Exception(eex.getMessage());
            } catch  (Exception ex) {
                LoggerLars.log("[SendMail] Exception in Sendmail: "+ex.getMessage(),4);  
         }i am working with the bea weblogic 8.1.3 and i get an error that the catch parameter is not an java.lang.throwable.
    so the try/catch construct doesn't work....did anyone got the same problem?? i don't see any programming fault in the code, i simple copied is from the jakarta websites howto.

    problem solved!!!
    i just had to restart bea und to update the libaries!! thx

  • Uploading a file to server using servlet (Without using Jakarta Commons)

    Hi,
    I was trying to upload a file to server using servlet, but i need to do that without the help of anyother API packages like Jakarta Commons Upload. If any class for retrieval is necessary, how can i write my own code to upload from client machine?.
    From
    Velu

    <p>Why put such a restriction on the solution? Whats wrong about using that library?
    The uploading bit is easy - you put a <input type="file"> component on the form, and set it to be method="post" and enctype="multipart/form-data"
    Reading the input stream at the other end - thats harder - which is why they wrote a library for it. </p>
    why i gave the restriction is that, i have a question that <code>'can't we implement the same upload'</code>
    I was with the view that the same can be implemented by our own code right?

  • Apache Jakarta Commons FileUpload misleading message

    I have a JSP page doing file upload using commons FileUpload package. The code looks like this:
    <%
    DiskFileUpload upload = new DiskFileUpload();
    List items = upload.parseRequest(request);
    Iterator itr = items.iterator();
    while(itr.hasNext()) {
         FileItem item = (FileItem) itr.next();
         // check if the current item is a form field or an uploaded file
         if(item.isFormField()) {
              String fieldName = item.getFieldName();
              if(fieldName.equals("name"))
                   request.setAttribute("msg", "Thank You: " + item.getString());
         } else {
              File fullFile = new File(item.getName());
              File savedFile = new File("c:\\tmp\\",     fullFile.getName());
              item.write(savedFile);
    %>
    The JSP successfully uploaded the files but it still show me HTTP Status 404 - c:\tmp (Access is denied).
    What's wrong with my code? Thank you.

    I just found out that the problem that I have mentioned in my previous post has nothing to do with Jakarta Commons Fileupload. It happens whenever I try throwing an exception. And it happens only when I use Internet Explorer
    Thanks,
    Joe
    See the code below...
    /**** throw-error.jsp ***/
    <%@ page language="java" session="false" isErrorPage="false" errorPage="catch-error.jsp" %>
    <%
    throw new Exception("Catch this!");
    %>
    /****** catch-error.jsp ****/
    <%@ page language="java" session="false" isErrorPage="true" %>
    <html>
    <head>
    </head>
    <body>
    <%
    out.println(exception.getMessage());
    %>
    </body>
    </html>

  • Jakarta Commons FileUpload ; Internet Explorer Problem

    Hi all,
    Environment:
    Tomcat 5 ;Apache 2; JDK 1.5.0; Jakarta Commons Fileupload 1.0
    OS: Windoze XP
    Previously I've used jakarta commons fileupload package to succussfully to upload a file.
    However, I am trying to check the content type of the file and throw an exception if its not a jpeg file. The following code works great when I use firefox. But it fails when I use Internet Explorer!
    When I supply an existing jpg file on my desktop as the input to the HTML form, the code works fine. However if I enter a non-existing jpg filename, I get a "HTTP 500 Internal Server Error"! I expect to get the "Wrong content type!" message (which my JSP throws as an exception and should be caught by the error page). This problem happens only with Internet Explorer. With firefox, I get the "Wrong Content Type" message as expected.
    What could be the problem? Please advise.
    Thanks
    Joe.
    Code follows......
    /************** file-upload.html *************/
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>File Upload</title>
    <script type="text/javascript" language="JavaScript">
    <!--
    function fileTypeCheck() {
         var fileName = document.uploadForm.pic.value;
         if (fileName == "") {
              alert ("Please select a file to upload!");
              return false;
         var indexOfExt = fileName.lastIndexOf (".");
         if (indexOfExt < 0) {
              alert('You can only upload a .jpg/.jpeg/.gif file!');
              return false;
         var ext = fileName.substring(indexOfExt);
         ext = ext.toLowerCase();
         if (ext != '.jpg' && ext != 'jpeg') {
             alert('You selected a ' + ext + ' file;  Please select a .jpg/.jpeg file instead!');
              return false;
         return true;
    //--></script>
    </head>
    <form action="uploadPhoto.jsp" enctype="multipart/form-data" method="post" name="uploadForm" onSubmit="return fileTypeCheck();">
         <input type="file" accept="image/jpeg,image/gif" name="pic" size="50" />
         <br />
         <input type="submit" value="Send" />
    </form>
    <body>
    </body>
    </html>
    /*************** photoUpload.jsp **************/
    <%@ page language="java" session="false" import="org.apache.commons.fileupload.*, java.util.*" isErrorPage="false" errorPage="uploadPhotoError.jsp" %>
    <%!
    public void processUploadedFile(FileItem item, ServletResponse response) throws Exception {
         try {
              // Process a file upload
                  String contentType = item.getContentType();
              if (! contentType.equals("image/jpeg") && ! contentType.equals("image/pjpeg")) {
                   throw new FileUploadException("Wrong content type!");
         } catch (Exception ex) {
              throw ex;
    %>
    <%
    // Check that we have a file upload requeste
    boolean isMultipart = FileUpload.isMultipartContent(request);
    // Create a new file upload handler
    DiskFileUpload upload = new DiskFileUpload();
    // Parse the request
    List /* FileItem */ items = upload.parseRequest(request);
    // Process the uploaded items
    Iterator iter = items.iterator();
    while (iter.hasNext()) {
        FileItem item = (FileItem) iter.next();
        if (! item.isFormField()) {
            processUploadedFile(item, response);
    %>
    <html>
    <head>
    </head>
    <body>
    File uploaded succesfully! Thank you!
    </body>
    </html>
    /******** uploadPhotoError.jsp ****/
    <%@ page language="java" session="false" isErrorPage="true" %>
    <html>
    <head>
    </head>
    <body>
    <%
    out.println(exception.getMessage());
    %>
    </body>
    </html>

    I just found out that the problem that I have mentioned in my previous post has nothing to do with Jakarta Commons Fileupload. It happens whenever I try throwing an exception. And it happens only when I use Internet Explorer
    Thanks,
    Joe
    See the code below...
    /**** throw-error.jsp ***/
    <%@ page language="java" session="false" isErrorPage="false" errorPage="catch-error.jsp" %>
    <%
    throw new Exception("Catch this!");
    %>
    /****** catch-error.jsp ****/
    <%@ page language="java" session="false" isErrorPage="true" %>
    <html>
    <head>
    </head>
    <body>
    <%
    out.println(exception.getMessage());
    %>
    </body>

  • Jakarta commons FileUpload - ServletFileUpload.parseRequest(...)

    Hello people. I am using:
    # Orion app server (don't ask why)
    # WebWork 2.1.7 framework
    # Jakarta commons file upload 1.2
    While writing a file upload action I am having problems with ServletFileUpload.parseRequest(...) as it always returns an empty list.
    Reading related Jakarta FAQ it says "this most commonly happens when the request has already been parsed, or processed in some other way."
    I then assumed it was my WebWork interceptor so I took that out but I'm still getting the same problem.
    Am I missing something in my JSP, another <input> or something?
    Is the request being parsed somehwere else beforehand (maybe a WebWork issue)?
    Any help would be much appreciated.
    Here is the relevant code...
    My JSP<html>
         <head>
              <title>File Upload</title>
         </head>
         <body>
              <form enctype="multipart/form-data" method="post" action="doUpload.action" name="uploadForm">
                   <input name="upload" type="file" label="File"/>
                   <input type="submit" value="upload" />
              </form>
         </body>
    </html>
    The execute() method of my action     public String execute() {
              log.info("executing");
              // get the request
              HttpServletRequest request = ServletActionContext.getRequest();
              // check that we have a file upload request
              boolean isMultipart = ServletFileUpload.isMultipartContent(request);
              log.debug("request "+ ( (isMultipart ? "IS" : "is NOT") ) +" a multi-part");
              if (isMultipart) {
                   // Create a factory for disk-based file items
                   DiskFileItemFactory factory = new DiskFileItemFactory();
                   factory.setSizeThreshold(100);
                   factory.setRepository(new File("C:/tmp/cms/uploads"));
                   // Create a new file upload handler
                   ServletFileUpload upload = new ServletFileUpload(factory);
                   // Parse the request
                   try {
                        //List /* FileItem */ items = upload.parseRequest(request);
                        _uploads = upload.parseRequest(request);
                   } catch (FileUploadException e) {
                        log.error("Error parsing request" , e);
                   // if the above method doesn't work, use my method :)
                   if (_uploads.isEmpty()) {
                        _uploads = parseRequest(request);
              return (_uploads == null) || _uploads.isEmpty() ? INPUT : SUCCESS;
         }My implementation of parseRequest(...) works but returns File objects and I need FileItem objects. I don't really want to use this method but will include it here just incase it triggers some inspiration for someone.
    private List<File> parseRequest(HttpServletRequest requestObj) {
             List<File> files = new ArrayList<File>();
             // if the request is a multi-part
             if (requestObj instanceof MultiPartRequestWrapper) {
                  // cast to multi-part request
                  MultiPartRequestWrapper request = (MultiPartRequestWrapper) requestObj;
                   // get file parameter names
                   Enumeration paramNames = request.getFileParameterNames();
                   if (paramNames != null) {
                        // for each parameter name, get corresponding File
                        while (paramNames.hasMoreElements()) {
                             File[] f = request.getFiles("" + paramNames.nextElement() );
                             // add the File to our list
                             if (!ArrayUtils.isEmpty(f)) {
                                  files.add(f[0]);
              return files.isEmpty() ? null : files;
        }

    Hi edin7976, just wonder have you got any feedback for this problem?
    I really want to push this thread up as I am stuck at the exact same question. Can anybody give a hint?

  • Weblogic 10.3 and commons-lang-2.4.jar

    Dear All,
    I made a web application. It uses some 3party libraries, they are in web-inf/lib directory:
    WEB-INF
    |-sun-web.xml
    |-web.xml
    |-weblogic.xml
    WEB-INF/lib
    |-commons-io-1.4.jar
    |-commons-lang-2.4.jar
    |-xbean.jar
    My web application is running on Glassfish application server. When I tried to to deploy it to Weblogic 10.3 server I got follow error message:
    java.lang.NoSuchMethodError: org.apache.commons.lang.StringUtils.containsIgnoreCase(Ljava/lang/String;Ljava/lang/String;)Z
         at hu.mol.eai.fileadapter.web.PollingTask.getJTAClass(PollingTask.java:589)
    The reason of the exception: there is an older version of commons-lang library in classpath and the application server loaded this library on startup. I found library in /bea_10.3/modules/com.bea.core.apache.commons.lang_2.1.0.jar.
    If I delete it and the newer version of library (commons-lang-2.4.jar) copy to the /bea_10.3/modules/ directory my web application is working.
    I think this solution is a hacking, because I overwrite an original library of application server. I is not too nice solution for a big company environment where there is a support agreement with Weblogic partner.
    Could you give me a good / nicer solution?
    thank you, zappee

    Thank you for your answer.
    And what can I do if my war file is in an ear file?
    Structure of my enterprise application:
    *.ear
    |-lib\commons-lang-2.4.jar
    |-lib\....jar
    |
    |-FileAdapterWeb.war
    |-FileAdapterCommons.jar
    |-FileAdapterPlugins.jar
    |-schema.jar
    |- ...
    I do not want to put commons-lang-2.4.jar into *.war and lib directory same time. The all components of my enterprise applications are going to use commons-lang-2.4.jar. For example: it uses FileAdapterWeb.war and FileAdapterPlugins.jar too.
    Is there a solution for me?
    thx, SoMa

  • Java.io.File vs. Jakarta Commons Upload

    Does anyone know what the difference is between using Jakarta Commons Upload functionality vs. using Java's File API? It seems I could simply use Java's API with the same results. Is there some major difference between the two that I'm missing?

    Does anyone know what the difference is between using
    Jakarta Commons Upload functionality vs. using Java's
    File API? It seems I could simply use Java's API
    with the same results. Is there some major
    difference between the two that I'm missing?I guess one's to upload files using a servlet while the other one's for modelling a path in the local file system...
    About the difference between a parking lot and the car in your driveway.

  • Jakarta Commons - Using FileUpload

    Hello Java Experts!
    I'm trying to use the FileUpload feature from Jakarta Commons 1.2 and I'm having a real tough time uploading a file to an http server and then calling that file back so that the user can view their newly uploaded file. I'm able to store the file successfully if I point my file to "C:\Temp", however if I try to point the file to "http:\\mywebserver\temp" or to a network location (which I mounted) "\\mynetwork\myfolder\temp" I get an exception FileNotFoundException.
    I've searched the web and have not been able to find a resolution to this point. Any help would be greatly appreciated.
    Here is my code so far:
    DiskFileItemFactory fileUpload = new DiskFileItemFactory();
    fileUpload.setSizeThreshold(10485760);
    final String serverLocation = "http:" + "\\" + "\\webserver:8080\\temp");
    ServletFileUpload upload = new ServletFileUpload(fileUpload);
    // Set overall request size constraint
    // Max. 4 MB : 1 MB = 1048576 bytes
    upload.setSizeMax(4194305);
    List items = upload.parseRequest(request);
    Iterator iter = items.iterator();
    while (iter.hasNext())
    FileItem item = (FileItem) iter.next();
    if(item.getSize() > 0)
    File savedFile = new File(serverLocation + "test.tif");
    item.write(savedFile); // This does not work, the file is never written
    }

    You're getting this message when you try to compile the servlet, right? Make sure that jar file is in your classpath. Having it in Tomcat's classpath is fine for when Tomcat runs things but it has nothing to do with compiling.

  • Commons lang problems

    Hi there!
    Sorry if I post this in the wrong section. But I was unsure of which to choose so I took the most general.
    To my problem. I want to use commons lang (http://commons.apache.org/lang/) but I cant make it work. I made a simple testclass to show you the problem:
    import org.apache.commons.lang.builder.ToStringBuilder;
    public class Person
      private String name;
      private int age;
      public Person(String name, int age)
        this.name = name;
        this.age = age;
      public String getName()
        return name;
      public void setName(String newName)
        this.name = newName;
      public int getAge()
        return age;
      public void setAge(int newAge)
        this.age = newAge;
      public String toString()
        return new ToStringBuilder(this)
          .append("name", name)
          .append("age", age)
          .toString();
      public static void main(String[] args)
        Person p = new Person("Peter", 23);
        System.out.println(p);
    }And this is the output from when I run it:
    *$ javac -classpath /usr/share/java/commons-lang.jar Person.java && java Person*
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/builder/ToStringBuilder
         at Person.toString(Person.java:36)
         at java.lang.String.valueOf(String.java:2615)
         at java.io.PrintStream.print(PrintStream.java:616)
         at java.io.PrintStream.println(PrintStream.java:753)
         at Person.main(Person.java:45)

    *$ javac -classpath /usr/share/java/commons-lang.jar Person.java && java -classpath /usr/share/java/commons-lang.jar Person*
    Exception in thread "main" java.lang.NoClassDefFoundError: PersonI have also tried with:
    CLASSPATH="/usr/share/java/commons-lang.jar" javac Person.java && java Person

  • Apache commons-lang version in Oracle SOA Suite 10.1.3.3.0

    What is the Apache commons-lang version used in Oracle SOA Suite 10.1.3.3.0?
    I was using commons-lang-2.4 classes in writing an Identity service plugin and ran into an issue.

    Did you find a solution to this issue? We are having a similar issue trying to deploy a Paypal IPN on OAS 10.1.2.3. The IPN messages coming from Paypal appear to be attempting an SSLv2 handshake. In our case SSLv2 is disabled due to our security requirements so the connection is killed by our App Server. We have found that manually sending the IPN messages works correctly.

Maybe you are looking for