How can a MDB access filesystem?

Hi,everyone. Should you help me resolve this problem?
<b>--How can a MDB access filesystem?</b>
SOURCE CODE:
public void onMessage(javax.jms.Message aMessage) {
try{
FileOutputStream fos = new FileOutputStream(new File("D:\\Temp\\a.nok"));
fos.write("testing".getBytes() );
fos.flush();
fos.close();
}catch(Exception e){
e.printStackTrace();
RESPONSE:
java.security.AccessControlException: access denied (java.io.FilePermission D:\Temp\a.nok write)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
at java.security.AccessController.checkPermission(AccessController.java:401)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
at java.lang.SecurityManager.checkWrite(SecurityManager.java:975)
at java.io.FileOutputStream.<init>(FileOutputStream.java:169)
at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
at neu.mid.mag.mlm.MsgMonitorBean.onMessage(MsgMonitorBean.java:51)
at com.sun.ejb.containers.MessageBeanContainer.onMessage(MessageBeanContainer.java:653)
at com.sun.ejb.containers.MessageBeanListenerConcurrent.onMessage(MessageBeanListenerConcurrent.java:20)
at com.sun.jms.client.SessionImpl.onSessionMessageListener(SessionImpl.java:981)
at com.sun.jms.client.SessionImpl.deliverMessage(SessionImpl.java:1072)
at com.sun.jms.client.JMSClientImpl.sendMessage(JMSClientImpl.java:149)
at org.omg.stub.com.sun.jms.client._JMSClientImpl_Tie._invoke(Unknown Source)
at com.sun.corba.ee.internal.corba.ServerDelegate.dispatch(ServerDelegate.java:350)
at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:250)
at com.sun.corba.ee.internal.iiop.LocalClientRequestImpl.invoke(LocalClientRequestImpl.java:96)
at com.sun.corba.ee.internal.corba.ClientDelegate.invoke(ClientDelegate.java:227)
at com.sun.corba.ee.internal.corba.ClientDelegate.invoke(ClientDelegate.java:269)
at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:457)
at org.omg.stub.com.sun.jms._JMSClient_Stub.sendMessage(Unknown Source)
at com.sun.jms.service.ConnectionImpl.sendMessage(ConnectionImpl.java:475)
at com.sun.jms.service.SessionImpl.processOutgoingMessages(SessionImpl.java:1295)
at com.sun.jms.service.SessionImpl.access$000(SessionImpl.java:45)
at com.sun.jms.service.SessionImpl$1.activityDetected(SessionImpl.java:1014)
at com.sun.jms.util.WorkerThread.run(WorkerThread.java:87)

Hi,
Hi,everyone. Should you help me resolve this problem?
<b>--How can a MDB access filesystem?</b>
SOURCE CODE:
public void onMessage(javax.jms.Message aMessage)
ge) {
try{
FileOutputStream fos = new
m fos = new FileOutputStream(new
File("D:\\Temp\\a.nok"));
fos.write("testing".getBytes() );
fos.flush();
fos.close();
}catch(Exception e){
e.printStackTrace();
This is fine .......
RESPONSE:
java.security.AccessControlException: access denied
(java.io.FilePermission D:\Temp\a.nok write)
at
at
at
t
java.security.AccessControlContext.checkPermission(Acce
sControlContext.java:270)
at
at
at
t
java.security.AccessController.checkPermission(AccessCo
troller.java:401)
at
at
at
t
java.lang.SecurityManager.checkPermission(SecurityManag
r.java:542)
at
at
at
t
java.lang.SecurityManager.checkWrite(SecurityManager.ja
a:975)
at
at
at
t
java.io.FileOutputStream.<init>(FileOutputStream.java:1
9)
at
at
at
t
java.io.FileOutputStream.<init>(FileOutputStream.java:1
1)
at
at
at
t
neu.mid.mag.mlm.MsgMonitorBean.onMessage(MsgMonitorBean
java:51)
at
at
at
t
com.sun.ejb.containers.MessageBeanContainer.onMessage(M
ssageBeanContainer.java:653)
at
at
at
t
com.sun.ejb.containers.MessageBeanListenerConcurrent.on
essage(MessageBeanListenerConcurrent.java:20)
at
at
at
t
com.sun.jms.client.SessionImpl.onSessionMessageListener
SessionImpl.java:981)
at
at
at
t
com.sun.jms.client.SessionImpl.deliverMessage(SessionIm
l.java:1072)
at
at
at
t
com.sun.jms.client.JMSClientImpl.sendMessage(JMSClientI
pl.java:149)
at
at
at
t
org.omg.stub.com.sun.jms.client._JMSClientImpl_Tie._inv
ke(Unknown Source)
at
at
at
t
com.sun.corba.ee.internal.corba.ServerDelegate.dispatch
ServerDelegate.java:350)
at
at
at
t
com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:250
at
at
at
t
com.sun.corba.ee.internal.iiop.LocalClientRequestImpl.i
voke(LocalClientRequestImpl.java:96)
at
at
at
t
com.sun.corba.ee.internal.corba.ClientDelegate.invoke(C
ientDelegate.java:227)
at
at
at
t
com.sun.corba.ee.internal.corba.ClientDelegate.invoke(C
ientDelegate.java:269)
at
at
at
t
org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.ja
a:457)
at
at
at
t
org.omg.stub.com.sun.jms._JMSClient_Stub.sendMessage(Un
nown Source)
at
at
at
t
com.sun.jms.service.ConnectionImpl.sendMessage(Connecti
nImpl.java:475)
at
at
at
t
com.sun.jms.service.SessionImpl.processOutgoingMessages
SessionImpl.java:1295)
at
at
at
t
com.sun.jms.service.SessionImpl.access$000(SessionImpl.
ava:45)
at
at
at
t
com.sun.jms.service.SessionImpl$1.activityDetected(Sess
onImpl.java:1014)
at
at
at
t
com.sun.jms.util.WorkerThread.run(WorkerThread.java:87)
First of all in the specificaitons it is recommended not to use the i/o with ejb.So you should avoid doing same.
Now the exception you are getting is due to the SecurityManager at the server side JVM.In order to make it run you have to modify the java.policy file present with in the JAVA_HOME/jre/lib/security.
With in this file you add the following entry
permission java.io.FilePermission "D:\\Temp\\a.nok", "read,write";
For more details you should refer to the concept of the Security Manager which is not loaded by default in java app but in applets and in server side applications it is made for security purposes.
Regards
Vicky

