NutzCN Logo
问答 jsp servlets 项目改造 引入nutz 失败
发布于 1521天前 作者 Hamming 1335 次浏览 复制 上一个帖子 下一个帖子
标签:

jsp servlets 项目改造 引入nutz 失败
参考兽总 教程到这一步
http://nutzbook.wendal.net/setup30mins/configure_iocby.html
上一步启动 没有问题 加入注解 提示找不到 配置文件

package com.icss;

import org.nutz.mvc.annotation.IocBy;
import org.nutz.mvc.annotation.Modules;
import org.nutz.mvc.ioc.provider.ComboIocProvider;

/**
 * @author Haiming
 * @date 2020/10/23 6:01 PM
 */
@IocBy(type=ComboIocProvider.class, args={"*js", "ioc/",
        "*anno", "com.icss",
        "*tx", // 事务拦截 aop
        "*async"}) // 异步执行aop
@Modules(scanPackage=true)
public class MainModule {

}
2020-10-23 18:07:14,488 ERROR [org.nutz.mvc.impl.NutLoading] - Error happend during start serivce!
org.nutz.lang.born.BorningException: Fail to born or cast to 'org.nutz.ioc.loader.json.JsonLoader'
 by args: [@(ioc/)]
 because:java.lang.RuntimeException: folder or file like '^(.+[.])(js|json)$' no found in ioc/
	at org.nutz.lang.born.DynamicConstructorBorning.born(DynamicConstructorBorning.java:23)
	at org.nutz.lang.born.BornContext.doBorn(BornContext.java:60)
	at org.nutz.lang.Mirror.born(Mirror.java:1029)
	at org.nutz.ioc.loader.combo.ComboIocLoader.createIocLoader(ComboIocLoader.java:124)
	at org.nutz.ioc.loader.combo.ComboIocLoader.<init>(ComboIocLoader.java:86)
	at org.nutz.mvc.ioc.provider.ComboIocProvider.create(ComboIocProvider.java:20)
	at org.nutz.mvc.impl.NutLoading.createIoc(NutLoading.java:384)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:103)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:91)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:69)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:270)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:251)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:102)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4528)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5165)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
	at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1727)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:288)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
	at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:456)
	at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:405)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:288)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
	at com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468)
	at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
	at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
	at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1408)
	at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
	at sun.rmi.transport.Transport$1.run(Transport.java:200)
	at sun.rmi.transport.Transport$1.run(Transport.java:197)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: folder or file like '^(.+[.])(js|json)$' no found in ioc/
	at org.nutz.lang.Lang.makeThrow(Lang.java:157)
	at org.nutz.resource.Scans.loadResource(Scans.java:112)
	at org.nutz.ioc.loader.json.JsonLoader.<init>(JsonLoader.java:45)
	at org.nutz.ioc.loader.json.JsonLoader$FC$23c63b8520c09cd19c81cf872f50da86.invoke(JsonLoader.java)
	at org.nutz.lang.born.AbstractConstructorBorning.call(AbstractConstructorBorning.java:25)
	at org.nutz.lang.born.DynamicConstructorBorning.born(DynamicConstructorBorning.java:17)
	... 60 more
