[opencms-dev] exceptions importing a ZIP file into an Oracle DB
Mariano Barcia
mariano.barcia at colaborativa.net
Wed Jan 7 01:34:01 CET 2004
Hi,
Well, we solved the exceptions detailed below, but found more later on.
The exceptions below were caused by a defective manifest.xml generation,
perhaps because the DB repository where the export was made (MySQL) was
not case-sensitive. We corrected the paths in the manifest and in the
folder entries within the zip file, and everything seemed to worked
fine. But, to our surprise, when we tried to see an HTML page, it
complained about not finding its body.
[body] ??? com.opencms.core.CmsException: 2 Not found. Detailed error:
[com.opencms.file.genericSql.CmsDbAccess]
/default/vfs/system/bodies/kdb/customers/es/di/solutions/116273sp.shtml.
The problem is : the "/di/" should have been "/DI/" (upper-case)
When we check the control-code, it is wrong (lower-case instead of
upper-case).
Question is: how can the control code be wrong when the manifest is
right?
Here is the file entries for that HTML page (the first the page, the
second for the body):
1.
<file>
<source>kdb/customers/es/DI/solutions/116273sp.shtml</source>
<destination>kdb/customers/es/DI/solutions/116273sp.shtml</destination>
<type>page</type>
<user>Admin</user>
<group>Administrators</group>
<access>383</access>
<lastmodified>1071568007000</lastmodified>
<properties>
...
</properties>
</file>
2.
<file>
<source>system/bodies/kdb/customers/es/DI/solutions/116273sp.shtml</sour
ce>
<destination>system/bodies/kdb/customers/es/DI/solutions/116273sp.shtml<
/destination>
<type>plain</type>
<user>Admin</user>
<group>Administrators</group>
<access>895</access>
<lastmodified>1071568007000</lastmodified>
<properties/>
</file>
We would appreciate if you can give us a hint on what's happening,
thanks in advance,
--mariano
-----Mensaje original-----
De: opencms-dev-admin at opencms.org [mailto:opencms-dev-admin at opencms.org]
En nombre de Mariano Barcia
Enviado el: Lunes, 22 de Diciembre de 2003 02:11 a.m.
Para: opencms-dev at opencms.org
Asunto: [opencms-dev] exceptions importing a ZIP file into an Oracle DB
Hello all,
We are having a problem importing a large ZIP file of about 130 MBs,
using the "Database management" functionality from the Administration
View. The ZIP file is the result of a MySQL 4 export and we had no
problems importing this file back into another MySQL 4 database, but we
are having problems trying to import it into an Oracle 8.1.7 database.
The import procedure throws exceptions for many of the files being
imported, but many of the files *do* get imported OK.
I detail one stack trace of the exceptions given, as an example:
( 533 / 7951 ) Importing /kdb/customers/es/di/solutions/159353.shtml
Exception com.opencms.core.CmsException: 2 Not found. Detailed error:
[com.opencms.file.genericSql.CmsDbAccess]
/kdb/customers/es/di/solutions/159353sp.shtml.
at
com.opencms.file.genericSql.CmsDbAccess.readFile(CmsDbAccess.java:6092)
at
com.opencms.file.genericSql.CmsResourceBroker.readFile(CmsResourceBroker
.java:5203)
at com.opencms.file.CmsObject.readFile(CmsObject.java:2883)
at
com.opencms.file.CmsResourceTypePage.lockResource(CmsResourceTypePage.ja
va:660)
at
com.opencms.file.CmsResourceTypePage.importResource(CmsResourceTypePage.
java:638)
at com.opencms.file.CmsObject.importResource(CmsObject.java:2140)
at
com.opencms.file.CmsImport.CmsResourceBroker.readFile(CmsImport.java:601
)
at
com.opencms.file.CmsImport.CmsResourceBroker.readFile(CmsImport.java:786
)
at
com.opencms.file.CmsImport.CmsResourceBroker.readFile(CmsImport.java:188
)
at
com.opencms.file.genericSql.CmsResourceBroker.importResources(CmsResourc
eBroker.java:4156)
at com.opencms.file.CmsObject.importResources(CmsObject.java:2167)
And the manifest.xml portion of that file
<file>
<source>kdb/customers/es/di/solutions/159353sp.shtml</source>
<destination>kdb/customers/es/di/solutions/159353sp.shtml</destination>
<type>page</type>
<user>Admin</user>
<group>Administrators</group>
<access>383</access>
<lastmodified>1071568023000</lastmodified>
<properties>
<property>
<name>ProgId</name>
<type>1</type>
<value><![CDATA[FrontPage.Editor.Document]]></value>
</property>
<property>
<name>NavPos</name>
<type>1</type>
<value><![CDATA[61]]></value>
</property>
<property>
<name>NavText</name>
<type>1</type>
<value><![CDATA[Cómo instalar el controlador USB en
el sistema operativo Microsoft(R) Windows(R) Me.]]></value>
</property>
<property>
<name>GENERATOR</name>
<type>1</type>
<value><![CDATA[Microsoft FrontPage 4.0]]></value>
</property>
<property>
<name>Title</name>
<type>1</type>
<value><![CDATA[Cómo instalar el controlador USB en
el sistema operativo Microsoft(R) Windows(R) Me.]]></value>
</property>
</properties>
</file>
It's always the same exception, and always the same (or nearly the same)
manifest data. We have checked the methods, and arrived to the lines
throwing the exceptions:
/**
* Reads a file from the Cms.<BR/>
*
* @param projectId The Id of the project in which the resource will
be used.
* @param onlineProjectId The online projectId of the OpenCms.
* @param filename The complete name of the new file (including
pathinformation).
*
* @return file The read file.
*
* @throws CmsException Throws CmsException if operation was not
succesful
*/
public CmsFile readFile(int projectId,
int onlineProjectId,
String filename)
throws CmsException
(lines 6047-6092)
...
try {
con = DriverManager.getConnection(usedPool);
// if the actual project is the online project read file
header and content
// from the online project
statement =
con.prepareStatement(m_cq.get("C_FILES_READ"+usedStatement));
statement.setString(1, filename);
statement.setInt(2, projectId);
res = statement.executeQuery();
if(res.next()) {
...
} else {
throw new CmsException("["+this.getClass().getName()+"]
"+filename,CmsException.C_NOT_FOUND);
}
...
Maybe, just maybe, there is a difference between importing a ZIP file
while in the ONLINE project? Maybe we did not change to the offline
project before doing the import ... Anyway, the question would still
remain: why some files are imported well?
Thanks for your time,
--mariano
More information about the opencms-dev
mailing list