facebook

Integrating the excellent urlrewrite

  1. MyEclipse IDE
  2.  > 
  3. Spring Development
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #315869 Reply

    Greg Soulsby
    Member

    Hi,

    I would like to use the excellent urlrewrite module in my app – it looks great for separating the user experience of URLs and my systems architecture. http://www.tuckey.org/urlrewrite/

    My re-write rule is expressed like this:
    <rule>
    <from>/explore</from>
    <to>/home?p=742</to>
    </rule>

    The log of the resulting crash is below. What does “no session or session was closed” mean? What is causing that?

    The line of my code in that lot is here:

    $Proxy35.getContent(Unknown Source)
    c013.web.prop_controller.home(prop_controller.java:94)

    where line 94 of prop_controler is
    result = result + cataloguesService.getContent(catalogue, breadcrumb);
    i.e. a call on the scafoldeded Service to get some records.

    I dont like the look of the $Proxy35, let alone the “Unknown Source” that follows.

    The app works fine when urlrewrite is not triggered.

    Could this error be caused because urlrewrite is trapping the URL and then not processing to the correct myEclipse Spring approach?

    Regards

    HTTP Status 500 –

    type Exception report

    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: c013.domain.InnovCatalogues.innovCatalogueRelationshipsesForFromCatalogueId, no session or session was closed
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:659)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213)
    org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171)
    org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
    org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
    org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381)

    root cause

    org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: c013.domain.InnovCatalogues.innovCatalogueRelationshipsesForFromCatalogueId, no session or session was closed
    org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
    org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
    org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
    org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
    org.hibernate.collection.PersistentSet.iterator(PersistentSet.java:163)
    c013.service.InnovCataloguesServiceImpl.getContent(InnovCataloguesServiceImpl.java:327)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
    org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:108)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    $Proxy35.getContent(Unknown Source)
    c013.web.prop_controller.home(prop_controller.java:94)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:710)
    org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:167)
    org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:414)
    org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:402)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213)
    org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171)
    org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
    org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
    org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381)

    #315913 Reply

    Greg Soulsby
    Member

    ok, solved this – you have to use type=”redirect” which presumably forces the url to be processed from the top again, rahter than from within url rewrite, which sets up the session correctly. Wish I knew enough to know how that works.

    So it should be
    <rule>
    <from>/explore</from>
    <to type=”redirect”>/home?p=742</to>
    </rule>

    #315946 Reply

    jkennedy
    Member

    Thanks for posting the issue and resolution, this will certainly help others.

    Jack

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Integrating the excellent urlrewrite

You must be logged in to post in the forum log in