james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saibabu Vallurupalli <saibabu.vallurupa...@gmail.com>
Subject Re: Fwd: FW: Unable to move emails between folders with Encryption turned - on
Date Thu, 01 Sep 2011 18:32:17 GMT
Hi Norman:

I created the bug: https://issues.apache.org/jira/browse/MAILBOX-129
Also, I thought I found the issue at one place may be similar fix might need
in multiple places.
org.apache.james.mailbox.jpa.mail.JPAMessageMapper.java
copy() method is referring to JPAMessage even we enable JPAEncryptedMessage
though persistence.xml file. So, I modified the code like below:

**************
if (original instanceof JPAStreamingMessage) {
            copy = new JPAStreamingMessage((JPAMailbox) mailbox, uid,
modSeq, original);
        } else if(original instanceof JPAEncryptedMessage) {
            copy = new JPAEncryptedMessage((JPAMailbox) mailbox, uid,
modSeq, original);
        }
        {
            copy = new JPAMessage((JPAMailbox) mailbox, uid, modSeq,
original);
        }
*************

I wanted to test this and ran into another issue due to versions. At present
the Encryption logic is fixed under Trunk and something got modified which
is impacting to use this 4.0-SNAPSHOT version along with James Server
3.0-beta2 version.

Eric is helping me with this today. If this is the only issue then I will
submit the code to you (I will attach the updated Java file to this bug)
like I did before.

Thanks,
Sai


On Thu, Sep 1, 2011 at 2:12 PM, Norman Maurer
<norman.maurer@googlemail.com>wrote:

> Please open a bug report. I will have a look on the weekend.
>
> Thanks,
> Norman
>
>
> 2011/9/1 Saibabu Vallurupalli <saibabu.vallurupalli@gmail.com>:
> > Hi Eric, From the error I am getting I went and saw the code and found
> two
> > lines of comment.
> >
> > **********
> > // We need to reload a "JPA attached" mailbox, because the provide
> mailbox
> > is already "JPA detached"
> >            // If we don't this, we will get an
> > org.apache.openjpa.persistence.ArgumentException.
> >            ((AbstractJPAMessage)
> > message).setMailbox(getEntityManager().find(JPAMailbox.class,
> > mailbox.getMailboxId()));
> >
> >            getEntityManager().persist(message);
> > *********
> >
> > It is exactly failing at find method. And the above commented lines in
> > JPAMessageMapper.save() method says mailbox is already JPA detached and
> we
> > need JPA attached. When it is attaching is there something to do with
> > Encryption code?
> >
> > Thanks, Sai
> >
> >
> > On Thu, Sep 1, 2011 at 8:12 AM, Eric Charles <eric.umg.charles@gmail.com
> >wrote:
> >
> >> Hi Sai,
> >>
> >> I replied 1 hour ago on james mailing list (sometimes it takes time for
> >> mail to arrive) - See answer hereafter.
> >>
> >> If you are in a hurry, my skype id is echarles7 (no guarantee on my
> >> availability, I'm on a business trip in San Jose, CA for now).
> >>
> >>
> >> Answer I sent:
> >>
> >> Hi Sai,
> >>
> >> When you run the tests in the mailbox-jpa module, there are no
> >> persistence.xml, but all the JPA properties are set via code.
> >>
> >> If you look at the 3 classes in http://svn.apache.org/repos/**
> >> asf/james/mailbox/trunk/jpa/**src/test/java/org/apache/**
> >> james/mailbox/jpa/<
> http://svn.apache.org/repos/asf/james/mailbox/trunk/jpa/src/test/java/org/apache/james/mailbox/jpa/>,
> you will see for example
> >>
> >>  properties.put("openjpa.**MetaDataFactory", "jpa(Types=" +
> >>                JPAMailbox.class.getName() + ";" +
> >>                AbstractJPAMessage.class.**getName() + ";" +
> >>                JPAMessage.class.getName() + ";" +
> >>                JPAProperty.class.getName() + ";" +
> >>                JPAUserFlag.class.getName() + ";" +
> >>                JPASubscription.class.getName(**) + ")");
> >>
> >> This is where you have to change to add the JPAEncryptedMessage.
> >>
> >>
> >>
> >> When you run the server as a whole, you need to build the app module.
> >>
> >> In this case, the file to change is
> >> http://svn.apache.org/repos/**asf/james/app/trunk/src/main/**
> >> config/james/META-INF/**persistence.xml<
> http://svn.apache.org/repos/asf/james/app/trunk/src/main/config/james/META-INF/persistence.xml
> >
> >>
> >> You will do 'mvn package', and the generated zip/tar.gz will contain
> that
> >> file.
> >>
> >>
> >> I hope you can make it, even if I am a bit late for you work night.
> >>
> >> Thx.
> >>
> >>
> >>
> >>
> >> On 01/09/11 04:32, Saibabu Vallurupalli wrote:
> >>
> >>> Hi Eric, Sorry trouble you. Do you have any response for me on this
> >>> email below? I have tried various other options around JPAMessage and
> so
> >>> far I have not been successful.
> >>>
> >>> I greatly appreciate your help on this.
> >>>
> >>> Thanks,
> >>> Sai
> >>>
> >>>
> >>> ---------- Forwarded message ----------
> >>> From: *Saibabu Vallurupalli* <saibabu.vallurupalli@gmail.**com<
> saibabu.vallurupalli@gmail.com>
> >>> <mailto:saibabu.vallurupalli@**gmail.com <
> saibabu.vallurupalli@gmail.com>
> >>> >>
> >>> Date: Wed, Aug 31, 2011 at 9:53 PM
> >>> Subject: Re: FW: Unable to move emails between folders with Encryption
> >>> turned - on
> >>> To: James Developers List <server-dev@james.apache.org
> >>> <mailto:server-dev@james.**apache.org <server-dev@james.apache.org>>>
> >>>
> >>>
> >>>
> >>> Hi Eric,
> >>>
> >>> O.k.. I agree with you. But I need little bit more details regarding
> >>> what should I do for the path. Since, I have the environment I can try
> >>> this locally and also deploy in our Test environment and perform quick
> >>> regression testing.
> >>>
> >>> Path:
> >>> JPAMainboxManager.java is using JPAMessage object I need to modify the
> >>> code to use JPAEncryptedMessage and return the same.
> >>>
> >>> I am trying this locally and the tests failed, Now my understanding is
> I
> >>> also need to change persistence.xml file. Since, I am not 100% used to
> >>> the development environment I need to know how Maven uses this file and
> >>> from where this file will be picked?
> >>>
> >>> Can you please give me some insight about the path? I will be working
> >>> tonight to get this patch out. If you could help me I really appreciate
> >>> you. I am in USA EST timezone.
> >>>
> >>> Thanks,
> >>> Sai
> >>>
> >>>
> >>>
> >>> On Wed, Aug 31, 2011 at 7:27 PM, Eric Charles
> >>> <eric.charles@u-mangate.com <mailto:eric.charles@u-**mangate.com<
> eric.charles@u-mangate.com>>>
> >>> wrote:
> >>>
> >>>    Hi Sai,
> >>>
> >>>    If you change JPAMessage to JPAEncryptedMessage in the
> >>>    JPAMessageManager, you must update persistence.xml accordingly.
> >>>
> >>>    However, even if OpenJPAMailboxManager handles the encryption
> >>>    feature to initialize the EncryptionDecryptHelper if needed, the
> >>>    JPAMailboxManager should also verify the feature, and return a
> >>>    JPAEncryptedMessage if needed.
> >>>
> >>>    I hope this makes sense, and if yes, a patch is needed.
> >>>
> >>>    wdyt?
> >>>
> >>>
> >>>    On 31/08/11 15:19, Saibabu Vallurupalli wrote:
> >>>
> >>>        Hi Eric/Norman:
> >>>
> >>>        I am able to reproduce this error in a simple way. In my
> >>>        checked-out version
> >>>        -
> >>>        C:\work\workspace\james\__**mailbox\trunk\jpa\src\main\__**
> >>> java\org\apache\james\mailbox\**__jpa\JPAMessageManager.java
> >>>        There is reference to JPAMessage.java class and I changed it to
> >>>        JPAEncryptedMessage.java ran the maven clean package and the
> >>>        tests failed
> >>>        with the similar exception:
> >>>
> >>>        Thought of letting you. Thank you very much in advance.
> >>>
> >>>        Thanks, Sai
> >>>
> >>>
> >>>
> >>>
> >>>            ______________________________**_________________
> >>>            *From:* Valluripalli, Sai
> >>>            *Sent:* Wednesday, August 31, 2011 2:42 PM
> >>>            *To:* 'server-dev@james.apache.org
> >>>            <mailto:server-dev@james.**apache.org<
> server-dev@james.apache.org>
> >>> >'
> >>>
> >>>            *Subject:* Unable to move emails between folders with
> >>>            Encryption turned -
> >>>            on
> >>>
> >>>
> >>>            Hi Norman/Eric,
> >>>
> >>>            We were in our System Testing phase and close to our
> >>>            release. During our
> >>>            System Testing we discovered that Move  option is not
> >>>            working between the
> >>>            folders. When we try to move email from Inbox to Trash we
> >>>            encounter the
> >>>            exception below. I have also got the complete log if you
> >>>            need. But the root
> >>>            cause I understood from the below exception is somewhere in
> >>>            the mail/store
> >>>            code and other places JPAMessage class is referenced and
> >>>            when I changed it
> >>>            to JPAEncryptedMessage it is unable to locate JPAMessage and
> >>>            throwing the
> >>>            exception.
> >>>
> >>>            Is there any master configuration to modify or do I need to
> >>>            refer
> >>>            JPAEncryptedMessage.java class to any other modules and
> >>>            re-compile it?
> >>>            Please advise.
> >>>
> >>>            Caused by:<openjpa-2.1.0-r422266:__**1071316 fatal user
> error>
> >>>            org.apache.openjpa.__**persistence.ArgumentException: No
> >>>            metadata was found for
> >>>            type "class
> >>>            org.apache.james.mailbox.jpa._**_mail.model.openjpa.**
> >>> JPAMessage"__.
> >>>            The
> >>>            class does not appear in the list of persistent types:
> >>>            [org.apache.james.mailbox.jpa.**__mail.model.JPAUserFlag,
> >>>            org.apache.james.mailbox.jpa._**_mail.model.JPAMailbox,
> >>>            org.apache.james.mailbox.jpa._**_mail.model.openjpa.__**
> >>> JPAEncryptedMessage,
> >>>            org.apache.james.domainlist.__**jpa.model.JPADomain,
> >>>            org.apache.james.mailbox.jpa._**_mail.model.openjpa.__**
> >>> AbstractJPAMessage,
> >>>            org.apache.james.user.jpa.__**model.JPAUser,
> >>>            org.apache.james.mailbox.jpa._**_mail.model.JPAProperty,
> >>>            org.apache.james.rrt.jpa.__**model.JPARecipientRewrite,
> >>>
>  org.apache.james.mailbox.jpa._**_user.model.JPASubscription].
> >>>                     at
> >>>            org.apache.openjpa.meta.__**MetaDataRepository.__**
> >>> getMetaDataInternal(__**MetaDataRepository.java:407)
> >>>                     at
> >>>            org.apache.openjpa.meta.__**MetaDataRepository.__**
> >>> getMetaData(__**MetaDataRepository.java:384)
> >>>                     at
> >>>
>  org.apache.openjpa.kernel.__**BrokerImpl.persistInternal(__**
> >>> BrokerImpl.java:2601)
> >>>                     at
> >>>
>  org.apache.openjpa.kernel.__**BrokerImpl.persist(BrokerImpl.**
> >>> __java:2540)
> >>>                     at
> >>>
>  org.apache.openjpa.kernel.__**BrokerImpl.persist(BrokerImpl.**
> >>> __java:2437)
> >>>                     at
> >>>            org.apache.openjpa.kernel.__**DelegatingBroker.persist(__**
> >>> DelegatingBroker.java:1069)
> >>>                     at
> >>>            org.apache.openjpa.__**persistence.EntityManagerImpl.**
> >>> __persist(EntityManagerImpl.__**java:707)
> >>>                     at
> >>>            sun.reflect.__**NativeMethodAccessorImpl.__**invoke0(Native
> >>> Method)
> >>>                     at
> >>>            sun.reflect.__**NativeMethodAccessorImpl.__**invoke(__**
> >>> NativeMethodAccessorImpl.java:**__39)
> >>>                     at
> >>>            sun.reflect.__**DelegatingMethodAccessorImpl._**_invoke(__**
> >>> DelegatingMethodAccessorImpl._**_java:25)
> >>>                     at java.lang.reflect.Method.__**
> >>> invoke(Method.java:597)
> >>>                     at
> >>>
>  org.springframework.orm.jpa.__**ExtendedEntityManagerCreator$_
> >>> **_**ExtendedEntityManagerInvocatio**__nHandler.invoke(__**
> >>> ExtendedEntityManagerCreator._**_java:365)
> >>>
> >>>                     at $Proxy56.persist(Unknown Source)
> >>>                     at
> >>>
>  org.apache.james.mailbox.jpa._**_mail.JPAMessageMapper.save(__
> >>> **JPAMessageMapper.java:362)
> >>>                     ... 100 more
> >>>            DEBUG 12:55:29,285 | james.imapserver | ID=1684154803 Error
> >>>            while
> >>>            processing imap request
> >>>
> >>>
> >>>            We appreciate your help on this.
> >>>
> >>>            Thank you, Sai.
> >>>
> >>>
> >>>
> >>>
> >>>    --
> >>>    Eric
> >>>    http://about.echarles.net
> >>>
> >>>    --
> >>>    Eric
> >>>    http://about.echarles.net
> >>>
> >>>    ------------------------------**__----------------------------**
> >>> --__---------
> >>>    To unsubscribe, e-mail: server-dev-unsubscribe@james._**_apache.org
> >>>    <mailto:server-dev-**unsubscribe@james.apache.org<
> server-dev-unsubscribe@james.apache.org>
> >>> >
> >>>
> >>>    For additional commands, e-mail: server-dev-help@james.apache.
> _**_org
> >>>    <mailto:server-dev-help@james.**apache.org<
> server-dev-help@james.apache.org>
> >>> >
> >>>
> >>>
> >>>
> >>>
> >> --
> >> Eric
> >> http://about.echarles.net
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message