카테고리 없음2016. 9. 8. 17:36
반응형

jboss 기동시 옵션 지정

-Dorg.apache.catalina.connector.URI_ENCODING=UTF-8

Posted by 1010
카테고리 없음2016. 9. 8. 15:10
반응형

spring boot 기반 JdbcTemplate 




1
2
3
4
5
spring.datasource.driver-class-name=com.tmax.tibero.jdbc.TbDriver
spring.datasource.url=jdbc:tibero:thin:@8.8.8.8.:8629:tibero
spring.datasource.username=id
spring.datasource.password=pw
cs






1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package com.example;
 
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.PreparedStatement;
import java.sql.SQLException;
 
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementSetter;
 
@SpringBootApplication
public class DemoApplication {
    
    private static JdbcTemplate jdbcTemplate;
    private static StringBuffer INSERT_TMP_TBL_MEMBER = new StringBuffer();
    
    public DemoApplication(JdbcTemplate _JdbcTemplate) {
        // TODO Auto-generated constructor stub
        DemoApplication.jdbcTemplate = _JdbcTemplate;
        INSERT_TMP_TBL_MEMBER.append("INSERT INTO TMP_TBL_MEMBER (C_NO,C_BIRTH,C_PHONE,C_PHONE2,C_EMAIL,C_NAME) VALUES(?,?,?,?,?,?)");
    }
    
    public static void main(String[] args) throws IOException{
        SpringApplication.run(DemoApplication.class, args);
        
        Resource resource = new ClassPathResource("TBL_MEMBER.txt");
        BufferedReader reader = new BufferedReader(new InputStreamReader(resource.getInputStream(),"euc-kr"));
        String tmpStr;
        while ((tmpStr = reader.readLine()) != null) {
            // C_NO,C_BIRTH,C_PHONE,C_PHONE2,C_EMAIL,C_NAME
            String[] params =  tmpStr.split(",");
            if(params.length == 6){
                INSERT_TB_FILE_MANAGE(params);
            }else{
                System.out.println(params.length+":"+params.toString());
            }
        }
    }
    
    private static void INSERT_TB_FILE_MANAGE(String[] params) {
        jdbcTemplate.update(INSERT_TMP_TBL_MEMBER.toString(), new PreparedStatementSetter() {
            @Override
            public void setValues(PreparedStatement preparedStatement) throws SQLException {
                // TODO Auto-generated method stub
                preparedStatement.setString(1, params[0== null ? "" : params[0]);
                preparedStatement.setString(2, params[1== null ? "" : params[1]);
                preparedStatement.setString(3, params[2== null ? "" : params[2]);
                preparedStatement.setString(4, params[3== null ? "" : params[3]);
                preparedStatement.setString(5, params[4== null ? "" : params[4]);
                preparedStatement.setString(6, params[5== null ? "" : params[5]);
            }
        });
    }
}
cs


Posted by 1010
카테고리 없음2016. 9. 8. 12:32
반응형

Issue

  • If Weld is not forced to use JSF Version 1.2, it picks the 2.1 Version (despite the declaration of Mojarra-1.2 in web.xml) and the following error occurs:
14:30:27,385 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/CDI_JSF_WebDemo]] (ServerService Thread Pool -- 63) JBWEB000287: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! org.jboss.as.weld.webtier.jsf.WeldApplicationFactory
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:215) [jsf-impl-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:200) [jsf-impl-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
    at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3339) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3777) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
    at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:156) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
    at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:60) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
    at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:93) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_65]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_65]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_65]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_65]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_65]
    at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Caused by: java.lang.InstantiationException: org.jboss.as.weld.webtier.jsf.WeldApplicationFactory
    at java.lang.Class.newInstance(Class.java:359) [rt.jar:1.7.0_65]
    at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:537) [jsf-api-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
    at javax.faces.FactoryFinder.getImplementationInstance(FactoryFinder.java:405) [jsf-api-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
    at javax.faces.FactoryFinder.access$400(FactoryFinder.java:135) [jsf-api-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
    at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:717) [jsf-api-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
    at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:239) [jsf-api-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
    at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:187) [jsf-impl-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
    at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:132) [jsf-impl-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:205) [jsf-impl-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
    ... 12 more

14:30:27,388 ERROR [org.apache.catalina.core] (ServerService Thread Pool -- 63) JBWEB001103: Error detected during context /CDI_JSF_WebDemo start, will stop it
14:30:27,395 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 63) MSC000001: Failed to start service jboss.web.deployment.default-host./CDI_JSF_WebDemo: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./CDI_JSF_WebDemo: org.jboss.msc.service.StartException in anonymous service: JBAS018040: Failed to start context
    at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:96)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_65]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_65]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_65]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_65]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_65]
    at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Caused by: org.jboss.msc.service.StartException in anonymous service: JBAS018040: Failed to start context
    at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:161)
    at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:60)
    at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:93)
    ... 6 more

