JBoss Advent Calendar 2011ã®12æ¥ç®ã®ã¨ã³ããªã§ãã JNDIã¯Java EEãµã¼ãã®EJBãJDBCãã¼ã¿ã½ã¼ã¹ãJMSã®ConnectionFactoryãªã©ãå種ãµã¼ãã¹ã«ã¢ã¯ã»ã¹ããããã®ã¨ã³ããªãã¤ã³ãã¨ãªãé¨åãªã®ã§ããããã¾ãã¨ããµã¤ãã£ã³ã°ãªæè¡ã§ã¯ãªãã®ã§æ³¨ç®ããããã¨ã¯ãªãã§ãããã©ã®ãããªãã®ãªã®ãã調ã¹ããããæ©ä¼ããªããªããªãã§ããããã¨ããããã§ããã£ã¨æ¯ãè¿ãã¾ãã ã¾ãåºæ¬çãªæ©è½ã¯ãªã¢ã¼ãã¢ã¯ã»ã¹ãã§ãããµã¼ãä¸ã®ã°ãã¼ãã«HashMapã¿ãããªãã®ã§ããã¡ã½ããåãã¡ãã£ã¨éããget()ã§ã¯ãªãlookup()ãput()ã§ã¯ãªãrebind()ã¨ãªã£ã¦ãã¾ãã ãã¼ã¿ã½ã¼ã¹ãåå¾ãããããªã³ã¼ãã¯ãã®ããã«ãªãã¾ãã InitialContext context = new InitialContext(); DataSou
ä¸ã«åºã¦ããEJBã®èª¬æã¯ã¯ã½ã¿ãããªãã®ãå¤ããç°¡æ½ã«æ©è½ãç¹å¾´ãè¨è¿°ãã¦ãããã®ãè¦å½ãããªãã®ã§æ¸ãã¾ãããJava EE 6, 7ã対象ã¨ãã¦æ¸ãã¦ãã¾ãã EJBã¨ããã®ã¯Java EEã¢ããªã±ã¼ã·ã§ã³ãµã¼ãä¸ã§å©ç¨ã§ããJavaã®ã³ã³ãã¼ãã³ãã§ãããã©ã³ã¶ã¯ã·ã§ã³å¶å¾¡ãªã©ã®ç ©éãªé¨åãEJBãèªåçã«é¢åãè¦ã¦ãããã®ã§ãéçºè ã¯EJBã®åºæ¬çãªã«ã¼ã«ãæãããã¨ã¯ãã¸ãã¹ãã¸ãã¯ã®è¨è¿°ã«éä¸ãããã¨ãã§ãããã¨ãããã®ã§ããEJBã«ã¯4種é¡ããã¾ãã åºæ¬ã¨ãªãã¹ãã¼ãã¬ã¹ã»ãã·ã§ã³ãã¼ã³ (Stateless Session Bean, SLSB) ç¶æ ãä¿æã§ããã¹ãã¼ããã«ã»ãã·ã§ã³ãã¼ã³ (Stateful Session Bean, SFSB) åä¸ã¤ã³ã¹ã¿ã³ã¹ã®ã·ã³ã°ã«ãã³ã»ãã·ã§ã³ãã¼ã³ (Singleton Session Bean, SSB) ã¡ãã»ã¼ã¸(
CDIãæ¥åã·ã¹ãã éçºã«ããããã¡ãªããã¨ã¯ï¼ EJBã¨ã®ä½¿ãåãã¯ï¼ââææ°Java EEéçºâèã®ç©´â 第3å ä¸å¦»å®äººæ° ãJava EE 6ã§å°å ¥ãããCDIã®å©ç¹ã¯"ãã¹ã容ææ§"ã¨"æè¡ä¾åã®æé¤"ã®å®ç¾ãã ã¨èªãã®ã¯ãNTTã³ã ã¦ã§ã¢ã§Java EEéçºãæè¡æ¯æ´ã«æºããä¸å¦»å®äººæ°ã ãå ·ä½çã«ã©ã®ãããªã¡ãªãããããã®ããèããã CDIã¯Java EEéçºè å¾ æã®æ¨æºDIæ©è½ãã¨ã³ã¿ã¼ãã©ã¤ãºã»ã·ã¹ãã éçºã«ãããæ大ã®å¹ç¨ã¯"ãã¹ã容ææ§"ã¨"æè¡ä¾åã®æé¤" Java EE 6ã§æ°ãã«å°å ¥ããããCDIï¼Contexts and Dependency Injectionï¼ãã¯ãå¤ãã®éçºè ãå¾ ã¡æãã§ããæ¨æºDIï¼ä¾åæ§ã®æ³¨å ¥ï¼æ©è½ã ãJava EE 5ã®EJB 3ã§å è¡å°å ¥ããã¦ããDIæ©è½ãããµã¼ãã¬ãããJSFãªã©ãå«ãJava EEã¢ããªã±ã¼ã·ã§ã³å ¨ä½ã§å©ç¨å¯
Open Message Queue (OpenMQ) 㯠ãªã¼ãã³ã½ã¼ã¹ã® ã¡ãã»ã¼ã¸æåããã«ã¦ã§ã¢ãéçºããããã¸ã§ã¯ãããªã¼ãã³ã½ã¼ã¹ã¢ããªã±ã¼ã·ã§ã³ãµã¼ãéçºããã¸ã§ã¯ãGlassFishã®ãµãããã¸ã§ã¯ãã¨ãã¦ã³ãã¥ããã£ã«ããéçºãé²ãããã¦ããã Java Message Service (JMS) APIãå®è£ ãã¦ãããJMS-APIã®åºæ¬å®è£ 以å¤ã«ã¹ã±ã¼ã©ããªãã£ã»é«å¯ç¨æ§ãå®ç¾ããOpenMQ ClusterãC-APIãJMX対å¿ç®¡çAPIãªã©ãæè¼ãã¦ãããå ãã¦JMSRAã¨å¼ã°ããJava EE Connector Architectureï¼è±èªçï¼ (JCA) ã®å®è£ ã¢ã¸ã¥ã¼ã«ãå«ãã§ãããJCAå®è£ ã«ããJava EEæºæ ã®ã¢ããªã±ã¼ã·ã§ã³ãµã¼ããBPMãªã©ãã容æã«ã¡ãã»ã¼ã¸ãã¥ã¼ã使ç¨ãããã¨ãå¯è½ã¨ãã¦ããã2009å¹´ç¾å¨OpenMQã¯GlassFis
java-jaå¿å¹´ä¼ã§haru860ããã«èãããã®ã§ã¨ã³ããªãæ¸ãããã¨æã£ã¦ãã£ããæ¸ãã¦æ¾ç½®ãã¦ãã¾ãããã¿ã¾ããããã®è³ªåã¸ã®ããããåçã¨ãã¦ãEJBã使ãã¨ããã¿ãããªãã®ãããã¾ããããã®åçã¯å¤ãã®å ´åä½ã®å½¹ã«ãç«ã¡ã¾ãããããã®ãããªåçããã人ã¯JBossããã¾ãè¯ãç解ãã¦ããªãå¯è½æ§ãããã¾ãã ã¨ããããã§ãJBossã使ã£ã¦ããã¦ã¼ã¶ãã©ã®ãããªã¢ããã¼ã·ã§ã³ã§Tomcatã§ã¯ãªãJBossã使ãã®ãããããã¯å®å ¨ã«JBossã«ä¹ãæãã¦ããã®ããå®ä¾ãã¼ã¹ã®çç±ãããã¤ãç´¹ä»ãã¾ãããã æ©è½ Tomcatã§æä¾ãããæ©è½ã¯åºæ¬çã«Servlet, JSP, JDBCæ¥ç¶ãã¼ã«ã®ã¿ã§ãä»ã®ãã®ã¯æä¾ããã¦ãã¾ãããã·ã³ãã«ã§ãããä»ã®ãã®ãå¿ è¦ã«ãªã£ãã¨ãã«ãããããã¤ã³ãã°ã¬ã¼ã·ã§ã³ããã³ã¹ããçºçãããªã©ãå°ãé¢åãªãã¨ã«ãªãã¾ãã Tomcatã«ãªãã¦J
Servlet 3.1 å®è£ ã«ã¯ãServlet 3.1 ãã£ã¼ãã£ã¼ã使ç¨ããå ´åã« Servlet 3.0 ç¨ã«ä½æãããã¢ããªã±ã¼ã·ã§ã³ãç°ãªãåä½ããããã失æãããããå¯è½æ§ãããåä½ã®å¤æ´ãå«ã¾ãã¦ãã¾ãã åä½ã®å¤æ´ãèæ ®ãã¦ããµã¼ãã¼ã»ã¤ã³ã¹ã¿ã³ã¹ãã¨ã«ãServlet 3.0 㨠Servlet 3.1 ãã£ã¼ãã£ã¼å®è£ ã®ãããã使ç¨ããããé¸æã§ãã¾ãã å¿ è¦ãªåä½ã Servlet 3.1 ãã£ã¼ãã£ã¼ã«ã®ã¿å«ã¾ãã¦ããå ´åãServlet 3.1 ãã£ã¼ãã£ã¼ã使ç¨ããå¿ è¦ãããã¾ãã æ¢åã®ã¢ããªã±ã¼ã·ã§ã³ã Servlet 3.1 ãã£ã¼ãã£ã¼ã®åä½å¤æ´ã§æªå½±é¿ãåããå ´åãServlet 3.0 ãã£ã¼ãã£ã¼ã使ç¨ããã°ããã®ã¢ããªã±ã¼ã·ã§ã³ã®æ¢åã®åä½ãä¿æããã¾ãã åããµã¼ãã¼ã§ Servlet 3.0 㨠Servlet 3.1 ã®ä¸¡æ¹ã®ãã£ã¼ãã£ã¼ã
åã®ä¸ã§ã¯ã Java ã§ãã®ã³ã°ãããªã log4j 1.2 ç³»ã§å¿ è¦ååã ãã以å¤ãææ°ã®ãã¬ã³ãã«ã¤ãã¦èãããã¨ãªãã¦æ°å¹´åããç¡ããªã£ã¦ãããã§ãã ã ã£ã¦ãã©ã¤ãã©ãªã®æ§è½ãæ©è½ï¼åºåå ã®ç¨®é¡ï¼ãå¤å°å¢ãã¦ãç¾å ´ã®ãã®ã³ã°è¦ä»¶ã¯ãããªã«ã¯å¤ããã¾ããããã ã§ããä»æ¥ãç´¹ä»ãã SLF4J (Simple Logging Facade For Java) ã¯å¤§å¤èå³æ·±ããã®ã³ã°APIãªãã§ããã SLF4J ã¯å種ãã®ã³ã°ã»ã©ã¤ãã©ãªã®ã¢ããã¿APIã¨è¨ã£ã¦ããããããã«ãã£ã¦ãã®ã³ã°ã»ã©ã¤ãã©ãªã®å®è£ ãéçºãã©ã¼ãºã¨ç¶ºéºã«åé¢ãããã¨ãåºæ¥ããã§ãï¼å®è£ ã®é 延è©ä¾¡ï¼ã ããã«ããã®ã¢ããã¿ã¨ãã¦ã®å½¹å²ã使ãã°éçºè ã®è² æ ãæ¸ãããã¨ãäºãåºæ¥ããã§ããã
ããããã¯ã¡ãã»ã¼ã¸ãã¥ã¼ã大åã¨ãããã¨ã§ãJavaã®ã¡ãã»ã¼ã¸ã³ã°APIã§ããJMS(Java Messaging Service)ã試ãã¦ã¿ã¾ãã JMS試ãã«ã¯ã¡ãã»ã¼ã¸ã³ã°ãµã¼ãã¼ãå¿ è¦ã§ãOpen MQã¨ãã使ãã¾ãããã©ãããããOpen MQã¨ããã¤ã³ã¹ãã¼ã«ãã¦èµ·åãããã®ãããã©ãã®ã§ãGlassfishã使ãã¾ããGlassfishã«ã¯Open MQãå ¥ã£ã¦ã¦ããã®ã¾ã¾ä½¿ããç¶æ ã«ãªã£ã¦ãã¾ããNetBeans使ããªãGlassfishå ¥ã£ã¦ã¾ãããã ä»åã¯v2.1ã使ãã¾ãããv3 preludeã«ã¯JMSå ¥ã£ã¦ãªãã¿ããã https://glassfish.dev.java.net/ æ¬æ¥ãªãGlassfishã§ä½¿ãå ´åã«ã¯JNDIçµç±ã§JMSãµã¼ãã¼ãåå¾ããã®ã§ãããä»åã¯ããã©ããªã®ã§ãç´æ¥ã¤ãªãã¾ãã ã¨ãããã¨ã§ãã¡ãã»ã¼ã¸éä¿¡å´ããããã¤ãã¼ã¨ãã
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}