Re: jCIFS, Oracle and errors

Michael B Allen <[email protected]> Thu, 18 Apr 2013 19:43:24 -0400
Newsgroups gmane.network.samba.java
Message-ID <CAGMFw4g628H=K3csDeLaMkD_iC26TZEhwCBngjqyxwm1YVN6yQ@mail.gmail.com>
Hi Pawel,

I don't think this has anything to do with jcifs. Jcifs doesn't listen on
1024. In fact I don't think jcifs tries to listen on anything unless you
try to use NetBIOS which you shouldn't be.

You really need a more complete stack trace so that you can see where it's
originating.

Mike
On Apr 9, 2013 10:39 AM, "PaweÅ‚ Matysiak" <[email protected]>
wrote:

> Hi,
>
> I have run into pretty unique problem with jCIFS and I'd welcome any help.
>
> While I would prefer not to go into details what are the underlying
> "business" decisions that put me into this position, I ended in situation
> in which "optimal" solution is as follows:
>
> I need to connect and create (and fill) file on smb:// resource folder
> directly from Oracle database. To do this I created a relatively simple
> java class with public static method:
>
>     public static string createFile(String filename, Clob filecontent,
> String fileOut ) {
>         OutputStream out =null;
>         java.net.URL localURL;
>         InputStream content;
>         SmbFile toFile;
>         SmbFile newFile;
>         byte[] buf = new byte[4096];
>         try {
>             newFile = new SmbFile(fileOut);
>             toFile = new SmbFile( newFile, filename );
>             out = new SmbFileOutputStream(toFile);
>             content = filecontent.getAsciiStream();
>
>             for(int len=-1;(len=content.read(buf))!=-1;){
>                  out.write(buf,0,len);
>             }
>             content.close();
>             out.close();
>         } catch (Exception e) {
>             e.printStackTrace();
>             return e.getMessage();
>         }
>         return filename;
>     }
>
> I then deployed it and loaded into Oracle database (preceded by
> servlet.jar and jcifs.12 jar archive). It loaded. I then created a function
> that was mapped to the above method as well.
>
> Then I tried to make a simple test run. It asked me for more privileges so
> I asked DBA for them and I was granted.
>
> However now I'm stuck with:
>
> the Permission (java.net.SocketPermission localhost:1024- listen,resolve)
> has not been granted to DATABASE_NAME. The PL/SQL to grant this is
> dbms_java.grant_permission( 'MY_USER', 'SYS:java.net.SocketPermission',
> 'localhost:1024-', 'listen,resolve' )
>
> It's worth to note that when I check in USER_JAVA_POLICY I have following
> entries:
>
> SYS java.net.SocketPermission *  *
> SYS java.net.SocketPermission localhost:1024- listen,resolve
>
> at this moment I'm stuck. I have no ideas.
>
> Any suggestion would be appreciated!
>
> regards
> Paweł
>