我正在使用Spring会话将会话信息存储在我已使用Hibernate配置的db中。
现在我使用现有的Spring MVC应用程序将会话信息存储在DB中,
但是我错了,所以有人可以帮我解决这个问题
public class WebApplication implements WebApplicationInitializer{
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
AnnotationConfigWebApplicationContext dispatcherServlet = new AnnotationConfigWebApplicationContext();
// register the configuration class here
dispatcherServlet.register(WebAppConfig.class);
servletContext.addListener(new ContextLoaderListener(dispatcherServlet));
ServletRegistration.Dynamic dispatcher = servletContext.addServlet("InternalSite",
new DispatcherServlet(dispatcherServlet));
dispatcher.setLoadOnStartup(1);
dispatcher.addMapping("/api/*");
}}
WebAppConfig
@Configuration
@EnableWebMvc
@ComponentScan(basePackages = "com.example")
public class WebAppConfig extends WebMvcConfigurerAdapter {
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
System.out.println("in WebAppConfig class");
configurer.enable();
}
/**
* Configure ResourceHandlers to serve static resources like CSS/ Javascript etc...
*/
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**").addResourceLocations("/static/");
}}
DatalessJdbcSessionConfig
@EnableJdbcDatalessHttpSession
public class DatalessJdbcSessionConfig extends SessionCookieConfig{
@Autowired
private DataSource datasource;
@Bean
public DataSource dataSource() {
System.out.println("data source configured : "+datasource.getClass());
System.out.println("in DatalessJdbcSessionConfig class datasource");
return datasource;
}
@Bean
public PlatformTransactionManager transactionManager(DataSource dataSource) {
System.out.println("in DatalessJdbcSessionConfig class transactionManager");
return new DataSourceTransactionManager(dataSource);
}}
Initilizer:
public class Initializer extends AbstractHttpSessionApplicationInitializer {
public Initializer() {
super(DatalessJdbcSessionConfig.class);
}}
错误:
2016-12-13 14:30:19,742 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) WFLYCTL0183: Service status reportWFLYCTL0184: New missing/unsatisfied dependencies:
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."com.sun.faces.config.ConfigureListener".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."javax.faces.webapp.FacetTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.ArgumentTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.BindErrorsTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.BindTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.EscapeBodyTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.EvalTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.HtmlEscapeTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.MessageTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.NestedPathTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.ParamTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.ThemeTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.TransformTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.UrlTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.form.ButtonTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.form.CheckboxTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.form.CheckboxesTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.form.ErrorsTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.form.FormTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.form.HiddenInputTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.form.InputTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.form.LabelTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.form.OptionTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.form.OptionsTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.form.PasswordInputTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.form.RadioButtonTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.form.RadioButtonsTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.form.SelectTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".component."org.springframework.web.servlet.tags.form.TextareaTag".START (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService]
service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService (missing) dependents: [service jboss.deployment.unit."example-ear-0.0.0-SNAPSHOT.ear".deploymentCompleteService]
service jboss.undertow.deployment.default-server.default-host./example (missing) dependents: [service jboss.deployment.subunit."example-ear-0.0.0-SNAPSHOT.ear"."example.war".deploymentCompleteService] WFLYCTL0186: Services which failed to start: service jboss.undertow.deployment.default-server.default-host./example
答案 0 :(得分:0)
jboss中发生的事情是standalone.xml中定义了一些子系统,其中一些子系统依赖于我们不了解的内部其他子系统。因此,在这种情况下,如果您的应用程序不需要jsf,您可以直接从standalone.xml中删除jsf扩展及其相应的子系统,或者您可以通过在jboss-deployment-descriptor.xml中声明它的排除来排除jsf子系统。
请谷歌,如何在jboss中排除模块。