在Jboss 7.1.1 final中部署我的Web应用程序时遇到问题。 虽然部署它给了我很多警告,如下 -
12:41:29,961 INFO [org.springframework.web.context.ContextLoader] (MSC service thread 1-6) Root WebApplicationContext: initialization completed in 132 ms
12:41:30,169 WARN [com.opensymphony.xwork2.util.FileManager] (MSC service thread 1-6) Could not create JarEntryRevision for [vfs:/content/Gurukul.war/WEB-INF/lib/struts2-core-2.2.1.1]!: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method) [rt.jar:1.6.0_24]
at java.util.zip.ZipFile.<init>(ZipFile.java:131) [rt.jar:1.6.0_24]
at java.util.jar.JarFile.<init>(JarFile.java:150) [rt.jar:1.6.0_24]
at java.util.jar.JarFile.<init>(JarFile.java:114) [rt.jar:1.6.0_24]
at com.opensymphony.xwork2.util.FileManager$JarEntryRevision.build(FileManager.java:307) [xwork-core-2.2.1.1.jar:2.2.1.1]
at com.opensymphony.xwork2.util.FileManager.loadFile(FileManager.java:145) [xwork-core-2.2.1.1.jar:2.2.1.1]
at com.opensymphony.xwork2.util.FileManager.loadFile(FileManager.java:105) [xwork-core-2.2.1.1.jar:2.2.1.1]
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:898) [xwork-core-2.2.1.1.jar:2.2.1.1]
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:154) [xwork-core-2.2.1.1.jar:2.2.1.1]
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:121) [xwork-core-2.2.1.1.jar:2.2.1.1]
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:179) [xwork-core-2.2.1.1.jar:2.2.1.1]
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66) [xwork-core-2.2.1.1.jar:2.2.1.1]
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371) [struts2-core-2.2.1.1.jar:2.2.1.1]
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415) [struts2-core-2.2.1.1.jar:2.2.1.1]
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69) [struts2-core-2.2.1.1.jar:2.2.1.1]
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51) [struts2-core-2.2.1.1.jar:2.2.1.1]
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:447) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3269) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3865) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.6.0_24]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.6.0_24]
at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_24]
但最终战争已经部署,我能够在Jboss 7.1.1决赛中打开网址。但是当我尝试登录应用程序时,它会出现以下错误。
控制台输出 ---&gt;
12:42:08,199 INFO [com.ericsson.tni.action.AuthorizationAction] Entered login
12:42:08,201 INFO [com.ericsson.tni.action.AuthorizationAction] Authentication Started For User : etapguh
12:42:08,201 INFO [com.ericsson.tni.action.AuthorizationAction] Authentication Result : success
12:42:08,202 INFO [com.ericsson.tni.action.AuthorizationAction] Initiating authorisation :
12:42:08,202 ERROR [stderr] java.lang.NullPointerException
12:42:08,203 ERROR [stderr] at com.ericsson.tni.action.AuthorizationAction.login(AuthorizationAction.java:92)
12:42:08,203 ERROR [stderr] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
12:42:08,203 ERROR [stderr] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
12:42:08,204 ERROR [stderr] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
12:42:08,204 ERROR [stderr] at java.lang.reflect.Method.invoke(Method.java:616)
12:42:08,204 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)
12:42:08,205 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)
12:42:08,205 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)
12:42:08,205 ERROR [stderr] at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
12:42:08,206 ERROR [stderr] at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
12:42:08,206 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
12:42:08,206 ERROR [stderr] at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
12:42:08,207 ERROR [stderr] at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
12:42:08,207 ERROR [stderr] at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
12:42:08,208 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
12:42:08,208 ERROR [stderr] at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)
12:42:08,208 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
12:42:08,209 ERROR [stderr] at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
12:42:08,209 ERROR [stderr] at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
12:42:08,209 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
12:42:08,210 ERROR [stderr] at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
12:42:08,210 ERROR [stderr] at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
12:42:08,210 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
12:42:08,211 ERROR [stderr] at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
12:42:08,211 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
12:42:08,212 ERROR [stderr] at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
12:42:08,212 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
12:42:08,212 ERROR [stderr] at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
12:42:08,213 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
12:42:08,213 ERROR [stderr] at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
12:42:08,213 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
12:42:08,214 ERROR [stderr] at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
12:42:08,214 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
12:42:08,215 ERROR [stderr] at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
12:42:08,215 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
12:42:08,216 ERROR [stderr] at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
12:42:08,216 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
12:42:08,217 ERROR [stderr] at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)
12:42:08,217 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
12:42:08,218 ERROR [stderr] at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)
12:42:08,218 ERROR [stderr] at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
12:42:08,219 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
12:42:08,219 ERROR [stderr] at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
12:42:08,219 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
12:42:08,219 ERROR [stderr] at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
12:42:08,220 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
12:42:08,220 ERROR [stderr] at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)
12:42:08,220 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
12:42:08,221 ERROR [stderr] at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
12:42:08,221 ERROR [stderr] at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
12:42:08,222 ERROR [stderr] at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
12:42:08,222 ERROR [stderr] at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)
12:42:08,222 ERROR [stderr] at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
12:42:08,222 ERROR [stderr] at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
12:42:08,223 ERROR [stderr] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
12:42:08,223 ERROR [stderr] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
12:42:08,224 ERROR [stderr] at com.ericsson.tni.web.interceptor.LoginFilter.doFilter(LoginFilter.java:47)
12:42:08,224 ERROR [stderr] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
12:42:08,224 ERROR [stderr] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
12:42:08,224 ERROR [stderr] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
12:42:08,225 ERROR [stderr] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
12:42:08,225 ERROR [stderr] at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
12:42:08,225 ERROR [stderr] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
12:42:08,226 ERROR [stderr] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
12:42:08,226 ERROR [stderr] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
12:42:08,226 ERROR [stderr] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
12:42:08,227 ERROR [stderr] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
12:42:08,227 ERROR [stderr] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
12:42:08,227 ERROR [stderr] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
12:42:08,227 ERROR [stderr] at java.lang.Thread.run(Thread.java:679)
12:42:08,228 ERROR [com.ericsson.tni.action.AuthorizationAction] null
相同的项目在Tomcat 7中运行得很好。
代码段 - &gt;
@Action(TNIBeans.AUTHORIZATION_ACTION)
@Scope(TNIBeans.BEAN_SCOPE)
public class AuthorizationAction extends ActionSupport implements SessionAware,ServletRequestAware {
private InputStream inputStream;
/**
* Logger for this class
*/
private static final Logger logger = Logger
.getLogger(AuthorizationAction.class);
@Autowired
private XStream xstream;
public void logException(String message) {
logger.error(message);
}
public void log(String msg) {
logger.info(msg);
}
HttpServletRequest request = null;
@Autowired
@Qualifier(TNIBeans.EMPLOYEE_SERVICE_IMPL)
private EmployeeService employeeServiceImpl;
@Autowired
@Qualifier(TNIBeans.CODE_SERVICE_IMPL)
private CodeMasterService codeMasterService;
Map<String,Map<String,String>> codeMaster = null;
private String strResult = null;
private static final long serialVersionUID = -8517227229292215672L;
private Map<String, Object> session = null;
private Employee emp = null;
private String userName;
private String password;
private String roles;
private String responseMsg;
public String login () throws Exception {
log("Entered login");
if (logger.isDebugEnabled()) {
logger.debug("execute() - start.....");
}
try {
log("Authentication Started For User : "+userName);
// employeeServiceImpl.authenticate(userName, password);
inputStream = new ByteArrayInputStream("success".getBytes("UTF-8"));
log("Authentication Result : success");
log("Initiating authorisation : "); // This is printed in Console output if u observe (ie, till here the code executed properly)
// It couldn't create instance of "employeeServiceImpl" interface defined above.....
emp = employeeServiceImpl.authorize(userName);
授权功能的另一个代码段 - &gt;
@Override
public Employee authorize(String signum) throws BusinessException {
System.out.println("Hi Tapo..."+signum); // this is not printed in console output if u observe (ie, controller doesn't enter authorize function)
logger.info("authorize : "+signum);
Employee emp = null;
try{
emp = findRoles(signum);
if (WebConstants.adminSignum.equalsIgnoreCase(signum)) {
emp.setSignum(signum);
emp.setName("System Administrator");
emp.setRoles(Role.LnCD_ADMIN);
emp.setRoles(Role.LnCD_DELEGATE);
emp.setRoles(Role.SYS_ADMIN);
}
return emp;
}catch(BusinessException e){
throw new BusinessException(e.getMessage());
}catch(Exception e){
throw new BusinessException(e.getMessage());
}
}
答案 0 :(得分:2)
这些警告仅在devMode(= true)期间可用,如果您不使用Convention插件,一切都应该没问题。
从Struts 2的2.3.1版开始,添加了对JBoss 7的适当支持。
答案 1 :(得分:0)
根据与您的部署文件夹中的jboss server.log
文件相关的控制台输出,您在java.lang.NullPointerException
的{{1}}方法中获得了login
。并且在声明
AuthorizationAction
emp = employeeServiceImpl.authorize(userName);
即employeeServiceImpl
。如果它不是null
,那么我们在日志中看到了null
。没有类似的事发生。
然后"Hi Tapo..."
是通过Spring应用程序上下文初始化的属性。即使不是你在这里发布了employeeServiceImpl
我也假设其中有bean定义。然后它应该注入,再次假设这也有效,因为你说它在Tomcat服务器上运行良好。
因此,只有在bean创建失败时才会发生这种情况。这就是aplicationContext.xml
你不应该阻止的情况。
那一刻我们只知道NullPointerException
bean失败了。我们没有消息来源。你没有发布它。然后我们需要日志文件中的其他异常来查找未创建bean的原因。没得到它。
因此,找到在JBoss 7上的Tomcat 7中部署工作应用程序的唯一方法。发生的事情是,一些集成框架的行为与预期的略有不同。并且它们变成了加载Tomcat下未使用的额外库。这是因为Tomcat中没有JBoss的功能。最后我发现我的资源停止加载,因为JBoss返回带有employeeService
协议的URL。甚至我的应用程序都了解vsf
协议,我需要添加这些协议以使其正常工作。