14:30:27,604 ERROR [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "CDI_JSF_WebDemo.war" was rolled back with the following failure message: 
{"JBAS014671: Failed services" => {"jboss.web.deployment.default-host./CDI_JSF_WebDemo" => "org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./CDI_JSF_WebDemo: org.jboss.msc.service.StartException in anonymous service: JBAS018040: Failed to start context
    Caused by: org.jboss.msc.service.StartException in anonymous service: JBAS018040: Failed to start context"}}
  • If the following Weld modules in JBoss are modified to use JSF Version 1.2, the error does not appear and everything works fine:

"jboss-eap-6.1.0/modules/system/layers/base/org/jboss/as/weld/main/module.xml"
"jboss-eap-6.1.0/modules/system/layers/base/org/jboss/weld/core/main/module.xml"

  <dependencies>
     ...
     <module name="javax.faces.api" slot="1.2"/>
     ...
  </dependencies>
  • But we get stuck if we try to achieve the same with "META-INF/jboss-deployment-structure.xml". The error appears again:
<jboss-deployment-structure>
    <deployment>
        <exclusions>
            <module name="javax.faces.api"/>
            <module name="com.sun.jsf-impl"/>
        </exclusions>
        <dependencies>
            <module name="javax.faces.api" slot="1.2"/>
            <module name="com.sun.jsf-impl" slot="1.2"/>
        </dependencies>
    </deployment>
</jboss-deployment-structure>
  • How to use the "jboss-deployment-structure.xml" to achieve the same effect as modifying the module dependency definitions?
  • Is there a "Per Application" solution available, because changing the whole JBoss instance to use JSF 1.2 will cause problems with our JSF 2.0 Applications.


Posted by 1010
카테고리 없음2016. 9. 8. 12:31
반응형

spring boot 기반 restful 방식 개발시 jsp 컴파일 안되는 문제 


server.servlet-path=/
 : 기본서블릿으로 요청
server.servlet-path=/*
 : 프레임워크에서 지정한 서블릿으로 요청

Deploying a WAR in an Old (Servlet 2.5) Container

Spring Boot uses Servlet 3.0 APIs to initialize the ServletContext (register Servlets etc.) so you can’t use the same application out of the box in a Servlet 2.5 container. It is however possible to run a Spring Boot application on an older container with some special tools. If you includeorg.springframework.boot:spring-boot-legacy as a dependency (maintained separately to the core of Spring Boot and currently available at 1.0.0.RELEASE), all you should need to do is create a web.xml and declare a context listener to create the application context and your filters and servlets. The context listener is a special purpose one for Spring Boot, but the rest of it is normal for a Spring application in Servlet 2.5. Example:

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

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>demo.Application</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.boot.legacy.context.web.SpringBootContextLoaderListener</listener-class>
    </listener>

    <filter>
        <filter-name>metricFilter</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>metricFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <servlet>
        <servlet-name>appServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextAttribute</param-name>
            <param-value>org.springframework.web.context.WebApplicationContext.ROOT</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>appServlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

</web-app>

In this example we are using a single application context (the one created by the context listener) and attaching it to the DispatcherServlet using an init parameter. This is normal in a Spring Boot application (you normally only have one application context).

Posted by 1010