Announcement Announcement Module
Collapse
No announcement yet.
Network Controller Lazy Load Initialization Exception Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Network Controller Lazy Load Initialization Exception

    First off let me clear the obvious, I have crawled the forums, I have tried Karl Baum's suggestions (http://www.jroller.com/comments/kbau...ation_with_dao) and none of them seem to work.

    That said.

    I have a system which provides both web access for data management and a separate UDP based network connection for delivery of that data. I have constructed the normal Controller -> Manager -> DAO system that spring encourages for the web front end. I have tried to utilize the same structure for network connection so that a packet coming off the wire goes through a translation service and then is fire as a multicast event. The multicast event fires to "Network Controllers" that implement a listener interface. Network Controllers utilize the aforementioned managers to retrieve information (POJOs) and deliver those POJOs to a translation service which then fires response out the wire.


    I have the following hibernate interceptor implementation as recommended by Karl, but it is not working. I also am using the unit test method he mentioned - none of them work.


    <bean id="deviceInitializationController" class="org.springframework.aop.framework.ProxyFact oryBean">
    <property name="target"><ref bean="messageControllerTarget"/></property>
    <property name="proxyInterfaces">
    <value>com.comapny.UDPMessageEventListener</value>
    </property>
    <property name="interceptorNames">
    <list>
    <value>hibernateInterceptor</value>
    </list>
    </property>
    </bean>


    <bean id="messageControllerTarget"
    class="com.company.MessageController">
    <property name="messageService">
    <ref bean="messageService"/>
    </property>
    <property name="actionService">
    <ref bean="messageService"/>
    </property>
    <property name="userManager">
    <ref bean="userManager"/>
    </property>
    </bean>

    any help would be highly appreciated. I have been pulling my hair out for hours.

  • #2
    can you post the exact stace trace so we can see where the exception is thrown.

    Comment


    • #3
      Figured it out

      We spent most of the night last night hacking away at this and figured out what was happening. Here are my notes so that others might learn/find resolution.

      We was having an event listener (also called Network Controllers) that would access one or many managers to obtain the information they required to do some processing which would be delivered to the outlying network connected entities. The hibernate interceptor did in fact properly place the proxy on top of the event listener, but the problem came in in how we handled registration of the listener into the dispatcher of the events. We were utilizing the "this" object to register the listener, which of course utilizes the base object and not the proxy wrapped object. It required a fair amount of re-working of our system in order to get some rather annoying cyclic bean definition issues worked out.

      The summary of what we ended up doing is to revise how the listeners are assigned to the dispatcher. They have to be assigned/registered through the spring configuration, as this is the only component that has access to the proxy wrapped objects. Attempting to assign/register through code definition becomes an exercise in Lazy Load exception. Here is the sample code of how we handled the registration configuration.

      <bean id="networkEventService" class="com.company.NetworkEventServiceImpl">
      <property name="packetLog">
      <ref bean="packetLog"/>
      </property>

      <property name="networkInterface">
      <ref bean="networkInterface"/>
      </property>

      <property name="listeners">
      <list>
      <ref bean="networkControllerNumber1"/>
      <ref bean="networkControllerNumber2"/>
      <ref bean="networkControllerNumber3"/>
      </list>
      </property>
      </bean>

      After doing this, and realizing that most entry users to Spring probably would not have come to this - I am going to investigate building a base class similar to HibernateDAOSupport that will automatically handle this issue through pre-established aspect oriented methods. IF anyone has a recommended direction for this, I would appreciate it - otherwise I am source code diving!

      Comment

      Working...
      X