Similar Messages

  • How can I regain access to a MAC account? -- Macbook Pro?

    Situation:  My wife has a 13" Mac Book Pro, that we received in May 2011.
    OS: Mac OS X Snow Leopard (not sure which version it came with -- 10.6?)
    My wife's computer had two administrative accounts.  She uses one regularly, and the other is the 'primary' account for downloading updates and such.
    She was unable to figure out how to use Time Machine or any of the other backup software and the like.
    Yesterday, she updated to OS X Lion, and found that a number of the programs that she enjoys using no longer function.
    She wanted to roll-back to Snow Leopard.  After transferring the majority of the 'must-save' files, she put in the install disk again for snow leopard.  This allowed her to start fresh, however, she wants to regain access to those old accounts.  She tried, but, none of the passwords work anymore.  We know what the passwords are; but, they are not working.
    Our ATTEMPTED solution:  She found a site "http://en.kioskea.net/forum/affich-7339…  This site told her to do something in the boot terminal that allowed her to add a new administrative account.
    She tried going into that new admin account and changing the passwords to the other accounts; no joy.  She changes them, but, they are not retained when she logs off or restarts.
    How can she regain access to her old files?

    Open itunes.  Sign into your account.

  • How can I restrict access to add. internal hard drive by account?

    Hello! Okay, so I am my computer's administrator, and I have a secondary 'guest' account that anyone else can use. So, I know that all my data on my main, OS hard drive is secure from the guest account accessing it, but what about the additional hard drive that I have installed?
    I have a good deal of sensitive data and files stored (and aliased) on my second internal drive that I do not care for 'guest' users to stumble upon. How can I restrict access to the secondary storage hard drive from my Guest login account, and/or just plain hide it from it? Surely, there is a need for this that has brought about a solution. Any tips/advice/solutions?
    Thanks!!!
    =)

    Click here and follow the instructions followed by placing the folders and files on the image; if the password is in the keychain, it will be supplied whenever you're logged in.
    (41018)

  • My old computer had itunes and downloaded songs that I put on my ipod. My old computer got replaced years ago without saving hard drive info or passwords and my iPod burnt out and will not activate. How can I get access to my old songs on new computer.

    My old computer had itunes and downloaded songs that I put on my ipod. Well, my old computer got replaced years ago without saving hard drive info or passwords and my iPod burnt out years ago and will not activate. I now have a new computer and iPod and I have an iTunes account on my iPhone5. How can I get access to my old songs on new computer? Are they lost for good? I have no info about my old computer and old account.

    Downloading past purchases from the App Store ... - Support - Apple

  • If I own Adobe Photoshop Elements 12 and have it installed on my computer, how can I get access to Adobe Bridge without a monthly subscription?  Is there a way to use Adobe Photoshop and Bridge without paying a monthly fee?

    If I own Adobe Photoshop Elements 12 and have it installed on my computer, how can I get access to Adobe Bridge without a monthly subscription?  Is there a way to use Adobe Photoshop and Bridge without paying a monthly fee?

    Hi Jaclyn2,
    Please follow the steps mentioned in the kb: http://helpx.adobe.com/creative-suite/kb/error-update-server-repsonding-cs4.html .
    Regards,
    Romit Sinha

  • HT204266 I live in China, have Dutch nationality, and no US address or Credit Card; how can I have access to products from the US iTunes store, in particular music, when such items are not available from the China iTunes store? In general, what are the di

    I live in China, have Dutch nationality, and no US address or Credit Card; how can I have access to products from the US iTunes store, in particular music, when such items are not available from the China iTunes store? In general, what are the differences between countries' iTunes offerings? Does one really need an address and a credit card for any country to be able to access that countries iTunes store? Why these restrictions?

    You cannot.
    You cannot use another countrys itunes store.
    You must be physically locates inside the borders of a country to use that countrys itunes store and a credit card issued in that country with a valid billing address in that country.
    The owners of the distribution rights of movies/music/etc differ by country.  These distributors decide who can sell their content in that country.
    Buy from another source if your countrys itunes store does not carry somehting that you want.

  • How can my laptop access the downloaded files like mp3 and pdf documents which are in my iphone 4G?

    how can my laptop access the downloaded files like mp3 and pdf documents which are in my iphone?

    Yes you will need to NAT at some point to go from private to public address space. Here is a basic configuration if you are interested:
    interface F8
    ip nat inside
    interface G0
    ip nat outside
    ip access-list standard NAT
     permit 192.168.11.0 0.0.0.255
    ip nat inside source list NAT interface G0 overload

  • How can I get access back to sounds and lessons I have not downloaded before updating?

    When I purchased my Mac about two months ago, I had access to all of the lessons and sounds, I just had to download them.  I recently downloaded and installed the update and in doing so I lost access to sounds and lessons I had not downloaded.  It tells me that I need to purchase the sounds and lessons package.  How can I get access back since I have already purchased it?

    Apple does not support downgrading the iOS.
    Yes, iOS 7 looks quite different. But there are many new and valuable features. As time goes on you will not remember how it used to look.

  • How can i get access code to create ABAP Program ?

    hi guys ,
    How can i get access code for creating ABAP Program in my System.
    I am using SAP IDES 4.6 Version
    Please Help me out .
    Regards
    Raghu

    Hi Raghu,
    - license your system (http://service.sap.com/licensekey)
    - create a developer key (http://service.sap.com/sscr)
    - create a key for your ABAP program (httP://service.sap.com/sscr)
    Markus

  • How can I give access to a new user for WebView Reporting Log In //IPCC Enterprise

    Hi All,
    How can I give access to a new user for the WebView Reporting Log In ?
    I have IPCC Enterpise 7
    Thanks
    Andres

    Two options: 1. In configuration manager on the AW, use the user list tool to add the users domain account and select Webview access permissions. 2. Using standard Microsoft Active Directory tools or the Cisco Domain Manager tool, add the desired AD user account into one of the "WebView" security groups created within the Cisco OU.

  • My access was blocked because i left my pc on at home and now i cannot access anymore with thunderbird only via browser how can i restore access??

    I cannot access anymore via thunderbird while with the same pw i can access via browser after my account was blocked how can i restore access via email program?

    I was on my gmail account and looked at settings forward and pop/imap
    be sure they are activated.
    Imap if you want to access it from several places. That way you have the original on Gmail-server and copies on your pc.
    Pop on the other hand loads down the emails. perfect if its just one pc.
    (i'm not sure the Gmail-server deletes them thou).

  • How can my wife access all of our itunes music if she signs up for iTunes match, but her apple id is different than mine?

    How can my wife access all of our iTunes music, even if she subscribes to iTunes Match, if her Apple ID is different than mine?

    I do subscribe to iTunes Match.....and the music i am referring to is all of our downloaded albums and songs that are currently in iTunes and in the "cloud" on my iPhone and my iPad.
    So if she uses my Apple ID for her iPhone, she can sign up for iTunes Match on my account?  Will any of my apps then transfer to her phone?  Or just the iTunes "data"?

  • C Programming: How can we get the filesystem name for a given file-path?

    C Programming: How can we get the filesystem name for a given file-path?
    Say I have a filepath=/mnt1/file1
    Using some OS API like stat, can I get the Filesystem /mnt ?
    Thanks in advance,
    -V

    Enter the command up to the point of entering the file path and add a space, then drag the file into the terminal window. It will fill out the path.
    If you need to go further into the contents of the Application package, you can continue with /Contents...
    Another way is to start typing and then hit Tab to auto-complete. It will stop where it can't determine the next letter.
    So, type /App tab and it will fill in /Applications. Type a / and start with the name of the app, then tab and it should complete. Continue till you have the correct path.
    Spaces will be replaced with \<space>, so, App Store would end up as /Applications/App\ Store.app

  • How can I enable access to my photos if it's not on the privacy settings?

    How can I enable access to my photos if it's not on the privacy settings?

    Not sure what you are asking. If you want to make your photos available for others to access, the following is one option: https://www.apple.com/icloud/icloud-photo-sharing.html

  • How can we provide access/provide permissions to a user/group for group of folders at single step??

    Hi Nico, Thaks you so much for your reply,, Can you please advice or give me some steps to write script pelase? Regards,Kareem

    Hi All, How can we provide access/provide permissions to a user/group for group of folders  at single step?? I can able to provide access for a single folder at a time. I want provide access to a list of  folders( more than 30 ..) at single step?? Regards,Kareem

Maybe you are looking for