JESpace errors

瀏覽次數:133 次
跳到第一則未讀訊息

Juande Santa

未讀,
2013年10月16日 上午10:09:462013/10/16
收件者:jpos-...@googlegroups.com
Hi

I am testing JESpace in my current jPos project, so I have configured my ChannleAdaptor and my MUX to work with JESpace:

<space>je:myspace:/home/jpos/spaces/myspace</space>

I am got an error at starting:

     [java] <log realm="foo.bar.jpos.redsys.MyChannelAdaptor" at="Wed Oct 16 15:43:25 CEST 2013.517">
     [java]   <debug>
     [java]     initializing Channel
     [java]   </debug>
     [java] </log>
     [java] Exception in thread "channel-receiver-bank-receive" org.jpos.space.SpaceError: java.io.NotSerializableException: java.lang.Object
     [java] at org.jpos.space.JESpace$Ref.serialize(JESpace.java:504)
     [java] at org.jpos.space.JESpace$Ref.<init>(JESpace.java:459)
     [java] at org.jpos.space.JESpace.out(JESpace.java:101)
     [java] at foo.bar.jpos.redsys.MyChannelAdaptor$Receiver.run(MyChannelAdaptor.java:443)
     [java] at java.lang.Thread.run(Thread.java:662)
     [java] Caused by: java.io.NotSerializableException: java.lang.Object
     [java] at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
     [java] at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
     [java] at org.jpos.space.JESpace$Ref.serialize(JESpace.java:501)
     [java] ... 4 more
     [java] <log realm="foo.bar.jpos.redsys.MyChannelAdaptor" at="Wed Oct 16 15:43:25 CEST 2013.590">
     [java]   <debug>
     [java]     is channel connected?: false
     [java]   </debug>
     [java] </log>
     [java] <log realm="foo.bar.jpos.redsys.MyChannelAdaptor" at="Wed Oct 16 15:43:25 CEST 2013.592">
     [java]   <debug>
     [java]     checking connection
     [java]   </debug>
     [java] </log>
     [java] <log realm="my-adapter-channel" at="Wed Oct 16 15:43:25 CEST 2013.606" lifespan="1ms">
     [java]   <receive>
     [java]     <iso-exception>
     [java]       unconnected ISOChannel
     [java]       org.jpos.iso.ISOException: unconnected ISOChannel
     [java] at org.jpos.iso.BaseChannel.receive(BaseChannel.java:662)
     [java] at foo.bar.jpos.redsys.MyChannelAdaptor$Receiver.run(MyChannelAdaptor.java:432)
     [java] at java.lang.Thread.run(Thread.java:662)
     [java]     </iso-exception>
     [java]   </receive>
     [java] </log>
     [java] <log realm="foo.bar.jpos.redsys.MyChannelAdaptor" at="Wed Oct 16 15:43:25 CEST 2013.608">
     [java]   <warn>
     [java]     channel-receiver-bank-receive
     [java]     <iso-exception>
     [java]       unconnected ISOChannel
     [java]       org.jpos.iso.ISOException: unconnected ISOChannel
     [java] at org.jpos.iso.BaseChannel.receive(BaseChannel.java:662)
     [java] at foo.bar.jpos.redsys.MyChannelAdaptor$Receiver.run(MyChannelAdaptor.java:432)
     [java] at java.lang.Thread.run(Thread.java:662)
     [java]     </iso-exception>
     [java]   </warn>
     [java] </log>
     [java] <log realm="foo.bar.jpos.redsys.MyChannelAdaptor" at="Wed Oct 16 15:43:25 CEST 2013.618">
     [java]   <debug>
     [java]     channel not connected. connecting channel....
     [java]   </debug>
     [java] </log>

The error is pointing to MyChannelAdaptor.java:432: (red line)

public class Receiver implements Runnable {

        public Receiver() {

            super();
        }

        public void run() {

            Thread.currentThread().setName("channel-receiver-" + out);
            while (running()) {
                try {
                    Object r = sp.rd(ready, 5000L);
                    if (r == null)
                        continue;
                    ISOMsg m = channel.receive();
                    rx++;
                    lastTxn = System.currentTimeMillis();
                    if (timeout > 0)
                        sp.out(out, m, timeout);
                    else
                        sp.out(out, m);
                } catch (ISOException e) {
                    if (running()) {
                        getLog().warn("channel-receiver-" + out, e);
                        if (!ignoreISOExceptions) {
                            sp.out(reconnect, new Object(), delay);
                            disconnect();
                            sp.out(in, new Object()); // wake-up Sender
                        }
                        ISOUtil.sleep(1000);
                    }
                } catch (SocketTimeoutException e) {
                    if (running()) {
                        getLog().warn("channel-receiver-" + out, "Read timeout");
                        sp.out(reconnect, new Object(), delay);
                        disconnect();
                        sp.out(in, new Object()); // wake-up Sender
                        ISOUtil.sleep(1000);
                    }
                } catch (Exception e) {
                    if (running()) {
                        getLog().warn("channel-receiver-" + out, e);
                        sp.out(reconnect, new Object(), delay);
                        disconnect();
                        sp.out(in, new Object()); // wake-up Sender
                        ISOUtil.sleep(1000);
                    }
                }
            }
        }
    }