23-Oct-2020 18:07:14.497 严重 [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal 一个或多个筛选器启动失败。完整的详细信息将在相应的容器日志文件中找到

找不到 对应的js文件
另外 项目 xml下面的 也不能正常访问

写死 绝对路径 又能找到 stmacmbas_barcode_gzypt 是项目名称
/Users/kricss/IdeaProjects/stmacmbas_barcode_gzypt/conf/ioc/

4 回复

web.xml 加入nutz后 所有 servlet 访问都是404 注释了后 又能正常访问

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app id="WebApp_stmacmbas_barcode"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5">

    <display-name>stmacmbas_barcode</display-name>
    <!-- r1 start 只有云平台需要r1的配置,其它点都不需要 -->
    <!--
    <context-param>
        <param-name>resourceOneHome</param-name>
        <param-value>/ResourceOneHome</param-value>
    </context-param>
    <context-param>
        <param-name>resourceOneCoreConfigPath</param-name>
        <param-value>config</param-value>
    </context-param>
    <context-param>
        <param-name>resourceOneAppConfigPath</param-name>
        <param-value>config</param-value>
    </context-param>
    <filter>
        <filter-name>SdkFilter</filter-name>
        <filter-class>com.icss.resourceone.sdk.SdkFilter</filter-class>
        <init-param>
            <param-name>SdkFilterType</param-name>
            <param-value>client</param-value>
        </init-param>
                <init-param >
                       <param-name>datasourceJndi</param-name>
                       <param-value>jdbc/ROEEE</param-value>
                </init-param>

    </filter>
    <filter>
        <filter-name>ChangeReqEncoding</filter-name>
        <filter-class>com.icss.j2ee.servlet.filter.ChangeReqEncoding</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>utf-8</param-value>
        </init-param>
    </filter>
     <filter>
        <filter-name>SSOClient</filter-name>
        <filter-class>com.icss.resourceone.sso.client.SSOClient</filter-class>
        <init-param>
            <param-name>_except_urlpattern</param-name>
            <param-value>/weixin/*|/services/*|/businessService/*|/template/*|/js/*|\.js$|\.css$</param-value>
        </init-param>
        <init-param>
            <param-name>URIEncoding</param-name>
            <param-value>utf-8</param-value>
        </init-param>
    </filter>
    <filter>
        <filter-name>RightFilter</filter-name>
        <filter-class>com.icss.resourceone.sdk.right.RightFilter</filter-class>
        <init-param>
            <param-name>_except_urlpattern</param-name>
            <param-value>/yntbm/weixin/*|/services/*|/yntdc/weixin/*|/yntdc/businessService/*|/yntdc/template/*|/js/*|\.js$|\.css$</param-value>
        </init-param>
    </filter>

    <filter>
      <filter-name>CheckPasswordFilter</filter-name>
      <filter-class>com.icss.barcode.filter.CheckPasswordFilter</filter-class>
     </filter>

    <filter-mapping>
        <filter-name>SdkFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>ChangeReqEncoding</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>SSOClient</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>RightFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>


    <filter-mapping>
      <filter-name>CheckPasswordFilter</filter-name>
      <url-pattern>/stmacmbas/report/runqian/BcReportServlet</url-pattern>
  </filter-mapping>
  <filter-mapping>
      <filter-name>CheckPasswordFilter</filter-name>
      <url-pattern>/stmacmbas/barcode/show/lifecycle.jsp</url-pattern>
  </filter-mapping>
  <filter-mapping>
      <filter-name>CheckPasswordFilter</filter-name>
      <url-pattern>/show/servlet/QueryByBusStepServlet</url-pattern>
  </filter-mapping>
    <servlet>
        <servlet-name>InitR1ClientServlet</servlet-name>
        <servlet-class>com.icss.resourceone.sdk.init.InitR1ClientServlet</servlet-class>
        <load-on-startup>20</load-on-startup>
    </servlet>
    -->
    <!-- r1 end -->
    <!-- add yangshumiing start -->

    <servlet>
        <servlet-name>timer_TimerServlet</servlet-name>
        <servlet-class>com.icss.barcode.timer.TimerServlet</servlet-class>
        <load-on-startup>3</load-on-startup>
    </servlet>
    <servlet>
        <servlet-name>AxisServlet</servlet-name>
        <display-name>Apache-Axis Servlet</display-name>
        <servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
    </servlet>
    <!-- add yangshumiing   end-->
    <!-- add by zhangyl 20170905 瑞乾配置文件加载 beg -->
    <servlet>
        <servlet-name>reportServlet</servlet-name>
        <servlet-class>com.runqian.util.webutil.SetContextServlet</servlet-class>
        <init-param>
            <param-name>configFile</param-name>
            <param-value>/WEB-INF/reportConfig.xml</param-value>
        </init-param>
        <load-on-startup>7</load-on-startup>
    </servlet>
    <servlet>
        <servlet-name>com_icss_rqtool_report_config_ReportInitServlet</servlet-name>
        <servlet-class>com.icss.rqtool.report.config.ReportInitServlet</servlet-class>
        <load-on-startup>10</load-on-startup>
    </servlet>
    <servlet>
        <servlet-name>stmacmbas_report_runqian_BcReportServlet</servlet-name>
        <servlet-class>stmacmbas.report.runqian.BcReportServlet</servlet-class>
    </servlet>

    <servlet>
        <servlet-name>com_icss_clients_wlptclient_stock_CheckStockServlet</servlet-name>
        <servlet-class>com.icss.barcode.collect.check.stock.CheckStockServlet</servlet-class>
    </servlet>

    <!-- add by zhangyl 20170905 end -->
    <!-- add by yangyue 20171102 瑞乾多级联动宏	补贴码查询 beg -->
    <servlet>
        <servlet-name>BcCascadeServlet</servlet-name>
        <servlet-class>stmacmbas.report.runqian.BcCascadeServlet</servlet-class>
    </servlet>

    <servlet>
        <servlet-name>PasteCodeServlet</servlet-name>
        <servlet-class>com.icss.barcode.show.servlet.PasteCodeServlet</servlet-class>
    </servlet>

    <servlet>
        <servlet-name>LifeCycleServlet</servlet-name>
        <servlet-class>com.icss.barcode.show.servlet.LifeCycleServlet</servlet-class>
    </servlet>

    <!-- add by wangcheng 20180109 start -->
    <servlet>
        <servlet-name>OutDepotServlet</servlet-name>
        <servlet-class>com.icss.barcode.show.servlet.OutDepotServlet</servlet-class>
    </servlet>

    <servlet>
        <servlet-name>QueryByBusStepServlet</servlet-name>
        <servlet-class>com.icss.barcode.show.servlet.QueryByBusStepServlet</servlet-class>
    </servlet>

    <servlet>
        <servlet-name>NewCodeRepairServlet</servlet-name>
        <servlet-class>com.icss.barcode.show.servlet.NewCodeRepairServlet</servlet-class>
    </servlet>
    <servlet>
        <servlet-name>QueryServlet</servlet-name>
        <servlet-class>com.icss.barcode.query.servlet.QueryServlet</servlet-class>
    </servlet>

    <servlet>
        <servlet-name>CommonServlet</servlet-name>
        <servlet-class>com.icss.barcode.query.servlet.CommonServlet</servlet-class>
    </servlet>
    <!-- add by wangcheng 20180109 end -->

    <!--add by wuxin 统一的提交类数据入口servlet-->
    <servlet>
        <servlet-name>SubmitServlet</servlet-name>
        <servlet-class>com.icss.barcode.submit.servlet.SubmitServlet</servlet-class>
    </servlet>
    <!--add by wuxin end-->

    <servlet-mapping>
        <servlet-name>BcCascadeServlet</servlet-name>
        <url-pattern>/stmacmbas/report/runqian/BcCascadeServlet</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>PasteCodeServlet</servlet-name>
        <url-pattern>/com/icss/barcode/show/servlet/PasteCodeServlet</url-pattern>
    </servlet-mapping>

    <!-- add by yangyue 20171102 end -->

    <!-- add by wangcheng 20180109 start -->
    <servlet-mapping>
        <servlet-name>OutDepotServlet</servlet-name>
        <url-pattern>/show/servlet/OutDepotServlet</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>QueryByBusStepServlet</servlet-name>
        <url-pattern>/show/servlet/QueryByBusStepServlet</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>LifeCycleServlet</servlet-name>
        <url-pattern>/show/servlet/LifeCycleServlet</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>NewCodeRepairServlet</servlet-name>
        <url-pattern>/barcode/show/servlet/NewCodeRepairServlet</url-pattern>
    </servlet-mapping>
    <!-- add by wangcheng 20180307 end -->
    <servlet-mapping>
        <servlet-name>CommonServlet</servlet-name>
        <url-pattern>/query/servlet/CommonServlet</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>QueryServlet</servlet-name>
        <url-pattern>/query/servlet/QueryServlet</url-pattern>
    </servlet-mapping>

    <!--wuxin 统一的提交类数据入口servlet-->
    <servlet-mapping>
        <servlet-name>SubmitServlet</servlet-name>
        <url-pattern>/submit/servlet/SubmitServlet</url-pattern>
    </servlet-mapping>
    <!--add by wuxin end-->

    <servlet-mapping>
        <servlet-name>com_icss_rqtool_report_config_ReportInitServlet</servlet-name>
        <url-pattern>/com/icss/rqtool/report/config/ReportInitServlet</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>stmacmbas_report_runqian_BcReportServlet</servlet-name>
        <url-pattern>/stmacmbas/report/runqian/BcReportServlet</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>reportServlet</servlet-name>
        <url-pattern>/reportServlet</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>com_icss_clients_wlptclient_stock_CheckStockServlet</servlet-name>
        <url-pattern>/barcode/check/CheckStockServlet</url-pattern>
    </servlet-mapping>
    <!-- add yangshumiing   start-->
    <servlet-mapping id="ServletMapping_stmacmbas_branch_timer_TimerServlet">
        <servlet-name>timer_TimerServlet</servlet-name>
        <url-pattern>/barcode/timer/TimerServlet</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>AxisServlet</servlet-name>
        <url-pattern>*.jws</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>AxisServlet</servlet-name>
        <url-pattern>/services/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>AxisServlet</servlet-name>
        <url-pattern>/servlet/AxisServlet</url-pattern>
    </servlet-mapping>

    <mime-mapping>
        <extension>wsdl</extension>
        <mime-type>text/xml</mime-type>
    </mime-mapping>


    <mime-mapping>
        <extension>xsd</extension>
        <mime-type>text/xml</mime-type>
    </mime-mapping>
    <resource-ref id="ResourceRef_1510907322816">
        <res-ref-name>ResourceOne/DataSource</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>
    <!-- add yangshumiing   end-->
    <resource-ref id="ResourceRef_1510907322814">
        <res-ref-name>jdbc/barcode</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>
    <resource-ref id="ResourceRef_1510907322815">
        <res-ref-name>jdbc/ROEEE</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>

<!--    <filter>
        <filter-name>nutz</filter-name>
        <filter-class>org.nutz.mvc.NutFilter</filter-class>
        <init-param>
            <param-name>modules</param-name>
            <param-value>com.icss.MainModule</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>nutz</filter-name>
        <url-pattern>/*</url-pattern>
        &lt;!&ndash; ForwardView需要下面的配置 @Ok("->:/xxx/yyy/zzz") &ndash;&gt;
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>-->
</web-app>

非maven项目? conf设置为源文件了吗?

非maven项目 conf/ioc/dao.js
项目启动正常 但是servlet 冲突 404

nuz 不支持servlet?

添加回复
请先登陆
回到顶部