| Author |
Message |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 01/05/2010 16:32:56
|
apl
Padawan
Joined: 08/05/2009 13:22:03
Messages: 94
Offline
|
Hi,
today I tried to update mango from 1.7.0 to 1.8.2. All I got is a errormessage permission denied in localhost.log:
01.05.2010 22:14:18 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
01.05.2010 22:14:23 org.apache.catalina.core.StandardContext listenerStart
SCHWERWIEGEND: Exception sending context initialized event to listener instance of class com.serotonin.mango.MangoContextListener
com.serotonin.ShouldNeverHappenException: java.io.FileNotFoundException: Upgrade1_8_0.log (Permission denied)
at com.serotonin.mango.db.upgrade.DBUpgrade.checkUpgrade(DBUpgrade.java:87)
at com.serotonin.mango.db.DatabaseAccess.initialize(DatabaseAccess.java:135)
at com.serotonin.mango.MangoContextListener.databaseInitialize(MangoContextListener.java:259)
at com.serotonin.mango.MangoContextListener.contextInitialized(MangoContextListener.java:89)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:49
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:593)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.io.FileNotFoundException: Upgrade1_8_0.log (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
at com.serotonin.mango.db.upgrade.Upgrade1_8_0.upgrade(Upgrade1_8_0.java:29)
at com.serotonin.mango.db.upgrade.DBUpgrade.checkUpgrade(DBUpgrade.java:82)
... 27 more
01.05.2010 22:14:23 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
can you prefix it with "${catalania.base}/logs/"?
I dont know if this fixes the problem.
Arne
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 02/05/2010 19:07:35
|
mlohbihler
![[Avatar]](/forum/images/avatar/eccbc87e4b5ce2fe28308fd9f2a7baf3.png)
Joined: 01/03/2007 22:48:52
Messages: 972
Offline
|
I believe the upgrade log gets written to whatever directory Tomcat was started in. I could change this, but it would be a future release. In the meantime, either start from another directory, or provide permissions to the current one.
|
Best regards,
Matthew Lohbihler |
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 04/05/2010 04:48:02
|
apl
Padawan
Joined: 08/05/2009 13:22:03
Messages: 94
Offline
|
For now its OK,
I have some patches, but replacement of ${property} is missing.
Arne
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 04/05/2010 06:07:38
|
apl
Padawan
Joined: 08/05/2009 13:22:03
Messages: 94
Offline
|
Here it is:
Code:
public class Upgrade1_8_0 extends DBUpgrade {
@Override
public void upgrade() throws Exception {
FileOutputStream out = createUpdateLogFileStream("1_8_0");
out.flush();
out.close();
}
and in DBUpgrade add
Code:
protected FileOutputStream createUpdateLogFileStream(String version) throws IOException {
File logDir = new File(org.apache.log4j.helpers.OptionConverter.substVars(Common.getEnvironmentProfile().getString("db.update.log.dir"), System.getProperties()));
File logFile = new File(logDir, String.format("Update%s.log", version));
LOG.info(String.format("Will use Update LogFile %s", logFile.getAbsolutePath()));
FileOutputStream result = null;
if (logDir.isDirectory() && logDir.canWrite()) {
return new FileOutputStream(logFile);
} else {
LOG.fatal(String.format("Cant Create UpdateLogFile %s", logFile.getAbsolutePath()));
throw new RuntimeException(String.format("Cant Create UpdateLogFile %s", logFile.getAbsolutePath()));
}
}
it uses org.apache.log4j.helpers.OptionConverter.substVars to replace any ${property} with the system.Properties!
Feel free to modify it to fit your needs.
Arne
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 04/05/2010 06:08:40
|
apl
Padawan
Joined: 08/05/2009 13:22:03
Messages: 94
Offline
|
Oh,
add the line db.update.log.dir=${catalina.base}/logs/ to env.properties ;-)
Arne
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 04/05/2010 10:33:49
|
mlohbihler
![[Avatar]](/forum/images/avatar/eccbc87e4b5ce2fe28308fd9f2a7baf3.png)
Joined: 01/03/2007 22:48:52
Messages: 972
Offline
|
Does this work for you?
Code:
protected OutputStream createUpdateLogOutputStream(String version) {
String dir = Common.getEnvironmentProfile().getString("db.update.log.dir");
if (dir == null)
dir = "";
dir = StringUtils.replaceMacros(dir, System.getProperties());
File logDir = new File(dir);
File logFile = new File(logDir, "Update" + version + ".log");
LOG.info("Writing upgrade log to " + logFile.getAbsolutePath());
try {
if (logDir.isDirectory() && logDir.canWrite())
return new FileOutputStream(logFile);
}
catch (Exception e) {
LOG.error("Failed to create database upgrade log file.", e);
}
LOG.warn("Failing over to console for printing database upgrade messages");
return System.out;
}
(The "replaceMacros" does the same thing as the log4j method you called.)
|
Best regards,
Matthew Lohbihler |
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 06/05/2010 04:19:04
|
apl
Padawan
Joined: 08/05/2009 13:22:03
Messages: 94
Offline
|
Sorry answering so late,
it looks that the forum does not sent messages on a topic that I created (The alternative getting the message twice or thrice ;_))
Which StringUtils do you mean? (seroutils has Strinutils but the params mismatch)
Arne
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 06/05/2010 09:37:34
|
mlohbihler
![[Avatar]](/forum/images/avatar/eccbc87e4b5ce2fe28308fd9f2a7baf3.png)
Joined: 01/03/2007 22:48:52
Messages: 972
Offline
|
SeroUtils was updated to support. The update will be in the next release. What i meant was that if you wanted to test you could always replace the code with the log4j version.
|
Best regards,
Matthew Lohbihler |
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 06/05/2010 10:58:00
|
apl
Padawan
Joined: 08/05/2009 13:22:03
Messages: 94
Offline
|
Your code with apache works
So I consider this bug is closed.
Arne
|
|
|
 |
|
|