on 11-06-2006 9:22 PM
Hi all, I've being watching and using information found in this forum regarding integration of thrird parties frameworks in SAP Web AS, but I must admit I'm having a hard time trying to find a explanation to the kind of problems we have in our development team regarding Hibernate and Log4J working inside Web AS.
Versions
:Context
:Problem #1
Our first issue is with SAP Logging API, while running as a standalone program we can obtain correctly the name of the file generated (which is later send to a group of users for monitoring purposes) using the following code :
Collection logs = logger.getLogs();
FileLog fileLog = null;
File log = null;
String logFile = null;
Iterator iterator = logs.iterator();
while(iterator.hasNext())
{
fileLog = (FileLog)iterator.next();
log = new File(fileLog.getPath());
logFile= log.getName();
if( logger.beDebug())
{
logger.debugT("Log File Name reported to the Client: "+logFile);
}
break;
}
Let's say the file name created is named
bdidms-be-0002B33DC300006400002A2B00000F680004215B6E2DB6EE.log
using this a propertis file to configure SAP Logging
but when we executed the same code inside the Java Proxy the file written to the disk (let's assume the name) is
bdidms-be-0002B33DC3000065000026A600000F680004215B3789C594.log
but the one reported in the code above shown is
bdidms-be-0002B33DC300006D0000306B00000F68000421994D547148.log
using for the ear the config file log-configuration.xml
then they are completely different file names with different GUIDs so our group of users will never receive the correct file, we already opened an issue with SAP regarding this odd behaviour but to not available so far. Has someone else encountered this kind of problems?
Problem #2
Regarding Hibernate and Log4J (used by the first) it's a complete mistery, the situation is as follow:
1.- We created a Server Library to deploy all hibernate related files to the server in order to avoid duplication of jar.
2.- We did the same with log4j.jar ( deployed as a server library) .
Our first test code was using this code to initializes Log4J and then procede to config Hibernate
PropertyConfigurator.configure("bDIDMSBDIDMS02/log4j.properties"); (1)
Logger log2 = Logger.getLogger("hibernate");
logger.debugT("Creating Hibernate Config Object");
org.hibernate.cfg.Configuraton cfgBdBDI = new org.hibernate.cfg.Configuraton(); // (2)
logger.debugT("Hibernate Config Object created");
cfgBdBDI.configure("com/procedatos/modelo/bdi/bdi.eev.dev.cfg.xml");
HibernateSessionFactory bdBDI = cfgBdBDI.buildSessionFactory();
Where
(1) We are reading the log4j.properties file from the jar of the Java Proxy in order to configure the logging framework
(2) SAP Logging stopped when we reach this line and generated the following exception in the monitoring tool:
Delivery of the message to the application using connection JPR failed, due to: com.sap.aii.af.ra.ms.api.DeliveryException: Error invoking method miIaJpAuditorBtx of proxy bean $Proxy289: null: com.sap.aii.proxy.xiruntime.core.XmlInboundException: Error invoking method miIaJpAuditorBtx of proxy bean $Proxy289: null.
A Null (Pointer Exception?) is generated by Log4J because is not configured and when Hibernate try to init the configuration Object which reviewing the source code of Hibernate has the following declaration
*
* @author Gavin King
* @see org.hibernate.SessionFactory
*/
public class Configuration implements Serializable {
private static Log log = LogFactory.getLog( Configuration.class );
Does anyone can share their expertise in how to configure correctly Hibernate to make it run, we searched several forums PDF both from SAP an non-SAP users, but to not available. I tought of using a SAR file (as I did it with Hibernate9 to my surprise SAP doesn't support creating a JMX Service using simple XML, How can I start Hibernate as a Service , because this would be the prefer way so there will be one initialization and could the Hibernate Session factory could be reuse for future developments.
Apologyze for the lengthly post, but working with SAp support has being kind of slow and not usable.
Thx,
Pedro Taborda
ptaborda@procedatos.com.ve (Biz)
ptaborda@cantv.net (Alt)
1.- While deploying hibernate files in netweaver 2004s there is a file named tssapinfo in the library folder which holds references to each jar file that is inside the sda, if you add , remove o change a setting make sure you can later read that file, there seems a bug where this file gets corrupted and the deployment fails inside the application server
2.- Use a properties file sotre somewhere in the file structure in the application server (fixed location) read from there and configure log4j.
3.- SAP Logging API if it is done using the API and not the log-configuration.xml behaves erratically when you use a file pattern of xxxx-g% , when you request using the Java API to obtain the name of the log filename, a workaroun I use to solve the problem was
is = new FileInputStream( new File(CARPETA_SAP_WEBAS+"
logging.jp.dc.properties") );
prop.load(is);
is.close();
archivoLog = prop.getProperty("log[Appl].pattern");
sb.append(archivoLog);
sb.append("-");
sb.append(feLog.getTime());
sb.append(FILE_LOG_EXT);
archivoLog = sb.toString();
prop.setProperty("log[Appl].pattern",archivoLog);
which allowed me to generated a stable file pattern name and algo obtain the ocrrect name of the log filename.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.