aspose file tools*
The moose likes Struts and the fly likes Does Struts have a log?  Can't figure out why ActionServlet is not initializing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Does Struts have a log?  Can Watch "Does Struts have a log?  Can New topic
Author

Does Struts have a log? Can't figure out why ActionServlet is not initializing

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Hi,

I'm using Struts 1 with WebLogic 9.2.2 (Java 1.5) on Weblogic 9.2.2. Where does struts log what its doing whiel its initializing? I'm asking because my ActionServlet is failing to load from my WAR file. Here's how I'm loading it in my web.xml file ...

<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

and here's the error I'm getting in my Weblogic server logs ...

####<Mar 6, 2009 8:31:48 AM MST> <Error> <HTTP> <CO183L-4CVY3D1> <my_managed_server_1> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1236353508999> <BEA-101216> <Servlet: "action" failed to preload on startup in Web application: "RoutingEngine.war".
javax.servlet.UnavailableException: ><init>
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:368)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:278)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:507)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1715)
at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1692)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1612)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2750)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:889)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:333)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:26)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:154)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:181)
at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:358)
at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:52)
at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:186)
at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:233)
at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:173)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:89)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)

Any insight is appreciated, - Dave
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8903
    
    8

Is that all there is to the stack trace? No nested exceptions?


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

And have you increased the logging level for the Struts package?
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Yes, sadly this is all that's in the log file. I don't see any nested exceptions further down.

How do I increase the Struts logging? And also, where are its logs written to?

- Dave
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Configure whatever logging package being used to the DEBUG level for Struts packages. For example, log4j would be something like: log4j.logger.org.apache.struts=DEBUG (or something like that; I can never remember off the top of my head).
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
I'm using log4j with my normal application, but how do I tell struts to look at the already existing log4j.properties file? I assume I need to tell it about the path somewhere?

Thanks, - Dave
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Nope, should just be able to configure Log4J.
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Below is the log4j properties file I'm using. I'm placing it in my WEB-INF/classes directory (it's name is RELog.properties). I'm still not sure how struts is going to know to look for "RELog.properties", but if you say so. Anyway, I thought I read something that Struts should just default to standard out if it couldn't find whatever it needs, but that is not happening with my app so far. Below is my file. Thanks for any additional info, - Dave




Log4j configuration file.

log4j.category.RoutingEngineLog=DEBUG, A2
! DO NOT want additivity for this category
log4j.additivity.RoutingEngineLog=false

# Available levels are DEBUG, INFO, WARN, ERROR, FATAL
#
#
# A2 is a DailyRollingFileAppender
#

log4j.appender.A2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A2.file=/opt/log/routing_engine_logs/re.log
log4j.appender.A2.datePattern='.'yyyy-MM-dd
log4j.appender.A2.append=true
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern=%-5p %d{ISO8601} - [%C::%M] - %m%n



log4j.rootLogger=DEBUG, stdout
#=======================================================================
# ConsoleAppender
#=======================================================================

# Configure the stdout appender to go to the console
log4j.appender.stdout=org.apache.log4j.ConsoleAppender

# Configure the stdout appender to use the PatternLayout
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

# Pattern to output the caller's filename and line number
# Type [method] {file:line} - message
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Struts doesn't look for the logging config file, the logging library does.

You should name it "log4j.properties" if you want log4j to pick it up automatically. One of the other forums here is probably better suited to log4j discussions.
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Changing the properties file name to what you suggested (and moving it into the WEB-INF/classes) directory, did generate output to my server standard out file, where I noticed a new error that pointed to an outdated commons-validator file. After including the correct file in my project, I got everything to run.

Thanks for sticking with this. I genuinely appreciate it.

Whew! I would've hated to go into the weekend not knowing the answer to that one. - Dave
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No sweat.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Does Struts have a log? Can't figure out why ActionServlet is not initializing