File Manipulation in an EJB

I am trying to write an application that needs to do some manipulation of files. I thought about using an EJB and T3File, but it has been deprecated. The documentation suggests: "BEA recommends that you develop a customized, stateless EJB to service these requests." Now since java.io is not recommended for use in an EJB, what else do I use? Any assistance would be appreciated.
Thanks in advance.

Found a solution.
Talked to my BEA technical rep. He recommended using a file event generator with
WebLogic Integration. I'm proceeding along that line.
Scott Person <[email protected]> wrote:
I am trying to write an application that needs to do some manipulation
of files. I thought about using an EJB and T3File, but it has been
deprecated. The documentation suggests: "BEA recommends that you develop
a customized, stateless EJB to service these requests." Now since java.io
is not recommended for use in an EJB, what else do I use? Any assistance
would be appreciated.
Thanks in advance.

Similar Messages

  • How to make jar files availabe for deployed EJBs

    Hi,
    I'm interested on how to make jar files availabe for deployed EJBs.
    My EJB is packed in an ear. It uses a util jar. I now just add the jar to the
    classpath, but I think that shouldn't be the way. Is there somthing in the admin
    console to make jars available or do I have to insert it in the ear file? And
    if so, where do I hve to place it?
    Thanks
    Claudia

    Put the util.jar in the ear with your ejb jars - at the same level (i.e. in
    the root) - but do not include them in the manifest.xml.
    Also each ejb jar that refers to util.jar must have util.jar on its internal
    classpath in the manifest.
    "Claudia" <[email protected]> wrote in message
    news:3d537db5$[email protected]..
    >
    Hi,
    I'm interested on how to make jar files availabe for deployed EJBs.
    My EJB is packed in an ear. It uses a util jar. I now just add the jar tothe
    classpath, but I think that shouldn't be the way. Is there somthing in theadmin
    console to make jars available or do I have to insert it in the ear file?And
    if so, where do I hve to place it?
    Thanks
    Claudia

  • Handling file objects in the EJB layer

    It is seen that file handling in the EJB violates the specs.
    But, I have the requirement to read and parse some xpdl(xml specification) file in EJB.
    The parsing function is already in the EJB layer and the filepath is obtained as input from jsp(in the request) in a servlet.
    Im passing the filepath as a parameter to the bean method before parsing.
    Now the requirement is to construct the File object out of xpdl file and pass it as a parameter to EJB method. How can this be achieved?

    Hi,
    I'm not sure if this is helpful or not, but I just wanted to ask: If you know you need to parse the file on the EJB side, why not just go and do it? If you can always guarantee that files will be present in the same location that the beans are deployed to, then I don't think there is anything stopping you from reading them, if you know the full path to each file?
    You wrote that the path to the file is obtained from a JSP page. If those files need to be parsed anyway, you could move the parsing code to your JSPs (servlets), and use ServletContext.getResourceAsStream to read the contents. Then you could send the contents as a parameter to your EJB call.
    One last thing: if the files are large, you might want to consider using JMS and message-driven beans to do the reading/parsing job. Your MDBs could then call the EJBs, but you would have to return your results in an asynchronous manner.
    Just a couple of thoughts.
    Mark

  • What is best way to do file i/o in ejbs?

    We have a text file with messages that the EJB tier needs access to. Currently we do file streaming but I know that doesn't allow the container to handle that activity properly in the advent of problems.
    What is the recommended way of dealing with file access in ejb?

    Matt,
    One of the projects where I worked tried to write to a log file from within an EJB (I believe they were using log4j). It worked fine in development (small log file, not many transactions on the app server), but generated errors in production. I believe the errors were "request timeout" since it was taking a long time to process the log file.
    In the past I have created my own exception that contained a string identifier. At the top of the exception-chain I had an exception handler that would use the identifier to lookup user-friendly text in a database and formatted the error in a nice way. You might consider this method, but put the error handler in the web tier where it has legal access to the error-text file. But it sounds like your code does not have the error processing code as isolated as you would like.
    I think that will close off this thread, unless someone wants to suggest a way of legally logging events and errors in the EJB container.
    Todd

  • FileNotFoundException thrown when opening a file for writing from EJB

    Hi,
    I know it is against EJB rules that access file IO from EJB. However we have a legacy system to working with and we need to generate a text file on file system.
    Weblogic (we are using 10.3) allows open a file for read from EJB. When we tried to open a writer like below:
    BufferedWriter writer = new BufferedWriter( new FileWriter(fileName, false));
    FileNotFoundException was thrown from the native method of open. The fileName is an absolute path and permission is properly set. The same piece of code can execute correctly in a test application with same filename.
    Does anyone know how to achieve this or whether Weblogic just forbids this kind of output access?

    Sorry guys. Just double-checked the source code and found out a bug produced wrong filename, the filename was surrounded by "", so FileNotFoundException is a correct result.
    Weblogic does allow read/write external file.

  • File Manipulation (ala Windoze Explorer)

    I have had to use Windows and Dos for years due to applications not being available in the MAC environment. Then a few years I bought a Mini and have not regretted the move since. EXCEPT when I want to do some serious file manipulations. From my limited MAC experience I cannot easily perform tasks in OSX that are simple and routine in Windows.
    Example: I like to "search" for all files of a type, say "*.M4V", then I like to copy them to a DVD and then delete the originals on the hard drive. This frees up space and gives me easy access of files of a similar type. Movie, music, graphics and similar large files that I might not access often do not need to be stored on the computer.
    When I use the "Spotlight" tool, it will show me any occurrence of the search term (not just as an extension like I would prefer) and I cannot do any "group" file manipulations, i.e. copy to a burn folder then after I verify that the files are "good" on the DVD/CD, I would like to then delete the same files as a group.
    In Windows I highlight, right click, copy, I then open the destination folder, right click and paste. Or if I want to see how much space I am using in these particular files, I right click, select "Properties" and I know if I need a CD or a DVD to store the selected files.
    To delete the "backed up files" I can click on the Search Window, the selected files are still highlighted and I right click, select "Delete" and Boom bada bing, they are gone. I can do all of that in a few simple clicks in Win(ugh)doze, how do I do that in OSX, doesn't MAC make thinks simple and intuitive?
    Any help will be appreciated here, I would think mimicking a Windows feature would be simple. Thanks in advance.

    Hmm - maybe I am missing something, but I can do all those things in just about the same way. Using Finder > Find…, I can do a search for a file extension, in addition to any other criteria I come up with (including a raw metadata query) - note that the extension does not contain the period, that is just a separator. If I plan on doing similar searches in the future, the search query parameters can be saved so that I don't have to enter them again. I can then create a burn folder on the desktop and drag whatever items from the search window to it, and a Get Info on the burn folder will show what the content size of the burn will be. Right-clicking on the selected items and selecting Move to Trash deletes them, the same as any other Finder item - there is no file copy/paste in the Mac OS, though (never has been as far as I can remember).

  • File manipulation in JavFX

    How to perform file manipulations in JavaFX ?

    Future reference, java doc can easily found by doing a google search of java api.
    Here is a link to 6:
    [http://java.sun.com/javase/6/docs/api/]
    Also, you need to learn some java basics these are all java basic questions...
    Simple code in pure java not javafx:
    FileReader inReader=new FileReader("myfile.ext");  // Note you could use a file object or a string here
    FileReader bufReader=new BufferedReader(myInput);  // Taking my input stream into another input stream
    char c=bufReader.read();  // I read the first character of the file
    String line=bufReader.readLine(); // I read the first line of the file ended by a \r or \n (carriage return or line feed) Note skips first character because of the read() above.
    char [] section=new char [100];
    bufReader.read(section, 10, 40);  // I just but into a char [] starting at the 10 value in the array and reading to 40 characters into the array.  Basically 10-39 of the 100 array has the next 40 characters in it starting at second line of stream.Also other things to move back into the stream read javadoc there are plenter of other readers/writers and input/output streams. What is the difference between a reader/writer and input/output stream? You shouldn't care. Above when I said stream I meant reader though.
    Note you need a writer or output stream to write to a file and a reader or input stream to read from a file. The mention above of the array route [] probably won't work in javafx since it doesn't support arrays it uses sequences instead so I'd avoid that method in a javafx script class.
    Good luck and read some java basics or take some java basics tutorial plenty things out there covering this as well as google could have easily told you all of the above.

  • Not able to update single file in a non ejb Module related jar

    Hey all,
    I have depoyed my j2ee application <b>.ear</b> on NW webAS .
           This application apart from having all the ejb Modules related jar, <b>also has a jar which has all my properties files</b> being accessed by my application.
    Very often is it required by me to update these files and restart the application. However i couldnot find a way to update these single files.
    When i select by deployed application.ear and click <b>Single File Update</b> feature provided by SAP in visual Admin, it shown only ejb modulerelated jar. It dosent show my jar containing properties file.
    I have to redeploy my application again everytime i change a small properties file.
    Please let me if there is a way to update these sngle files

    Hi,
    >
    Vikram D Salvi wrote:
    > MOVE-CORRESPONDING ZSTRUC_CM TO I_TAB.                                                                            not working
    >
    > UPDATE ZTEST_CM FROM ZSTRUC_CM.                                                                                not working
    Instead of the move statement you need to use the append work area to internal table statement. you need to have the same structure for the work area and the internal tbale.
    Then use the modify data base table from internal table statement.
    Regards
    Ansari

  • File IO operation in EJB (Session Bean)

    Hi all,
    Requirement : Read contents of a text file and upload the same to Oracle database (table).
    I have created a Java class (application kind of) which opens, reads a file and transfers its data to a Oracle table.
    Can I instantiate the same class within a Session Bean to perform the same operation or as per the EJB Restrictions this is not supposed to be done?
    EJB Specifications 2.1 pdf guide
    (refer 25.1.2 Programming restrictions
    An enterprise bean must not use the java.io package to attempt to access files and directories in the file system. The file system APIs are not well-suited for business components to access data. Business components should use a resource manager API, such as JDBC, to store data.
    Awaiting ur responses at the earliest.
    Thanking in advance,
    Seetesh

    Hi Kenneth,
    Thks for ur post.
    I have coded the same using Weblogic App Server 7.0 ie a jsp invoking a java class (FileIO.class)(using jsp:useBean) and writing which does the IO operation and this works just fine.
    Will this work by replacing the jsp with a Session Bean.
    ie Session Bean's business method executing the method in the FileIO.class
    Rgds,
    Seetesh

  • Saving in files in webcontext from ejb

    How do I make a session EJB save data(image, xml files, etc) in the webapp root context like a images dir??
    Or asked in a other way how do I make data(again image, xml files, etc) accessible to both the EJB's and the webapp frontend(the html).
    If anybody got a exmple or howto I would love to see it.
    Regards
    /marc

    How do I make a session EJB save data(image, xml files, etc) in the webapp root context like a images dir??
    Or asked in a other way how do I make data(again image, xml files, etc) accessible to both the EJB's and the webapp frontend(the html).
    If anybody got a exmple or howto I would love to see it.
    Regards
    /marc

  • Shared utility class file among servlets and Ejb

    I have the following context:
    XXX.war:
    WEB-INF\
    Jsp files
    WEB-INF\classes\
    WEB-INF\lib\
    WEB-INF\web.xml
    WEB-INF\weblogic.xml
    YYY.jar
    META-INF\
    Class files
    META-INF\ejb-jar.xml
    META-INF\weblogic-ejb-jar.xml
    In XXX/WEB-INF/classes/…/Util.class
    In YYY/util.class
    How can I share Util.class between both XXX and YYY?
    Cheers,

    If you are on 8.1 check out
    http://e-docs.bea.com/wls/docs81/programming/classloading.html#1069420
    The larger document talks about how classloading works in Weblogic
    Dave
    <mehdi valizadeh> wrote in message news:[email protected]..
    I have the following context:
    XXX.war:
    WEB-INF\
    Jsp files
    WEB-INF\classes\
    WEB-INF\lib\
    WEB-INF\web.xml
    WEB-INF\weblogic.xml
    YYY.jar
    META-INF\
    Class files
    META-INF\ejb-jar.xml
    META-INF\weblogic-ejb-jar.xml
    In XXX/WEB-INF/classes/???/Util.class
    In YYY/util.class
    How can I share Util.class between both XXX and YYY?
    Cheers,

  • File I/O in EJB 2.0

    App. Server: J2EE 1.3 RI
    EJB 2.0
    We have a requirement where we need to write to a file, from an ejb, using a helper class.
    As per EJB 2.0 specs, this is permitted.
    However, while doing this we are getting "AccessControlException."
    We tried changing the server security policy file granting all permissions, after which the exception was not thrown.
    Question-Is this a proper approach for file I/O from an ejb.
    Can someone suggest an alternative approach asap.
    Thanks.

    I know there is commitment within the specification group to support many different data sources, not only SQL based. I think they meant that you could access a file in some decoupled fashion such as JDBC.
    One way you can do this is write an RMI startup service and bind it to your JNDI tree. Then your beans/helpers can look this service up with JNDI and invoke its methods which can handle the file i/o. Another possibility with EJB servers that support CORBA to write a similar CORBA service that you can use for file i/o's.

  • Unable to access classes in third party jar files packaged with my ejb.jar

    I have packaged some third party jar files in my xxx_ejb.jar file.  The third party jar file contains classes that are accessed by some custom classes which are in turn accessed by my bean classes.  I get the following error when my custom classes attempt to use any of the classes in one of the third party jar files:
    java.lang.NoClassDefFoundError: com/Ostermiller/util/CSVParser
    Shouldn't I be able to access classes in jar files that are packaged with my xxx_ejb.jar file?  I see the xxx_ejb.jar file as a resource of the application classloader that contains it but I don't see the third party jar files.

    As per the Java EE specification, additional JAR files should be packaged on the EAR level. Only WAR files' WEB-INF/lib folder is scanned for JAR files to be added to the classloader.

  • Aperture Crashes Every Time on Launch Following Large File Manipulation

    I've been using Aperture 2.1.3 (and previous) to work on bigger TIFF files (200MB+) which are scans of large format negatives (made with Silverfast AI Studio). I routinely get the "Red Screen of Death" (Unsupported File Format) but restarting Aperture fixes the problem and lets me work for another 5-30 mins before needing another restart. Usually, before it gives the Red Screen or a crash it draws a horizontal white line of single pixels across the right side of an image I work on. Also, randomly, some versions just show all in black.
    All of those files work perfectly in Photoshop CS4 (and CS2).
    Unfortunately, as I tried to create a new version from master today Aperture crashed but it will no longer start properly. It starts, shows me the usual screen and I even get a chance to quickly click on a project, but about 5 seconds after starting it crashes, always, and every time.
    How can I fix it?
    Can I, perhaps, delete the most recently edited master from the library somehow, assuming that it is causing offence?
    Would anyone with Lightroom experience comment if it is more stable?
    Many thanks,
    RL.

    I wouldn't claim any Aperture expertise, but you seem to have answered the question I just asked in the Aperture vs Lightroom topic (http://discussions.apple.com/thread.jspa?threadID=1999997&tstart=0).
    My solution, unfortunately, was to migrate to Lightroom.
    Thanks!

  • Avi File Manipulation?

    Hello,
    I was wondering if it is possible to take an AVI file and simply add text to it. Like an On Screen Display. I have a device that takes and gathers the amount of feet that a cable is run with a camera attached. That video is than taken and compressed to AVI, however it is hardware compressed. So now the question is if I can get the measurements into my application is there away I can add them to the video either during or after.
    I am assuming that the video is Managed memory thus ruling out this idea. My next idea was to save the measurements to a database file and than upon completion of the recording add the data to the video file. This seems easier and more plausible as it shouldn't effect the speed or performance of the live recording.
    Any ideas, links or suggestions are greatly appreciated.
    Thanks.

    Heres another thought. Would it be easier to take and blend 2 AVI files into 1? If so couldn't I simply make another streaming video out of Bitmaps and simply capture them at the same time into a stream?
    I am all out of ideas guys =/.
    I really really need to make a software based On Screen Display though as we use analog signals with our equipment and quit honestly OSD chips are disappearing in the market for analog signals. Unfortunately we are in a niche market that we have to use analog for quit some time yet =/.

Maybe you are looking for