adding or initializing log4j tag library to Portal 6.2
Hello again,
I am now trying to add and initialize if needed the log4j tag library taglibs-log.tld and taglibs-log.jar to my implementation of portal 6.2 to log an action from a JspProvider for auditing purposes.
I placed the tag library in the tld directory of my portal desktop. I have tried placing the .jar file in two locations. One in a WEB-INF heirarchy in my portal desktop directory and the other location where all th other lib files are in the <PortalServerInstallDir>/web-src/WEB-INF/lib I have placed my properties files in the class directories in both locations also. I am defining the tld location in my jsp and I am loading the jar file in the desktop.properties file classpath. I am getting the following exception:
08/02/2005 12:54:42:008 AM EDT: Thread[service-j2ee-3,5,main]
ERROR: DesktopServlet.handleException()
com.sun.portal.providers.ProviderException: JSPProvider.processJSPFile(): jsp=subscribe.jsp, com.sun.portal.providers.jsp.jasper3.jasper.compiler.CompileException: /C:/Sun/jstudio_04Q4/PortalServer6.2/config/desktop/mqportal/SubscribeJSP/subsc ribe.jsp(118,0) Unable to load class org.apache.taglibs.log.InfoTag
Any help would be appreciated!
[1235 byte] By [
Erly-Dev] at [2007-11-25 19:47:18]

# 1
Did you redeploy after placing the lib in the WEB-INF/lib directory?This directory is just the source for the files, during the deploy process they are copied to the actual lib dir...hth Chris
# 2
Thanks for your reponse. Which WEB-INF location should I place these files in? The large with everything or the one I created in my portal desktop directory? Are all of the other file locations correct?Thanks
# 3
I have tried the redeploy command as well as restarting the servers. I am still getting the same error. That is weird because I was able to get the JavaMail API working simply by copying that jar file to the web-src/WEB-INF/lib directory and adding it to the classpath for the server in desktop.properties. The dirrerence here is that we are using a taglib and we are using a properties file. I am stumped.
# 5
I dont understand the exception you get, did you really deploy your stuff to the portal or start it from the studio only?
I dont have any experience with the studio, so I cannot say anything for this case.
Try the following? (assuming default locations)
Copy the tld file to
/opt/SUNWps/web-src/WEB-INF/
Copy the jar file to:
/opt/SUNWps/web-src/WEB-INF/lib
Do:
/opt/SUNWps/bin/deploy redeploy
Check if the files are where they should be after a deploy:
In case of appserver:
/var/opt/SUNWappserver/domains/yourdomain/applications/j2ee-modules/portal/WEB- INF
In case of webserver:
/var/opt/SUNWps/htts-yourserver/portal/WEB-INF
Does this work and if not, what error does it produce?
Chris
# 6
Thanks for your reply!
No I am not using studio to deploy. I am doing the deploy command on the command line: deploy redeploy --deploy_admin_password password --instance portal_instance I have also tried it with and without the instance option. It runs the command and does not give any errors.
I am on a windows platform (XP Professional) so to make sure that we are on the same page regarding paths, I have placed the tld in the <portal-install-directory>/web-src/WEB-INF/ , the properties file under a /classes directory under that same path and the two jar files, taglibs-log.jar and log4j-1.2.7.jar under the /lib directory under that path.I have also placed both of those jar files in the jsp compiler path in desktop.properties.
My installation is using the web server, but looking in the corresponding path that you have indicated I don't see a WEB-INF directory at all. Any guess to an alternate location?
In the jsp I have placed the entry <%@ taglib uri="/WEB-INF/taglibs-log.tld" prefix="log4j" %>
The error it is giving me is a different one if I remove the jar files. Then it can't find the class and the exception notes that. The error I get now states that it can't load the tag. This may be related to the properties file not being read, which means that log4j is not getting initialized at all, or some other disconnect. Perhaps someone could verify exactly how I get SUN Portal to recognize a properties file, is there a log entry that gets updated when it reads one? Is the location I am putting it in the correct one?
Here is a copy of my properties file.
# Sample properties to initialise log4j
log4j.rootCategory=info, Subscribe
log4j.appender.Subscribe=org.apache.log4j.RollingFileAppender
log4j.appender.Subscribe.File=/var/opt/SUNWam/debug/subscriptions.log
log4j.appender.Subscribe.MaxFileSize=100KB
# Keep one backup file
log4j.appender.Subscribe.MaxBackupIndex=2
log4j.appender.Subscribe.layout=org.apache.log4j.PatternLayout
log4j.appender.Subscribe.layout.ConversionPattern=%p %t %c - %m%n
Here is the tag I am using to log my message:
<log4j:info category="Subscribe" message="Testing the functionality" />
Other app servers specify a properties file be loaded as a start up parameter. Is this neccessary and if so, where do I specify this?
Thanks all for your input....
# 7
I got it to work. It appeared that a variation on what you recommended CRabel, got it to work. First of all, There are about 4 or 5 directories in the windows installation that have the WEB-INF format with the portal libraries in them.
Previously I installed the JavaMail Api jar file in the <Portal Installation>\web-src\WEB-INF\lib path and it worked.
To get this to work I had to install the libraries to <Portal Installation>\tmp\deploy\web-apps\https-serverinstance\portal\WEB-INF\lib directory, and my properties file to the classes directory
I also had to install the tag library in the desktop\default\tld directory instead of in WEB-INF for my jsp to find it. Just putting it in the previous WEB-INF directory as suggested did not work.