0

spring+hibernate+zk3.0.2(2007-12-24)

asked 2007-12-27 14:56:37 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4692098

By: macson

My project was used spring+hibernate+zk.
when i click a function using spring, i got exception "KillerApp encounters an error: No WebApplicationContext found: no ContextLoaderListener registered?
" if my app deploy to websphere.
but it runs ok if deploying to tomcat6.
how to resolve it? thanks.

/macson

my environment is :
spring version : 2.0.7
hibernate version: 3.2.5 ga
zk version : 3.0.1 or zk3.0.2(2007-12-24) App Server : websphere 6.1.0.0

app directory structure is:
WEB-INF/
|_applicationContext.xml

spring config content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="mySessionFactory" factory-method="getSessionFactory"
class="org.zkoss.zkplus.hibernate.HibernateUtil" lazy-init="true"/>
<bean id="myTransactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="mySessionFactory"/>
</property>
</bean>
<bean id="allDAO" class="com.kingstargroup.util.AllDAO">
<property name="sessionFactory">
<ref local="mySessionFactory"/>
</property>
</bean>
<bean id="bgxtService"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="myTransactionManager" />
</property>
<property name="target">
<bean class="com.bgxt.service.impl.BgxtServiceImpl">
<property name="allDAO">
<ref bean="allDAO"/>
</property>
</bean>
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
</beans>

web.xml content:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="WebApp_1198670873171"
version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<description><![CDATA[myapp]]></description>
<display-name>myapp</display-name>
<!--
<icon>
<small-icon></small-icon>
<large-icon></large-icon>
</icon>
-->
<!-- Spring ApplicationContext -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listene
r-class>
</listener>

<!-- //// -->
<!-- ZK -->
<listener>
<description>Used to cleanup when a session is destroyed</description>
<display-name>ZK Session Cleaner</display-name>
<listener-class>org.zkoss.zk.ui.http.HttpSessionListener</listener-class>
</listener>
<servlet>
<description>ZK loader for ZUML pages</description>
<servlet-name>zkLoader</servlet-name>
<servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class>
<!-- Must. Specifies URI of the update engine (DHtmlUpdateServlet).
It must be the same as <url-pattern> for the update engine.
-->
<init-param>
<param-name>update-uri</param-name>
<param-value>/zkau</param-value>
</init-param>
<!-- Optional. Specifies whether to compress the output
of the ZK loader. It speeds up the transmission over slow Internet.
However, if you configure a filter to post-processing the
output, you might have to disable it.

Default: true
<init-param>
<param-name>compress</param-name>
<param-value>true</param-value>
</init-param>
-->
<!-- Optional. Specifies the default log level: OFF, ERROR, WARNING,
INFO, DEBUG and FINER. If not specified, the system default is used. -->
<init-param>
<param-name>log-level</param-name>
<param-value>DEBUG</param-value>
</init-param>

<load-on-startup>1</load-on-startup>
<!-- Must -->
</servlet>
<servlet-mapping>
<servlet-name>zkLoader</servlet-name>
<url-pattern>*.zul</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>zkLoader</servlet-name>
<url-pattern>*.zhtml</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>zkLoader</servlet-name>
<url-pattern>*.svg</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>zkLoader</servlet-name>
<url-pattern>*.xml2html</url-pattern>
</servlet-mapping>

