मैं वाडिन का उपयोग करके एक वेब ऐप विकसित कर रहा हूं और इसे कॉन्फ़िगर कर रहा हूं ताकि यह विकास, स्टेजिंग और उत्पादन सेटिंग में चलेगा। मेरी समस्या यह है कि मुझे अपनी युद्ध फ़ाइल चलाने के लिए टॉमकैट 7 मेवेन प्लगइन प्राप्त करने में परेशानी हो रही है। युद्ध फ़ाइल ठीक है - मैंने इसे एक संपादक के साथ जांच लिया है। मैं डेटाबेस जानकारी के लिए खड़े होने के लिए अपने spring-context.xml (जिसे मैं applicationContext.xml कहते हैं) में प्लेसहोल्डर्स का उपयोग कर रहा हूं। मैं वास्तविक डेटा के साथ प्लेसहोल्डर को प्रतिस्थापित करने के लिए मेवेन संसाधन फ़िल्टरिंग का उपयोग करता हूं। यह युद्ध फ़ाइल में काम करता है।एक मेवेन टॉमकैट प्लगइन से युद्ध फ़ाइल चलाना - गलत फ़ाइल का उपयोग कर प्लगइन है?
[INFO]
[INFO] --- gwt-maven-plugin:2.4.0:compile (default) @ dpt ---
[INFO] auto discovered modules [com.catalystitservices.nike.dpt.widgetset.DptWidgetset]
[INFO] com.catalystitservices.nike.dpt.widgetset.DptWidgetset is up to date. GWT compilation skipped
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) @ dpt ---
[INFO] Packaging webapp
[INFO] Assembling webapp [dpt] in [C:\Projects\DPT\target\dpt]
[INFO] Processing war project
[INFO] Copying webapp webResources [C:\Projects\DPT\src/main/webapp/] to [C:\Projects\DPT\target\dpt]
[INFO] Copying webapp resources [C:\Projects\DPT\src\main\webapp]
[INFO] Webapp assembled in [1407 msecs]
[INFO] Building war: C:\Projects\DPT\target\dpt.war
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ dpt ---
[INFO] Installing C:\Projects\DPT\target\dpt.war to C:\Users\ksnortum\.m2\repository\com\nike\dpt\dpt\1.1-SNAPSHOT\dpt-1.1-SNAPSHOT.war
[INFO] Installing C:\Projects\DPT\pom.xml to C:\Users\ksnortum\.m2\repository\com\nike\dpt\dpt\1.1-SNAPSHOT\dpt-1.1-SNAPSHOT.pom
[INFO]
[INFO] >>> tomcat-maven-plugin:1.1:run (default-cli) @ dpt >>>
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ dpt ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ dpt ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< tomcat-maven-plugin:1.1:run (default-cli) @ dpt <<<
[INFO]
[INFO] --- tomcat-maven-plugin:1.1:run (default-cli) @ dpt ---
[INFO] Running war on http://localhost:8080/dpt
[INFO] Creating Tomcat server configuration at C:\Projects\DPT\target\tomcat
Aug 27, 2012 2:51:57 PM org.apache.catalina.startup.Embedded start
INFO: Starting tomcat server
Aug 27, 2012 2:51:57 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.29
Aug 27, 2012 2:51:58 PM org.apache.catalina.core.ApplicationContext log
INFO: Set web app root system property: 'webapp.root' = [C:\Projects\DPT\src\main\webapp\]
Aug 27, 2012 2:51:58 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing log4j from [classpath:log4j.properties]
Aug 27, 2012 2:51:58 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
27.08.2012 14:51:58 INFO (ContextLoader.java:272) - Root WebApplicationContext: initialization started
27.08.2012 14:51:58 INFO (AbstractApplicationContext.java:500) - Refreshing Root WebApplicationContext: startup date [Mon Aug 27 14:51:58 PDT 2012]; root of context hierarchy
27.08.2012 14:51:58 INFO (XmlBeanDefinitionReader.java:315) - Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
27.08.2012 14:51:58 INFO (XmlBeanDefinitionReader.java:315) - Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext-security.xml]
27.08.2012 14:51:59 INFO (SpringSecurityCoreVersion.java:33) - You are running with Spring Security Core 3.1.0.RELEASE
27.08.2012 14:51:59 INFO (SecurityNamespaceHandler.java:57) - Spring Security 'config' module version is 3.1.0.RELEASE
27.08.2012 14:51:59 INFO (HttpSecurityBeanDefinitionParser.java:229) - Checking sorted filter chain: [Root bean: class [org.springframework.security.web.context.SecurityContextPersistenceFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 300, Root bean: class [org.springframework.security.web.authentication.logout.LogoutFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 400, <org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0>, order = 800, Root bean: class [org.springframework.security.web.authentication.www.BasicAuthenticationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1200, Root bean: class [org.springframework.security.web.savedrequest.RequestCacheAwareFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1300, Root bean: class [org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1400, Root bean: class [org.springframework.security.web.authentication.AnonymousAuthenticationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1700, Root bean: class [org.springframework.security.web.session.SessionManagementFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1800, Root bean: class [org.springframework.security.web.access.ExceptionTranslationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1900, <org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0>, order = 2000]
27.08.2012 14:51:59 INFO (PropertiesLoaderSupport.java:177) - Loading properties file from file [C:\Projects\DPT\target\classes\log4j.properties]
27.08.2012 14:51:59 INFO (DefaultSingletonBeanRegistry.java:433) - Destroying singletons in org.s[email protected]3358fd70: defining beans [org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0,cdbController,forecastController,genericGridController,productionPlanController,productionScheduleReportController,actualsDao,cdbDao,dateDimDao,developerDao,factoryCapacityOverrideDao,factoryDao,familyDao,forecastDao,globalTotalOverrideDao,linePlanDao,modelOfferingDao,multiSourceDao,productionCategoryDao,productionPlanDao,regionDao,dptApplication,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.config.internalBeanConfigurerAspect,org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor#0,org.springframework.context.annotation.CommonAnnotationBeanPostProcessor#0,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,txManager,messageSource,localeResolver,com.catalystitservices.nike.util.VaadinApplicationObjectSupport#0,dataSource,jdbcTemplate,org.springframework.security.filterChains,org.springframework.security.filterChainProxy,org.springframework.security.web.DefaultSecurityFilterChain#0,org.springframework.security.web.DefaultSecurityFilterChain#1,org.springframework.security.web.DefaultSecurityFilterChain#2,org.springframework.security.web.PortMapperImpl#0,org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0,org.springframework.security.authentication.ProviderManager#0,org.springframework.security.web.context.HttpSessionSecurityContextRepository#0,org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy#0,org.springframework.security.web.savedrequest.HttpSessionRequestCache#0,org.springframework.security.access.vote.AffirmativeBased#0,org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0,org.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator#0,org.springframework.security.authentication.AnonymousAuthenticationProvider#0,org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint#0,org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0,org.springframework.security.userDetailsServiceFactory,org.springframework.security.web.DefaultSecurityFilterChain#3,org.springframework.security.provisioning.InMemoryUserDetailsManager#0,org.springframework.security.authentication.dao.DaoAuthenticationProvider#0,org.springframework.security.authentication.DefaultAuthenticationEventPublisher#0,org.springframework.security.authenticationManager,org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource#0,org.springframework.security.access.vote.AffirmativeBased#1,org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor#0,org.springframework.security.methodSecurityMetadataSourceAdvisor,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
Aug 27, 2012 2:51:59 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Could not resolve placeholder 'db.driverClassName' in string value [${db.driverClassName}]
यहाँ क्या चल रहा है मेरी व्याख्या है:
हालांकि, जब मैं एक Tomcat7 Maven प्लगइन के साथ चलाने के प्रयास करते समय, मैं निम्न त्रुटि (मैं बाहर की सफाई और परीक्षण संदेशों बाएं) मिलता है। कृपया मुझे बताएं कि क्या मैं गलत हूं।
वाडिन जीडब्ल्यूटी का उपयोग करता है, ताकि संकलित हो जाए। फिर युद्ध फ़ाइल इकट्ठा और स्थापित हो जाती है। संसाधनों की प्रतिलिपि बनाई जाती है और फ़िल्टर की जाती है। मेवेन जांचता है कि इसे संकलित करने की आवश्यकता है, लेकिन ऐसा नहीं है। फिर टॉमकैट शुरू होता है और खुद को कॉन्फ़िगर करना शुरू कर देता है। जब यह DataContext.xml में डेटा स्रोत में जाता है तो यह चोक करता है क्योंकि यह वास्तविक डेटा के बजाय प्लेसहोल्डर्स पाता है। पर क्यों? संसाधन पहले ही चल चुके हैं, और युद्ध फ़ाइल और युद्ध निर्देशिका में सही डेटा है।
यहां मेरे पीओएम के कुछ भाग हैं। मैं इसे बहुत कुछ बदल गया है, लेकिन इस पर मैं क्या उतरा है:
<build>
<finalName>dpt</finalName>
<filters>
<filter>src/main/resources/props/dev.properties</filter>
</filters>
<resources>
<resource>
<!-- Currently, log4j.properties -->
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
<plugins>
<!-- WAR file plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${mavenWarPlugin}</version>
<configuration>
<packagingExcludes>WEB-INF/web.xml</packagingExcludes>
<warName>dpt</warName>
<filters>
<filter>src/main/resources/props/dev.properties</filter>
</filters>
<webResources>
<resource>
<!-- Currently, spring context files -->
<directory>src/main/webapp/</directory>
<filtering>true</filtering>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
मैं समझ नहीं सकता है क्यों 'tomcat7: run' था मेवेन युद्ध प्लगइन में कॉन्फ़िगर किए गए फ़िल्टर किए गए संसाधनों का उपयोग नहीं करना। यह वही था जो मैं याद कर रहा था। डिफ़ॉल्ट रूप से प्लगइन अपने WAR स्रोत के रूप में src/main/webapp का उपयोग करता प्रतीत होता है, लेकिन मुझे इसे मैवेन टॉमकैट प्लगइन दस्तावेज़ में नहीं मिला। – JeroenHoek