Mr. E
Mr. E

Reputation: 515

Is is possible to serialize and imported log class in java?

I have question for you...

I have this java app that I am trying to run on a jboss EAP 74 cluster. I am trying to serialize the session data, and I have an issue with the log setup.....

I have a tone of the log files with a setup similar to that below....

package com.company.myapp.bean.common;

import java.io.Serializable;
import com.company.jfoundation.log.Log;

public abstract class myappBaseBean extends BaseBean {

    public String moduleItemAction() {

        ...

        if (Log.ON) {
            this.log.fine("********* MODULE ITEM ACTION INVOKED **********");
        }
        Map<String, String> requestParamMap = FacesContext.getCurrentInstance().getExternalContext()
            .getRequestParameterMap();

        String moduleItemName = requestParamMap.get("itemName");
        String beanName = requestParamMap.get("beanName");

        if (Log.ON) {
            this.log.fine("moduleItemName---> " + moduleItemName);
            this.log.fine("beanName---> " + beanName);
        }
        ...
    }
    ...

    @SuppressWarnings("rawtypes")
    protected  List<ScreenDTO> fetchScreenList( String modCode) {
        Collection screenList = null;
        try {

            this.adminBI = this.getAdminService();
        }
        catch ( ServiceLocatorException sLocatorExp) {
            this.setError(true);
            this.setSuccess(false);
            new ErrorHandler(sLocatorExp, this.resourceBundle);
            this.log.error(this.getClass().getName(), "", sLocatorExp);
        }
    }

    ...

}

I tried to just serialize the classs, with a simple implements statements


import java.io.Serializable;

public abstract class myappBaseBean extends BaseBean implements java.io.Serializable {


}

, but I cannot seem to get around the error ...


18:28:04,506 WARN  [org.infinispan.PERSISTENCE] (default task-18) ISPN000559: Cannot marshall 'class org.infinispan.marshall.protostream.impl.MarshallableUserObject': java.io.NotSerializableException: com.company.jfoundation.log.Log
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:278)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1182)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1140)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1119)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1119)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:271)
    at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
    at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)

Is there a quick and dirty way to serialize the imported log function, or am I looking at a serious refactor or this app to get the sessions cached.

Ta,

X

P.S. - Please don't get hung up on the import of the log module. The module can be anything, I was just wondering if there was a way to mark an imported module "whatever it might be " as serializable during the import?

Upvotes: 0

Views: 30

Answers (0)

Related Questions