Working with ExtensionData attribute (byte arrays)

Hello all,
I am working with the ExtensionData attribute in PowerShell, which is in byte array form. What I am wanting to do is change a part of this ExtensionData attribute, but still keep the byte array form. What I am currently trying makes the change successfully,
but I lose the byte array form. For example, before changing the ExtensionData attribute, Group1's ExtensionData attribute is populated on several lines within the attribute. After changing the attribute, Group1's ExtensionData attribute has all the same values,
but is now contained on a single line. Here is the code used:
#Finding Group1's ExtensionData attribute, in string form
$ExtensionData = Get-ADGroup "Group1" -Properties extensiondata | select -ExpandProperty extensiondata | ForEach-Object {
[System.Text.Encoding]::ASCII.GetString($_)
#Let's assume Group1's ExtensionData attribute looks like this (multiple lines):
#OldLine1
#OldLine2
#OldLine3
$StringOld = "OldLine1"
$StringNew = "NewLine1"
#making sure line I want to change is present in string form of ExtensionData attribute, then we change the part we want
If($ExtensionData -match $StringOld){
$ExtensionData -replace "$StringOld","$StringNew"
#Now we convert our new ExtensionData string form back to ASCII form
$change = [System.Text.Encoding]::ASCII
$NewExtensionData = $change.GetBytes($ExtensionData)
#Now, we can replace Group1's ExtensionData attribute with our new ExtensionData attribute
Set-ADGroup Group1 -Replace @{extensiondata=$NewExtensionData}
#However, now Group1's ExtensionData attribute looks like this (no multiple lines):
#NewLine1OldLine2OldLine3
How can I replace a line in the ExtensionData attribute and still keep the multiple lines within the attribute?

David,
Thanks again for taking time to help me out with this problem! I've solved my problem, but had to perform a few steps along the way. Long story short, I slightly modified the code you provided using -match and -replace for the strings, and then
when I tried to use -replace on the set-adgroup cmdlet, PowerShell griped and said value already present.
However, I was able to get it to work by clearing the extensiondata attribute first and then using -add. This put the bytes into the extensiondata attribute as expected, but there were 2 problems with this. First, it looked like each byte was it's own array
within the attribute. Second, the original ExtensionData attribute had strings in it, not bytes. I have since realized that bytes is how PowerShell reads the array, but not how ADUC displays it.
What I did was use the following code:
cls
$ExtensionData = @(
Get-ADGroup "Group1" -Properties extensiondata |
Select-Object -ExpandProperty extensiondata |
ForEach-Object {
[System.Text.Encoding]::ASCII.GetString($_)
$StringOld = "OldString"
$StringNew = "NewString"
for ($i = 0; $i -lt $ExtensionData.Count; $i++)
if ($ExtensionData[$i] -match $StringOld)
$ExtensionData[$i] = $ExtensionData[$i] -replace "$Stringold","$StringNew"
Set-ADGroup SmartDL-test -replace @{extensiondata=$ExtensionData}
As you can see, I still use -match and -replace to swap out the part of ExtensionData that I want. But it turns out I didn't need to convert the strings into bytes before using the set-adgroup command. I was able to just replace the part of the extensiondata
collection I wanted, and then just paste the entire new collection into the attribute, and for my purposes it appeared to work.
Anyway, I really appreciate your help on this, and it must be difficult helping someone troubleshoot when you can't see specifically what they're trying to do. Your post was extremely helpful however, and it led to the solution that worked for me. Thanks
again!

Similar Messages

  • CommandLink doesn't work with rendered-attribute

    Hello,
    I have quite a strange problem.
    I have a commanLink, which has a rendered attribute. The link is rendered conditionally, so the rendered-value comes from a bean.
    <h:commandLink rendered="#{Bean.canEdit}" action="#{Bean.selectDocumentToEdit}" >
               <h:outputText value="Edit doc" />
                              <f:param name="param" value="#{Bean.doc.id}"/>
    </h:commandLink>Showing the link is working like it should, but commandLink is not working with this. When I change rendered="true", commandLink works ok. But now it doesn't call the commandLink action at all.
    Any help would be appreciated

    rendered="true", commandLink works ok. But now it
    doesn't call the commandLink action at all.I meant it doesn't call the commandLink action method when retrieving rendered-value from bean.
    I'm using RI 1.1.01

  • Extract function not working with tag attributes

    Hi all,
    I have an xml document stored in the db as an xmlType. I am trying to use the extract function to retrieve values. The extract will work fine on tags without attributes. Any tags with attributes or tags beyond the tags with attributes will not be accessible.
    <tag1>
    <tag2>hi</tag2>
    <tag3 att="hello">bye</tag3>
    <tag4> hi again </tag4>
    </tag1>
    In the example above I can extract tag2 values but not tag3 or tag4 values.
    here is my select statement
    works
    select e.xmlval.extract('/tag1/tag2').getStringval()
    from test_xml e;
    does not work
    select e.xmlval.extract('/tag1/tag2/tag3').getStringval()
    from test_xml e;
    does not work
    select e.xmlval.extract('/tag1/tag2/tag3/tag4').getStringval()
    from test_xml e;
    Any ideas?

    Hi all,
    Found the issue. The problem was that I was not specifying the second argument to the extract function.
    The tag attribute that I was not handling was xmlns="".
    I used this atttribute as the second argument in the extract function and now I am off and running.
    Hope this helps someone.
    Cheers

  • Value binding not working with rendered attribute

    In my jsf page i'm encountering problem with value binding it is not working for a h:inputText with rendered condition even when the rendered condition evaluates to true & the component is rendered.While trying to retrieve the value of the components with conditional rendering on submit i'm unable to retreive the value while on removing rendered condition the value binding is working perfectly
    <h:selectOneMenu id="DropDown" value="#pc_GeneralRequestInfo.objInfoDTO.State}" rendered="#pc_GeneralRequestInfo.objAddressRequestDetailsDTO.selectedAddressType == 'HOME'}">                    
    <f:selectItems value="#{pc_GeneralRequestInfo.statesList}" />
    </h:selectOneMenu>

    There is a { missing from the value attribute in the code you posted.                                                                                                                                                                                           

  • Working with process attributes ...

    Hello,
    I'm new to Oracle Workflow and I'm just wondering how to use process attributes!
    If a create one I can assign a value to it using the process properties. But in the (sub-)process itself I can't see it?
    If this does not work, what is the best practice to pass some attributes to a subprocess without using the "global" item type attributes?
    Regards
    Erik

    (Excuse me for bothering again?!)
    (Is there something wrong with this question?)
    I'll try to explain my question again:
    First I've created an attribute for a subprocess. Next I added this subprocess to my main process. Selecting the properties in the context menu of the subprocess icon I can see my subprocess-attribute as a node attribute.
    But in the subprocess itself I can't see this subprocess-attribute. I'm not able to use this subprocess-attribute in one of my node-activities.
    What am I doing wrong?
    How can I define "local" variables just for a single process?
    Or do I have to use "global" item type attibutes so that I'm able to access them in all of my (sub)processes?
    (Maybe in a huge workflow there will be many "global" item type attributes just for transfering some attribute data to some (sub)processes?)
    Any help is appreciated!
    Thanks!
    Erik

  • Does BC work with "Make attribute editable"?

    Previously, I've built templates which include editable optional regions where I can then edit the template properties and adjust the classes using Modify > Template > Make Attribute Editable, and be able to change the class of an item per page. When I try to do this now, Modify > Template properties is greyed out, so I can't implement this feature (I'm assuming because it's a BC-integrated template). Does this feature integrate well with BC? I can't figure out the best way to implement a sub-menu system where the current page class changes for a menu item (see image). Any thoughts/ideas? I don't want to hve to make 15 templates to have to edit.
    Would content holders work?
    In case you're not familiar with this feature:
    Here's Adobe's feature page for this:
    http://help.adobe.com/en_US/dreamweaver/cs/using/WScbb6b82af5544594822510a94ae8d65-7aa5a.h tml
    And a YouTube tutorial:
    http://www.youtube.com/watch?v=KlD2e9QkGvA

    Not what I was refering to in terms of the tag but admin use. You may not use the admin to manage sites but cleints do. I see a lot of people develop or build BC sites in a way that do not consider their cleints using it properly. I Can implement heaps more things then I actually do for clients but I do not do so if it wont be nice to manage. It is scraped and other sollutions made. Even if that means more scripting.
    I did the above ONCE and the client had a very very hard time managing their pages in the admin, it was a mess and never did it again.
    Script could work but you would also need to strip out the spaces or replace them with regex. The effort though and then the need to add them in into the css manually each time is not really very maangeble. There are a number of other options instead.

  • Working with xpath attribute values in WLS 12c deployment plans

    I'm trying to use a deployment plan to adjust the hibernate.dialect property in persistence.xml
    persistence.xml
    <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect" />
    but whenever I attempt to refer to attributes in xpath using the usual @ sign, I get an XPathLexer barf.
    plan.xml
    <variable>
              <name>dialect</name>
               <value xsi:nil="false">org.hibernate.dialect.Oracle10gDialect</value>
    </variable>
                 <variable-assignment>
                     <name>dialect</name>
                     <xpath>/persistence/persistence-unit[@name="DPLV1PU"]/properties/property[@name="hibernate.dialect"]/@value</xpath>
                     <operation>replace</operation>
                 </variable-assignment>
    I receive:
    Error loading the persistence descriptor META-INF/persistence.xml from the module DPLV1EJB.jar.  See the following stack trace for nested errors: weblogic.application.descriptor.DeploymentPlanException: [Munger:2156213]An error occurred while parsing the specifed XPath "/persistence/persistence-unit[@name="DPLV1PU"]/properties/property[@name="hibernate.dialect"]/@value" : line 1:31: unexpected char: '@'.
    line 1:31: unexpected char: '@'
      at weblogic.application.descriptor.parser.XPathLexer.nextToken(XPathLexer.java:148)
    It seems wrong that I can't use a basic xpath feature like the @ to refer to an attribute here. Nor does the alternative axis syntax attribute:: work.
    It's almost like there isn't a real XPath implementation under there. 

    Hi Chris,
    I remember an earlier discussion along these lines... I haven't tested this myself, but the docs do say this:
    Generic File Loading Overrides
    This feature allows you to place application-specific files to be overridden into a new optional subdirectory (named /AppFileOverrides) in the existing plan directory structure. The presence or absence of this new optional subdirectory controls whether file overrides are enabled for the deployment. If this subdirectory is present, an internal ClassFinder is added to the front of the application and module classloaders for the deployment. As a result, the file override hierarchy rules follow the existing classloader and resource loading rules and behaviors for applications. For more information on WebLogic Server application classloading, see WebLogic Server Application Classloading in Developing Applications for Oracle WebLogic Server.
    It seems to me that this would be the way to customise the bc4j.xcfg in the deployment plan. In the 10g days, I did this by building my EARs using ANT - I had several bc4j.xcfg files sitting in a separate directory, and each of my targets (dev/test/qa/prod) used the appropriate bc4j.xcfg to build the EAR. I did do a bit of research, and I didn't find anything obvious that would let you use a deployment plan directly for changing bc4j.xcfg - you cannot use the WLS console to change any of the properties (if you could do it via a deployment plan directly, I would expect to find the option there).
    Sorry for the rambling post which doesn't give you any definitive answers, but it's just a brain dump at this point.
    John

  • Working with Classes and Arrays

    hello to all,
    public class Store
    //private data
    private Person list[];
    private int count;
    private int maxSize;
    //constructor starts
    public Store(int max)
    count = Person.count(); //sets count to 0     
    maxSize = max;//maxSize is equals to max
    Person list[] = new Person[maxSize];
    }//end of store
    //constructor ends
    //accessor starts   
    public int getCount()
    for(int i=0; i<list.length; i++)
    int result = list;
    return result;
    }//returns the number of elements currently in store
    the code above is working with classes and some arrays
    what am trying to do is to display what the array holds
    and then i meet an error saying that
    INCOPATIBLE TYPES - FOUND PERSON BUT EXPECTED INT
    Please note that am new to this!
    Thank you in advanced!
    <img src="file:///C:/Documents%20and%20Settings/fh84/Desktop/untitled.JPG" alt="" />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    public class Store
        //private data
        private Person list[];
        private int count;
        private int maxSize;
    //constructor starts
        public Store(int max)
             count = Person.count(); //sets count to 0     
             maxSize = max;//maxSize is equals to max
            // Person list[] = new Person[maxSize];
             Person list[] = new Person[maxSize]; //set tne
        }//end of store
    //constructor ends
    //accessor starts  
        public int getCount()
            for(int i=0; i<list.length; i++)
                int  result = list;
    return result;
    am sending the code again                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • InsufficientMemoryException while sending large byte array in WCF Service callback

    Hi
    I have a datacontract with a large byte array that is passed by the WCF Service back to the client using a callback contract.
    Until the byte array size remains below 25-30 MB, it is passed OK, but as soon as it exceeds that, an InsufficientMemoryException is thrown on the service side. I have set the max message sizes at 100 MB and using MTOM Encoder.
    I am using WSDualHTTPBinding with sessions and message security - hence streaming is not an option. I know chunking channels are an option, but I want to try to tune the service and client to maximize the byte array size which can be sent over a normal channel.
    Kindly advise how to tune settings to get to around 100 MB byte array size.
    Binding section of web.config is given below. Same settings for sizes are used on client.
    Thanks
    Abhishek
     <wsDualHttpBinding>
            <binding name="WSHttpBinding_IService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
    transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="100000000" maxReceivedMessageSize="100000000" messageEncoding="Mtom" textEncoding="utf-8" useDefaultWebProxy="true">
              <readerQuotas maxArrayLength="100000000"  />
              <security mode="Message">
                <message clientCredentialType="Certificate" algorithmSuite="Default"  />
              </security>
            </binding>
          </wsDualHttpBinding>

    Hi abhisinghal21,
    >>InsufficientMemoryException while sending large byte array in WCF Service callback
    First please try to increase the timeout value in the both client and service side to see if it works:
    closeTimeout="00:10:00" openTimeout="00:10:00"
    receiveTimeout="00:10:00" sendTimeout="00:10:00"
    Then since you do not want to the use the Chunking option to help you, maybe you try to change the wsDualHttpBinding to use the binding which supports the streaming mode and supports callback.
    In streaming transfer mode, the receiver can begin to process the message before it is completely delivered. And the streaming mode is useful when the information that is passed is lengthy and can be processed serially. Streaming mode is also useful when the
    message is too large to be entirely buffered. So it will be better for you to use the streamed mode.
    For more information, please try to check:
    #How to: Enable Streaming:
    http://msdn.microsoft.com/en-us/library/ms789010(v=vs.110).aspx .
    Best Regards,
    Amy Peng
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Creating a byte Array dynamically.Urgent Help needed.

    Hi there,
    I need to create a byte Array with the values
    derived from the array and then am passing this byte array
    to a method.
    Example :
    public static void main(String[] args) throws IOException {
    char chars[] = {'a','j','a','y'};
    byte[] b = {
    (byte) chars[0],(byte) chars[1],(byte) chars[2],(byte) chars[3],
    //** Send name to a server.
    sendRequest(b);
    This is all right.
    But here I know the size of the character array chars.
    If it had more than 4 characters or less than 4,
    is there a way to create the byte array dynamically based on the values in the character array?
    Please can some one help me with creating a byte array on the fly?
    Has anyone understood my question please?
    A response is much much appreciated.

    The actual problem is this.
    The byte array already has some fixed values to it
    and i need to append the values of the character array
    to this byte array
    ie
    char chars[] = {'a','j','a','y'};
    byte b[] = {
    // Predefined values
    (byte) 0x01, (byte) 0x7E, (byte)0x03
    // I have to add the values from the array here
    (byte) chars[0], (byte) chars[1]....
    How can I add these values.? The size of the character array
    can vary

  • Creating a byte Array dynamically.An Urgent Request.

    Hi there,
    I need to create a byte Array with the values
    derived from the array and then am passing this byte array
    to a method.
    Example :
    public static void main(String[] args) throws IOException {
    char chars[] = {'a','j','a','y'};
    byte[] b = {
    (byte) chars[0],(byte) chars[1],(byte) chars[2],(byte) chars[3],
    //** Send name to a server.
    sendRequest(b);
    This is all right.
    But here I know the size of the character array chars.
    If it had more than 4 characters or less than 4,
    is there a way to create the byte array dynamically based on the values in the character array?
    Please can some one help me with creating a byte array on the fly?
    Has anyone understood my question please?

    Well, if you have the byte array already, you're probably going to have to either make the original array large enough to hold whatever you would put into it or create a new array when you know what you are going to add.
    This seems pretty simple, so maybe I'm missing the point. But...
    char chars[] = { ... };
    byte bytes[] = new byte[<some other size> + chars.length];
    for (int i = 0; i < chars.length; i++)
    bytes[i + <offset>] = (byte)chars;
    If you can't effectively figure out a static size for this array and you have to copy contents, look at System.arrayCopy() to possibly improve performance of the copy.

  • Error when creating BufferedImage with IndexColorModel from a byte array.

    Hi, I have a 1-dimentional byte array and an IndexColorTable, and I can't figure out how to combine the 2 into an BufferedImage without unnecessary copying/reallocating of the image buffer.
    The color model I have is:
    int [] cmap = new int [numColors];
    cmap[i++] = 0xffa0f000;  /etc.
    new IndexColorModel(8, 22, cmap, 0, true,  transparentIndex,  DataBuffer.TYPE_BYTE );Thanks for your help
    -Ben
    Ps.
    I've was looking at some example code (http://javaalmanac.com/egs/java.awt.image/Mandelbrot2.html?l=rel), and can't figure out how to go from the color model they're using to the one I have (the 8 bit one specified above). When I replace the 4bit colormodel in the code below with the 8bit color model specified above, I get the following error:
    [java] java.lang.IllegalArgumentException: Raster ByteInterleavedRaster: width = 5120 height = 3520 #numDataElements 1 dataOff[0] = 0 is incompatible with ColorModel IndexColorModel: #pixelBits = 8 numComponents = 4 color space = java.awt.color.ICC_ColorSpace@c51355 transparency = 2 transIndex = 22 has alpha = true isAlphaPre = false
    [java] at java.awt.image.BufferedImage.<init>(BufferedImage.java:613)
    Code:
    byte[] pixelArray = (byte[]) getData_CHAR();                
    int width = 5120;
    int height = 3520;
    int numbytes = width*height;
    //create DataBuffer using byte buffer of pixel data.
    DataBuffer dataBuffer = new DataBufferByte(pixelArray, numbytes, 0);
    //prepare a sample model that specifies a storage 8-bits of pixel data in an 8-bit data element
    int bitMasks[] = new int[]{0xf};
    SinglePixelPackedSampleModel sampleModel = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, width, height, bitMasks);
    //create a raster using the sample model and data buffer
    WritableRaster writableRaster = Raster.createWritableRaster(sampleModel, dataBuffer, new Point(0,0));
    //generate 16-color model
    byte[] r = new byte[16];
    byte[] g = new byte[16];
    byte[] b = new byte[16];
    r[0] = 0; g[0] = 0; b[0] = 0;
    r[1] = 0; g[1] = 0; b[1] = (byte)192;
    r[2] = 0; g[2] = 0; b[2] = (byte)255;
    r[3] = 0; g[3] = (byte)192; b[3] = 0;
    r[4] = 0; g[4] = (byte)255; b[4] = 0;
    r[5] = 0; g[5] = (byte)192; b[5] = (byte)192;
    r[6] = 0; g[6] = (byte)255; b[6] = (byte)255;
    r[7] = (byte)192; g[7] = 0; b[7] = 0;
    r[8] = (byte)255; g[8] = 0; b[8] = 0;
    r[9] = (byte)192; g[9] = 0; b[9] = (byte)192;
    r[10] = (byte)255; g[10] = 0; b[10] = (byte)255;
    r[11] = (byte)192; g[11] = (byte)192; b[11] = 0;
    r[12] = (byte)255; g[12] = (byte)255; b[12] = 0;
    r[13] = (byte)80; g[13] = (byte)80; b[13] = (byte)80;
    r[14] = (byte)192; g[14] = (byte)192; b[14] = (byte)192;
    r[15] = (byte)255; g[15] = (byte)255; b[15] = (byte)255;
    //create buffered image    
    ColorModel colorModel = new IndexColorModel(4, 16, r, g, b);
    BufferedImage image = new BufferedImage(colorModel, writableRaster, false, null);Message was edited by:
    ben_weisburd
    Message was edited by:
    ben_weisburd

    I had the same problem too.
    anyone found the solution for this problem?
    thanks
    Bruno Rabino
    When I try to make a MD-form, where the base-table for the detail contains a column with a BLOB-datatype. I get following error when I finish creation of the form.
    Error: Exception from wwv_generate_component.build_procedure (WWV-01821)
    Error creating module: ORA-01403: no data found (WWV-16042)
    When I use the table with the BLOB as master or in a form, it works fine.
    Has anyone else experienced this problem? Or knows a way to fix or work around it. Thanks in advance.
    Portal version: 3.0.6.6.5
    null

  • Byte array convert to image works fine for a peiod of time, Then error

    Hi all
    I'm on a program of reading incoming image set which comes as byte arrays through socket and convert them back to images using the method.
    javax.microedition.lcdui.Image.createImage();This works perfect for some time.
    But after 1 minute of running it gives an error
    java.lang.OutOfMemoryError: Java heap space
            at java.awt.image.BufferedImage.getRGB(Unknown Source)
            at com.sun.kvem.midp.GraphicsBridge.loadImage(Unknown Source)
            at com.sun.kvem.midp.GraphicsBridge.createImageFromData(Unknown Source)
            at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at com.sun.kvem.sublime.MethodExecution.process(Unknown Source)
            at com.sun.kvem.sublime.SublimeExecutor.processRequest(Unknown Source)
            at com.sun.kvem.sublime.SublimeExecutor.run(Unknown Source)My J2ME client code
    public class ChangeImage extends Thread
        private SocketConnection sock = null;
        private Image img = null;
        private CanvasKey canvas = null;
        private InputStream in = null;
        public ChangeImage(SocketConnection sock, Canvas canvas) throws IOException
            this.sock = sock;
            this.canvas = (CanvasKey) canvas;
            in = sock.openInputStream();
        public void run()
            super.run();
            short length;
            while (true)
                DataInputStream din = null;
                try
                    din = new DataInputStream(in);
                    length = din.readShort();     // to determine next data packet size
                    byte[] arr = new byte[length];  // next data packet store here
                    din.readFully(arr);  //read image
                    img = Image.createImage(arr, 0, arr.length);
                    canvas.setImage(img);
                    ChangeImage.sleep(50);
                catch (Exception ex)
                    ex.printStackTrace();
    }When I comment following line no error prints.
    img = Image.createImage(arr, 0, arr.length);So the problem is not with socket program.
    What is this problem? Think old image isn't being flushed!!! in the method javax.microedition.lcdui.Image.createImage();Please help me.

    Forgot to Mention i'm using Windows 8.1 - 32 GB Ram - i7-3970x - 2 SSd's in raid 0 for C Drive/ Storage drive is three ( 2 tb HDD in a raid 0 ) / Pictures Folder defaults to the Storage Drive not the Application drive .

  • Save byte array (image) to file with servlet

    Good day.
    I should must to save a png image to file.
    I have a byte array of the image.
    This work is in a servlet.
    How can I do it?
    Best regards.
    Stefano Errani

    Good day.
    I have a byte[] and then I have used
    FileOutputStream fos = new FileOutputStream(getServletContext().getRealPath("/public_html/mcfoto/foto1.png"));
    fos.write(bt, 0, bt.length); // byte[] bt
    fos.close();
    This on my web server that has public_html as root web directory.
    The server is in multi domain.
    In this mode I have an error.
    Then I have tryied to use
    FileOutputStream fos = new FileOutputStream("http://www.stefanoerrani.it/mcfoto/foto1.png");
    and
    FileOutputStream fos = new FileOutputStream(getServletContext().getRealPath("http://www.stefanoerrani.it/mcfoto/foto1.png"));
    In both ways I have obtained an error.
    At last I have tryied in my localhost (local machine) using
    FileOutputStream fos = new FileOutputStream(getServletContext().getRealPath("/mcfoto/foto1.png"));
    All run correclty.
    The Application Server is Tomcat with Apache HTTP Server.
    The first server (of www.stefanoerrani.it) has Linux as OS.
    My local server has Windows as OS.
    I should want, if it's possible, an help.
    Best regards.
    Stefano Errani

  • TimedObject -' TX attribute ' is not working with netbeans 5.0 and SAS 8.0

    Hello,
    I am building a master timer stateless session bean. I have followed the examples from this site as well as I know how, and have even removed all of the system messages and other fluff. I continue to get the following error:
    EJB Timeout method must have an attribute value of TX_REQUIRES_NEW OR TX_NOT_SUPPORTED for ejb
    I have looked through the TimedObject, Timer, and TimerHandle API, all of which seems very simple and does not have any TX field. The example from the site is also very simple, only requiring the declaration of a timer start, which needs a TimerHandle return(although the example does not have it returning a value, I have tried this code both as written and with a class level TimerHandle object returned from the createTimer(...).getHandle() method ), and the declaration of a void ejbTimeout(Timer timer). This method should work with no body in the method since the return is void. I also set my timer intervals to ensure that they were
    I am very confused and feel that this should be very easy. Does anyone know if I am dealing with a configuration error? I know that netbeans does not directly support the use of the ejb TimerService (which seems a little crazy to me, as most non-trivial applications require a timer in some form for periodic events), so are there any deployment descriptors in any of the files which need to be set for this service to work? This error looks to me like a configuration error on some level, or possibly a missing entry in one of the myriad of xml configuration files that are required. The code for my bean is below:
    package QualityPortal;
    import javax.ejb.*;
    * This is the bean class for the MasterSchedulerBean enterprise bean.
    * Created Jul 18, 2006 12:40:18 PM
    * @author ttaylor
    public class MasterSchedulerBean implements SessionBean, MasterSchedulerLocalBusiness, TimedObject
    private SessionContext context;
    private TimerHandle timerHandle = null;
    public void setSessionContext(SessionContext aContext)
    context = aContext;
    * @see javax.ejb.SessionBean#ejbActivate()
    public void ejbActivate()
    * @see javax.ejb.SessionBean#ejbPassivate()
    public void ejbPassivate()
    * @see javax.ejb.SessionBean#ejbRemove()
    public void ejbRemove()
    // </editor-fold>
    * See section 7.10.3 of the EJB 2.0 specification
    * See section 7.11.3 of the EJB 2.1 specification
    public void ejbCreate()
    timerHandle = startTimer();
    public javax.ejb.TimerHandle startTimer()
    TimerService timerService = context.getTimerService();
    Timer timer = timerService.createTimer(30000, "created timer");
    return timer.getHandle();
    public void ejbTimeout(Timer timer)
    //call to another bean here
    WMLReportFactoriesBean wml = new WMLReportFactoriesBean();
    wml.inspectionThroughput();
    }

    Your ejbTimeout() must have a transaction attribute, which resides in the ejb-jar.xml. You'd have to edit your descriptor to contain something like:
    <container-transaction>
    <method>
    <ejb-name>MasterScheduler</ejb-name>
    <method-name>ejbTimeout</method-name>
    </method>
    <trans-attribute>RequiresNew</trans-attribute>
    </container-transaction>
    Or NotSupported.
    Hope it helps.

Maybe you are looking for