So, it looks like the code is not working with a JESpace. Am I misunderstanding something?

On the other hand, I also tried to start a second instance of jPos pointing to the same JESpace. The idea is to have two instances of jPos (active-active) and don't care where the petition come from. This is the error I see in the second instance at starting:

     [java] <log realm="foo.bar.jpos.redsys.MyChannelAdaptor" at="Wed Oct 16 15:44:11 CEST 2013.886">
     [java]   <warn>
     [java]     init
     [java]     <exception name="com.sleepycat.je.EnvironmentLockedException: (JE 4.1.10) /home/nnp_jpos/jpos/spaces/myspace The environment cannot be locked for single writer access. ENV_LOCKED: The je.lck file could not be locked. Environment is invalid and must be closed.">
     [java]     org.jpos.space.SpaceError: com.sleepycat.je.EnvironmentLockedException: (JE 4.1.10) /home/nnp_jpos/jpos/spaces/myspace The environment cannot be locked for single writer access. ENV_LOCKED: The je.lck file could not be locked. Environment is invalid and must be closed.
     [java] at org.jpos.space.JESpace.<init>(JESpace.java:90)
     [java] at org.jpos.space.JESpace.getSpace(JESpace.java:302)
     [java] at org.jpos.space.SpaceFactory.createSpace(SpaceFactory.java:143)
     [java] at org.jpos.space.SpaceFactory.getSpace(SpaceFactory.java:119)
     [java] at org.jpos.space.SpaceFactory.getSpace(SpaceFactory.java:107)
     [java] at foo.bar.jpos.redsys.MyChannelAdaptor.grabSpace(MyChannelAdaptor.java:629)
     [java] at foo.bar.jpos.redsys.MyChannelAdaptor.initSpaceAndQueues(MyChannelAdaptor.java:338)
     [java] at foo.bar.jpos.redsys.MyChannelAdaptor.initService(MyChannelAdaptor.java:99)
     [java] at org.jpos.q2.QBeanSupport.init(QBeanSupport.java:99)
     [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [java] at java.lang.reflect.Method.invoke(Method.java:597)
     [java] at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:93)
     [java] at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:27)
     [java] at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:208)
     [java] at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:120)
     [java] at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:264)
     [java] at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
     [java] at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:762)
     [java] at org.jpos.q2.QFactory.createQBean(QFactory.java:114)
     [java] at org.jpos.q2.Q2.deploy(Q2.java:447)
     [java] at org.jpos.q2.Q2.deploy(Q2.java:264)
     [java] at org.jpos.q2.Q2.run(Q2.java:168)
     [java] at java.lang.Thread.run(Thread.java:662)
     [java] Caused by: com.sleepycat.je.EnvironmentLockedException: (JE 4.1.10) /home/nnp_jpos/jpos/spaces/myspace The environment cannot be locked for single writer access. ENV_LOCKED: The je.lck file could not be locked. Environment is invalid and must be closed.
     [java] at com.sleepycat.je.log.FileManager.<init>(FileManager.java:350)
     [java] at com.sleepycat.je.dbi.EnvironmentImpl.<init>(EnvironmentImpl.java:439)
     [java] at com.sleepycat.je.dbi.EnvironmentImpl.<init>(EnvironmentImpl.java:340)
     [java] at com.sleepycat.je.dbi.DbEnvPool.getEnvironment(DbEnvPool.java:207)
     [java] at com.sleepycat.je.Environment.makeEnvironmentImpl(Environment.java:229)
     [java] at com.sleepycat.je.Environment.<init>(Environment.java:211)
     [java] at com.sleepycat.je.Environment.<init>(Environment.java:165)
     [java] at org.jpos.space.JESpace.<init>(JESpace.java:82)
     [java] ... 24 more
     [java]     </exception>
     [java]   </warn>
     [java] </log>

Again, Am I misunderstanding something?

This is my scenario:

Cliente -> my application <-> jPos <-> bank

Communication can be initiated in both jPos or bank but if a initiated a communication from jpos to bank, back can response to any jpos instance (that is why I want to use JESpace).

Thanks in advance,

Juande

Alejandro Revilla

未讀,
2013年10月16日 上午10:16:522013/10/16
收件者:jPOS Users
You can't put non serializable objects in a persistent space.


Juande Santa

未讀,
2013年10月16日 上午10:29:182013/10/16
收件者:jpos-...@googlegroups.com
Hi Alejando

I see the limitation, but I was wondering why ChannelAdator is not prepare for working with JESpace. I will change it and use a serializable object instead and test it.

Any clue about the JESpace sharing between two instances?

Thansk very much.

Alejandro Revilla

未讀,
2013年10月16日 下午1:01:452013/10/16
收件者:jPOS Users
On a second read to your original email, I see the read-lined part and it's obviously something we can change in the ChannelAdaptor. It's an easy fix, we can use any serializable object like Boolean.TRUE.

