jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From polofan123 <polo...@web.de>
Subject Re: pathNotFoundException altough session is saved
Date Wed, 16 Jan 2013 20:00:57 GMT
yes I read the wiki about PMs and there it says the *Fs PM is very fast with
Datastore so I chose it. Can you give some explanation why not to use it ?
Is it the point "If the JVM process is killed the repository might turn
inconsistent" ?

Now to my actual problem... relevant Code frames are : 

_________________________________________________________________________

Source code within MDB :

    public void createFile(){
        try{            
                  ...create File here

                    FileInputStream fin = new FileInputStream(file);
                    EJB1.persistMeta(fin, nodeID, fileName);
        } finally {
            jobFinishedSource.fire(new JobFinishedEvent(nodeID,fileID));
        }

___________________________________________________________________________

Source code within EJB1 

    public String persistFile(InputStream in, String nodeID, String
fileName) {
        Session session = this.createSession(true);
        try {
            ValueFactory vf = session.getValueFactory();
            Binary bfile = vf.createBinary(in);
            Node datasetNode = session.getNode(nodeID);
            Property metaProp = datasetNode.setProperty(fileName, bfile);

            session.save();

        } catch (RepositoryException ex) {
           
Logger.getLogger(RepositoryBean.class.getName()).log(Level.SEVERE, null,
ex);
        } finally {
            eventSource.fire(new UpdateEvent(session));
        }
    }

    public Session createSession(boolean writeable) {
        Session session = null;
        try {
            if (writeable) {
                session = repository.login(new
SimpleCredentials(UUID.randomUUID().toString(), "".toCharArray()), null);
            } else {
                session = repository.login();
            }
        } catch (LoginException ex) {
           
Logger.getLogger(RepositoryBean.class.getName()).log(Level.SEVERE, null,
ex);
        } catch (NoSuchWorkspaceException ex) {
           
Logger.getLogger(RepositoryBean.class.getName()).log(Level.SEVERE, null,
ex);
        } catch (RepositoryException ex) {
           
Logger.getLogger(RepositoryBean.class.getName()).log(Level.SEVERE, null,
ex);
        }
        return session;
    }

_______________________________________________________________________

Source code within EJB2 :

    public void obtainFIle(@Observes JobFinishedEvent event) {
                   Session session = EJB1.createSession(false);
                   session.getProperty(nodeID + File.separator + "fileID")
                   ...do some non-jcr stuff here...
                   session.logout();
    }

________________________________________________________________________

One might think I forget to logout of the session in my EJB1.persistmeta but
I put the session into a cdi event. The event is observed by another EJB
(lets call it viewEJB) of which I didn't paste the code but it does nothing
more than update my view and then logout of the session. Normally I wouldn't
put the session into the event but let the viewEJB create its own session
but and thats the same problem I think, when I create my own session in the
viewEJB and try to obtain the changes made they are not visible...



--
View this message in context: http://jackrabbit.510166.n4.nabble.com/pathNotFoundException-altough-session-is-saved-tp4657350p4657352.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Mime
View raw message