如何将Jersey集成到Struts2 + Hibernate应用程序中

时间:2016-06-06 09:52:32

标签: hibernate struts2 jersey

我已经将Jersey与Struts2应用程序集成在一起工作正常但在我的Web应用程序中我正在使用Hibernate,而我请求任何web服务,使得hibernate会话null无法执行任何数据库操作。我正在使用struts2-fullhibernatecore-plugin进行会话。请告诉我使用hibernate与Struts2进行泽西集成的正确配置。

的web.xml

<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>

    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
    <constant name="struts.devMode" value="false" />
    <constant name="struts.custom.i18n.resources" value="global" />
    <constant name="struts.multipart.maxSize" value="20971540" />

    <constant name="struts.action.excludePattern" value="/rest/.*?" />
    <!--<plug-in className="com.voxmojo.controller.listener.QuartzSchedulerListener" />-->
    <include file="signup.xml"/>
    <include file="defaultweb.xml"/>
    <include file="login.xml"/>
    <include file="consumer.xml" />
    <include file="doctor.xml" />
    <include file="payment.xml" />
    <include file="admin.xml" />
    <include file="hospital.xml" />
    <include file="app.xml" />
    <!--<include file="bog.xml" />-->

    <!-- Configuration for the default package. -->
    <package name="default" extends="hibernate-default">
        <action name="">
            <result>index.jsp</result>
        </action>
        <action name="SimpleWays">
            <result>blog1.jsp</result>
        </action>
        <action name="Youknowwhat">
            <result>blog2.jsp</result>
        </action>
        <action name="The5essentials">
            <result>blog3.jsp</result>
        </action>
        <action name="10VegetarianLunchIdeas">
            <result>blog4.jsp</result>
        </action>
        <action name="HowToHaveAProblem-FREE">
            <result>blog5.jsp</result>
        </action>
        <action name="HaveAGoalthasBigger">
            <result>blog6.jsp</result>
        </action>
        <action name="Fruits">
            <result>blog7.jsp</result>
        </action>
        <action name="5-Herbal-Tips-to-take-care-of-your-Hair">
            <result>blogHerbalTips.jsp</result>
        </action>
        <action name="7-Foods-that-help-keep-digestion">
            <result>7Foodsthathelpkeepdigestion.jsp</result>
        </action>
        <action name="6-Tips-to-keep-mosquito-out-of-your-home">
            <result>6Tipstokeepmosquitooutofyourhome.jsp</result>
        </action>
        <action name="9-side-effects-of-Junk-Food">
            <result>9side-effectsofJunkFood.jsp</result>
        </action>
        <action name="5-Tips-to-get-rid-of-body-odor">
            <result>5Tipstogetridofbodyodor.jsp</result>
        </action>
        <action name="7-Herbal-tips-to-anticipate-acnes-and-flaws">
            <result>7Herbaltipstoanticipateacnesandflaws.jsp</result>
        </action>
        <action name="6-Tips-to-anticipate-cold-this-winter">
            <result>6Tipstoanticipatecoldthiswinter.jsp</result>
        </action>
        <action name="5-herbal-oils-you-did-not-know-are-good-for-your-hairs">
            <result>5HerbalOilsYouDidNotKnowAreGoodForYourHairs.jsp</result>
        </action>
        <action name="5-natural-products-just-made-for-your-skin">
            <result>5NaturalProductsJustMadeForYourSkin.jsp</result>
        </action>
        <action name="DIABETIC-GOALS-THAT-EVERY-DIABETIC-IS-SUPPOSED-TO-KNOW-REMEMBER">
            <result>DiabeticGoals.jsp</result>
        </action>
        <action name="gastroparesis-and-diabetes-another-aspect-of-neuropathy">
            <result>Gastroparesis-and-Diabetes.jsp</result>
        </action>
        <action name="ordering-your-exercise-to-avoid-hypoglycemia">
            <result>ordering-your-exercise-to-avoid-hypoglycemia.jsp</result>
        </action>
        <action name="joslin-researchers-on-type-1-mortality-theres-still-more-to-be-done">
            <result>joslin-researchers-on-type-1-mortality-theres-still-more-to-be-done.jsp</result>
        </action>
        <action name="diabetes-and-your-brain-a-joslin-roundtable">
            <result>diabetes-and-your-brain-a-joslin-roundtable.jsp</result>
        </action>

    </package>

</struts>

struts.xml中

(1,2,5)
;; => java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn

0 个答案:

没有答案