NutzCN Logo
问答 nutzcn项目提问
发布于 2356天前 作者 wwt124511 2173 次浏览 复制 上一个帖子 下一个帖子
标签: nutzwk

我是用了nutzcn的项目框架搭了一套自己的项目,现在启动报找不到ioc里面的js相关文件。
启动报错信息:

七月 11, 2018 6:43:15 下午 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter nutz
org.nutz.mvc.LoadingException: 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.mvc.LoadingException$FC$fc4eda299d55b98c0c5d337d5b5ae053.invoke(LoadingException.java)
at org.nutz.lang.born.AbstractConstructorBorning.call(AbstractConstructorBorning.java:25)
at org.nutz.lang.born.ConstructorBorning.born(ConstructorBorning.java:19)
at org.nutz.lang.born.BornContext.doBorn(BornContext.java:60)
at org.nutz.lang.Mirror.born(Mirror.java:1022)
at org.nutz.lang.Lang.wrapThrow(Lang.java:203)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:135)
at org.nutz.plugins.hotplug.Hotplug.load(Hotplug.java:117)
at org.nutz.mvc.ActionHandler.(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:285)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4747)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5389)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:755)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:731)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1125)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1868)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: 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:1022)
at org.nutz.ioc.loader.combo.ComboIocLoader.createIocLoader(ComboIocLoader.java:124)
at org.nutz.ioc.loader.combo.ComboIocLoader.(ComboIocLoader.java:86)
at org.nutz.plugins.hotplug.Hotplug.createIoc(Hotplug.java:141)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:103)
... 20 more
Caused by: java.lang.RuntimeException: folder or file like '^(.+[.])(js|json)$' no found in ioc/
at org.nutz.lang.Lang.makeThrow(Lang.java:154)
at org.nutz.resource.Scans.loadResource(Scans.java:112)
at org.nutz.ioc.loader.json.JsonLoader.(JsonLoader.java:45)
at org.nutz.ioc.loader.json.JsonLoader$FC$6a157b207b56a81d61499c3eeb4cd915.invoke(JsonLoader.java)
at org.nutz.lang.born.AbstractConstructorBorning.call(AbstractConstructorBorning.java:25)
at org.nutz.lang.born.DynamicConstructorBorning.born(DynamicConstructorBorning.java:17)
... 26 more

七月 11, 2018 6:43:15 下午 org.apache.catalina.core.StandardContext startInternal

项目结构说明:
heixia-anpai
heixia-core 基础继承module
heixia-intf 接口module
heixia-webapp web启动框架module
是用maven聚合结构

heixia-core模块说明:
里面引入了一些nutz的jar包,其他没什么

heixia-intf:
pom.xml代码如下:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
        <artifactId>heixia-anpai</artifactId>
        <groupId>com.heixia</groupId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>

  <artifactId>heixia-intf</artifactId>

  <name>heixia-intf</name>
  <!-- FIXME change it to the project's website -->
  <url>http://www.example.com</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

  <dependencies>
        <dependency>
            <groupId>com.heixia</groupId>
            <artifactId>heixia-core</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-core</artifactId>
            <version>1.5.16</version>
        </dependency>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-servlet</artifactId>
            <version>1.5.16</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-jaxrs</artifactId>
            <version>1.5.16</version>
        </dependency>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-annotations</artifactId>
            <version>1.5.16</version>
        </dependency>
        <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutz-integration-swagger</artifactId>
            <version>1.r.63</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutz-plugins-mock</artifactId>
            <version>1.r.61.r2</version>
            <scope>test</scope>
        </dependency>
        
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-1.2-api</artifactId>
            <version>2.6</version>
        </dependency>
        
    </dependencies>
    
    <build>
    	<resources>
		    <resource>
		        <directory>src/main/java</directory>
		        <includes>
		            <include>**/*.xml</include>
		            <include>**/*.properties</include>
		        </includes>
		        <filtering>true</filtering>
		    </resource>
		    <resource>
		        <directory>src/main/resources/${profiles.target}</directory>
		        <filtering>true</filtering>
		    </resource>
		</resources>
    	
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>nutz</id>
            <url>https://jfrog.nutz.cn/artifactory/jcenter</url>
        </repository>
        <repository>
            <id>nutz-snapshots</id>
            <url>https://jfrog.nutz.cn/artifactory/snapshots</url>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
    </repositories>
</project>

4 回复

能分散,但resources目录下面不要多加一层文件夹啊...

配置文件我想按环境来区分,如果不能加文件夹,要怎么弄?

我以前的项目也是按文件夹区分的,用的也是nutz,是用如下方式:
<profiles.target>dev_test</profiles.target>


ROOT


src/main/java

**/*.xml
**/*.properties

true


src/main/resources/${profiles.target}
true

ioc文件夹要设置为源码包格式

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