<!-- Optional. Uncomment it if you want to use richlets.
-->
<servlet-mapping>
<servlet-name>zkLoader</servlet-name>
<url-pattern>/zk/*</url-pattern>
</servlet-mapping>

<servlet>
<description>The asynchronous update engine for ZK</description>
<servlet-name>auEngine</servlet-name>
<servlet-class>org.zkoss.zk.au.http.DHtmlUpdateServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>auEngine</servlet-name>
<url-pattern>/zkau/*</url-pattern>
</servlet-mapping>

<!-- Uncomment if you want to use the ZK filter to post process the HTML output
generated by other technology, such as JSP and velocity.
<filter>
<filter-name>zkFilter</filter-name>
<filter-class>org.zkoss.zk.ui.http.DHtmlLayoutFilter</filter-class>
<init-param>
<param-name>extension</param-name>
<param-value>html</param-value>
</init-param>
<init-param>
<param-name>compress</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>zkFilter</filter-name>
<url-pattern>/test/filter.dsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>zkFilter</filter-name>
<url-pattern>/test/filter2.dsp</url-pattern>
</filter-mapping>
-->

<!-- ///////////// -->
<!-- DSP (optional) -->
<!-- Uncomment if you want to use Potix DSP in your Website
<servlet>
<servlet-name>dspLoader</servlet-name>
<servlet-class>org.zkoss.web.servlet.dsp.InterpreterServlet</servlet-class>
<init-param>
<param-name>class-resource</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>dspLoader</servlet-name>
<url-pattern>*.dsp</url-pattern>
</servlet-mapping>
-->

<!-- /////////// -->
<!-- Miscellaneous -->
<session-config>
<session-timeout>60</session-timeout>
</session-config>

<!-- MIME mapping -->
<mime-mapping>
<extension>doc</extension>
<mime-type>application/vnd.ms-word</mime-type>
</mime-mapping>
<mime-mapping>
<extension>gif</extension>
<mime-type>image/gif</mime-type>
</mime-mapping>
<mime-mapping>
<extension>htm</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
<extension>html</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
<extension>jad</extension>
<mime-type>text/vnd.sun.j2me.app-descriptor</mime-type>
</mime-mapping>
<mime-mapping>
<extension>jnlp</extension>
<mime-type>application/x-java-jnlp-file</mime-type>
</mime-mapping>
<mime-mapping>
<extension>jpeg</extension>
<mime-type>image/jpeg</mime-type>
</mime-mapping>
<mime-mapping>
<extension>jpg</extension>
<mime-type>image/jpeg</mime-type>
</mime-mapping>
<mime-mapping>
<extension>js</extension>
<mime-type>application/x-javascript</mime-type>
</mime-mapping>
<mime-mapping>
<extension>pdf</extension>
<mime-type>application/pdf</mime-type>
</mime-mapping>
<mime-mapping>
<extension>png</extension>
<mime-type>image/png</mime-type>
</mime-mapping>
<mime-mapping>
<extension>rar</extension>
<mime-type>application/x-rar-compressed</mime-type>
</mime-mapping>
<mime-mapping>
<extension>txt</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xls</extension>
<mime-type>application/vnd.ms-excel</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xml</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xul</extension>
<mime-type>application/vnd.mozilla.xul-xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>zhtml</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
<extension>zip</extension>
<mime-type>application/x-zip</mime-type>
</mime-mapping>
<mime-mapping>
<extension>zul</extension>
<mime-type>text/html</mime-type>
</mime-mapping>

<welcome-file-list>
<welcome-file>index.zul</welcome-file>
<welcome-file>index.zhtml</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>
</web-app>

zk.xml
<?xml version="1.0" encoding="UTF-8"?>

<!-- zk.xml
Purpose:

Description:

History:
Sun Mar 26 16:29:07 2006, Created by tomyeh

Copyright (C) 2006 Potix Corporation. All Rights Reserved.
-->

<zk>
<log>
<description>[Optional] Monitor i3-log.conf and register a handler for the specified log-base</description>
<log-base>org.zkoss</log-base>
</log>

<language-config>
<addon-uri>/WEB-INF/lang-addon.xml</addon-uri>
</language-config>

<!-- Optional -->
<!-- Map extensions to the xml language.
By default, xml is mapped to xml -->
<language-mapping>
<language-name>xml</language-name>
<extension>svg</extension>
</language-mapping>
<language-mapping>
<language-name>xml</language-name>
<extension>xml2html</extension>
</language-mapping>
<!-- Map extensions to the xul/html language
By default, xul/html are mapped to zul and xul.
<language-mapping>
<language-name>xul/html</language-name>
<extension>xxx</extension>
</language-mapping>
-->

<session-config>
<!-- Turn on the following if you want a different timeout
Note: The unit is seconds (while that of web.xml is minute)
<session-timeout>1800</session-timeout>
-->
<!-- Turn OFF the following if you want to use the default:
onTimer, like any other request, resets the session-timeout counter
-->
<timer-as-inactive>true</timer-as-inactive>
</session-config>

<!-- Turn on if you prefer to use the native (Servlet) thread
to process the events, instead of forking the event processing thread
<system-config>
<disable-event-thread/>
</system-config>
-->
<!-- Turn on the following if you want to keep session after Web server restarts
<system-config>
<ui-factory-class>org.zkoss.zk.ui.http.SerializableUiFactory</ui-factory-class
>
</system-config>
-->
<!-- Turn on the following if you want to cache all desktops in a global
cache, rather than one for each session
<system-config>
<cache-provider-class>org.zkoss.zk.ui.sys.GlobalDesktopCacheProvider</cache-pr
ovider-class>
</system-config>
-->
<!-- Turn on to test FailoverManager with an useless failover manager
<system-config>
<failover-manager-class>org.zkoss.zkdemo.test.DumbFailoverManager</failover-ma
nager-class>
</system-config>
-->
<!-- Turn on to test the status when IdGenerator is called
<system-config>
<id-generator-class>org.zkoss.zkdemo.test.ViewIdGenerator</id-generator-class>
</system-config>
-->
<system-config>
<upload-charset>GBK</upload-charset>
</system-config>

<!-- Optional -->
<!-- You can define any number of richlets as follows.
Note: To use richlet, you have to map zkLoader to /xx/* in web.xml,
where xx could be any name. And, the final URL will be /xx/url-pattern.
This demo application maps all richlet to /zk (see web.xml),
so the richlet path will be, say, /zk/test/some
-->
<richlet>
<richlet-name>Test</richlet-name>
<richlet-class>org.zkoss.zkdemo.test.TestRichlet</richlet-class>
<!-- Any number of initial parameters.
<init-param>
<param-name>any</param-name>
<param-value>any</param-value>
</init-param>
-->
</richlet>
<richlet-mapping>
<richlet-name>Test</richlet-name>
<url-pattern>/test/*</url-pattern>
</richlet-mapping>

<!-- Optional -->
<device-config>
<device-type>ajax</device-type>
<timeout-uri>/timeout.zul</timeout-uri>
<!-- An empty URL can cause the browser to reload the same URL -->
</device-config>

<!-- Optional -->
<!-- the following listener is used to see # of sessions, desktops...
-->
<listener>
<description>[Optional] Mointor the statistic</description>
<listener-class>org.zkoss.zk.ui.util.Statistic</listener-class>
</listener>
<!-- Uncomment the following to test the performance meter
<listener>
<listener-class>org.zkoss.zkdemo.test.PerformanceMeter</listener-class>
</listener>
-->
<!-- Uncomment to test if EventThreadInit throws an exception
<listener>
<listener-class>org.zkoss.zkdemo.test.NPEEventThreadInit</listener-class>
</listener>
-->

<!-- Configure the error page -->
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/WEB-INF/sys/error.zul</location>
</error-page>
<desktop-config>
<theme-uri>/css/mzdmis.css</theme-uri>
<desktop-timeout>-1</desktop-timeout>
<file-check-period>5</file-check-period>
<processing-prompt-delay>900</processing-prompt-delay>
<disable-behind-modal>true</disable-behind-modal>
<tooltip-delay>800</tooltip-delay>
<keep-across-visits>false</keep-across-visits>
</desktop-config>

<!-- Configure ZUL to use smaller fonts for all locales, and
smaller fonts for the rest Locales
<desktop-config>
<disable-theme-uri>~./zul/css/norm*.css.dsp*</disable-theme-uri>
<theme-uri>~./zul/css/normsm*.css.dsp*</theme-uri>
</desktop-config>
-->
<!-- Configure ZUL to use larger fonts for all locales, and
smaller fonts for the rest Locales
<desktop-config>
<disable-theme-uri>~./zul/css/norm*.css.dsp*</disable-theme-uri>
<theme-uri>~./zul/css/normlg*.css.dsp*</theme-uri>
</desktop-config>
-->
<!-- Configure ZUL to use larger fonts for Chinese characters, and
nomal fonts for the rest Locales
<desktop-config>
<disable-theme-uri>~./zul/css/norm*.css.dsp*</disable-theme-uri>
<theme-uri>~./zul/css/norm**.css.dsp</theme-uri>
</desktop-config>
-->
<!-- Configure additional theme URIs
<desktop-config>
<theme-uri>/a.css</theme-uri>
<theme-uri>/b**.css</theme-uri>
</desktop-config>
-->
<desktop-config>
<theme-provider-class>org.zkoss.zkdemo.userguide.FontSizeThemeProvider</theme
-provider-class>
</desktop-config>

<!-- Uncomment the following if you want to redirect to particular
page when ZK Client receives an error code.
<client-config>
<error-reload>
<error-code>301</error-code>
<reload-uri>/login.zul</reload-uri>
</error-reload>
</client-config>
-->
<!-- Uncomment the following to customize the client-polling-based
server push.
Note: the unit of PollingServerPush.delay.min and max is second.
Note: the values of PollingServerPush.start and stop are
the JavaScript codes to execute at the client.
Note: the value of PollingServerPush.delay.factor must be integer,
<preference>
<name>PollingServerPush.delay.min</name>
<value>3000</value>
</preference>
<preference>
<name>PollingServerPush.delay.max</name>
<value>10000</value>
</preference>
<preference>
<name>PollingServerPush.delay.factor</name>
<value>5</value>
</preference>
<preference>
<name>PollingServerPush.start</name>
<value></value>
</preference>
<preference>
<name>PollingServerPush.stop</name>
<value></value>
</preference>
-->

<listener>
<description>Hibernate SessionFactory Lifecycle</description>
<listener-class>org.zkoss.zkplus.hibernate.HibernateSessionFactoryListener</li
stener-class>
</listener>

<!-- Configure the Hibernate configuration file name if not "hibernate.cfg.xml"
<preference>
<name>HibernateUtil.config</name>
<value></value>
</preference>
-->
<listener>
<description>Hibernate Open Session In View Session Lifecycle</description>
<listener-class>org.zkoss.zkplus.hibernate.OpenSessionInViewListener</listener
-class>
</listener>

<listener>
<description>Hibernate thread session context handler</description>
<listener-class>
org.zkoss.zkplus.hibernate.HibernateSessionContextListener
</listener-class>
</listener>
</zk>


delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2007-12-28 01:48:21 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4692758

By: jebberwocky

There is a smalltalks on this topic,
http://www.zkoss.org/smalltalks/hibnsprn/hibn_sprn_zk.html

link publish delete flag offensive edit

answered 2007-12-28 04:54:29 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4692839

By: henrichen

It looks has something to do with the Spring and WebSphere. Maybe you want to try the ContextLoaderServlet instead of the ContextLoaderListener?

http://www.roseindia.net/struts/hibernate-spring/spring-contextloaderservlet.sht
ml

/henri

link publish delete flag offensive edit

answered 2007-12-30 06:57:49 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4695128

By: macson

thanks jebber & henry.
i try to re_deploy the project to websphere 6.1 , and put dependence libraries into WEB-INF/lib/ one by one if websphere's log hints.
At last it's ok.
Then i found some articles about websphere class loader. It has some rules to load libs.
I don't know how to set my libs sequences for loading, so i had to use the stupid method.
Maybe it's not the base reason, but it can resolve my big problem.

/macson

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2007-12-27 14:56:37 +0800

Seen: 495 times

Last updated: Dec 30 '07

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More