I've added https://jpos.org/issues/issue/jPOS-106 in case you want to track it and will fix it shortly.

Sorry for the initial express read, thought you were trying to push the channel adaptor to the space.

--
@apr



--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
 
Join us in IRC at http://webchat.freenode.net/?channels=jpos
 
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/a1d6ebfb-3f6e-41bd-91f2-8be1bc163994%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

Mark Salter

未讀,
2013年10月17日 凌晨2:27:332013/10/17
收件者:jpos-...@googlegroups.com
On 16/10/2013 15:09, Juande Santa wrote:
> On the other hand, I also tried to start a second instance of jPos
> pointing to the same JESpace. The idea is to have two instances of jPos
> (active-active) and don't care where the petition come from. This is the
> error I see in the second instance at starting:
>
> [java] <log realm="foo.bar.jpos.redsys.MyChannelAdaptor" at="Wed
> Oct 16 15:44:11 CEST 2013.886">
> [java] <warn>
> [java] init
> [java] <exception
> name="com.sleepycat.je.EnvironmentLockedException: (JE 4.1.10)
> /home/nnp_jpos/jpos/spaces/myspace The environment cannot be locked for
> single writer access. ENV_LOCKED: The je.lck file could not be locked.
> Environment is invalid and must be closed.">
[snip]
>
> Again, Am I misunderstanding something?
No, I just think you are trying to use a single space but the code and
config is trying to initialise two and clashing.

>
> This is my scenario:
>
> Client -> my application <-> jPos <-> bank
>
> Communication can be initiated in both jPos or bank but if a initiated a
> communication from jpos to bank, back can response to any jpos instance
> (that is why I want to use JESpace).
Can you try and use any other space implementor for now, I wonder if
the jespace setup needs to try and detect an existing space of the same
name to allow the 'next' reference to reuse.


--
Mark

Mark Salter

未讀,
2013年10月18日 上午10:36:362013/10/18
收件者:jpos-...@googlegroups.com


On Thursday, October 17, 2013 7:27:33 AM UTC+1, Mark Salter wrote:

Can you try and use any other space implementor for now,  I wonder if
the jespace setup needs to try and detect an existing space of the same
name to allow the 'next' reference to reuse.
Detection is made for an existing jespace, so I now think it is the sharing of the database between two users that needs attention - I couldn't seem to find the config item to allow this though.

--
Mark

Alejandro Revilla

未讀,
2013年10月18日 上午10:47:582013/10/18
收件者:jPOS Users
JESpace can't be shared among instances. Things like the ReplicatedSpace could be a solution. It would be great to have a file based shareable space, at some point I thought about using BerkeleyDB standard C edition (with JNI bindings) to achieve that.


--
@apr



--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
 
Join us in IRC at http://webchat.freenode.net/?channels=jpos
 
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.

Mark Salter

未讀,
2013年10月18日 下午4:55:272013/10/18
收件者:jpos-...@googlegroups.com
On 18/10/2013 15:47, Alejandro Revilla wrote:
> JESpace can't be shared among instances.
There is a shared locking mechanism in the config file, but I couldn't
see it exposed as a 'set' method, so have not dug deeper to find if it
was relevant to address such a need.

Multiple client's to a single database seemed reasonable the
documentation seemed lacking to me.

--
Mark

Alejandro Revilla

未讀,
2013年10月18日 下午5:25:232013/10/18
收件者:jPOS Users
Are you looking at JE edition's documentation or standard BDB?


--
@apr



--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage.  Please support jPOS, contact: sa...@jpos.org

Join us in IRC at http://webchat.freenode.net/?channels=jpos

You received this message because you are subscribed to the  "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.

Mark Salter

未讀,
2013年10月18日 下午5:29:542013/10/18
收件者:jpos-...@googlegroups.com
On 18/10/2013 22:25, Alejandro Revilla wrote:
> Are you looking at JE edition's documentation or standard BDB?

Possibly the latter, I will check carefully and report back.

:-(


--
Mark

Alejandro Revilla

未讀,
2013年10月18日 下午5:38:082013/10/18
收件者:jPOS Users
I think it's the latter, but newer versions can run in different processes in a fault tolerant way. That's very promising. Unfortunately I didn't have the time to research that, but could be great for a persistent and fault tolerant space. We just need a back-channel for real-time notifications, we can use JGroups for that.

--
@apr



--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage.  Please support jPOS, contact: sa...@jpos.org

Join us in IRC at http://webchat.freenode.net/?channels=jpos

You received this message because you are subscribed to the  "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.

Juande Santa

未讀,
2013年10月24日 凌晨1:54:532013/10/24
收件者:jpos-...@googlegroups.com
Alejandro, Mark

Thanks for your time and interest. I am taking a look to ReplicatedSpace. Is not working yet for me, but I will spend more time on it and we will see.

Best regards,

Juande
回覆所有人
回覆作者
轉寄
0 則新訊息