[JBoss Seam] - PersistenceContext in distributed environment
by hamtho2
Hi,
I want to split up my seam application into 2 different application, so that I can use one JBoss as a webserver and another one as the application-server with the underlyng database. Therefor I use the EntityManager only on the application-server, so that all the updates etc. on the database all go through the same method. Now I experience problems when using my entities and want to use object, that are lazy-loaded.
One example, I have a User-object with a UserLog:
| @Name("user")
| @Scope(ScopeType.SESSION)
| public class User implements Serializable {
| ...
|
| @OneToMany(cascade = CascadeType.ALL, mappedBy = "user", fetch=FetchType.LAZY)
| private Set<UserLog> userLogCollection ;
|
| ...
|
| public Set<UserLog> getUserLogCollection() {
| return this.userLogCollection;
| }
|
| protected void setUserLogCollection(Set<UserLog> userLogCollection) {
| this.userLogCollection = userLogCollection;
| }
|
| public void addUserLog(UserLog userLog) {
| if (this.userLogCollection == null) {
| this.userLogCollection = new HashSet();
| }
| this.userLogCollection.add(userLog);
| }
|
|
When I Login I query the EnitityManager through my application-server and return the user-object.
When I try to add a new UserLog-Object using the methods of my entity object I get a LIE, probably because the user-object is detached:
| 16:45:59,978 ERROR [LazyInitializationException] failed to lazily initialize a collection of role: common.entity.User.userLogCollection, no session or session was closed
| org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: common.entity.User.userLogCollection, no session or session was closed
| at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
| at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
| at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
| at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
| at org.hibernate.collection.PersistentSet.toString(PersistentSet.java:309)
| at java.lang.String.valueOf(String.java:2615)
| at java.lang.StringBuilder.append(StringBuilder.java:116)
|
When I do this through a method on my application-server together with a em.merge, everything works fine, because the entity becomes managed again. But this cannot be the solution, as would have to write a method for every lazy-loaded object on my application-server.
| public User addUserLog(User user, UserLog userLog) {
| User userTmp = (User) em.merge(user);
| userTmp.addUserLog(userLog);
| return userTmp;
| }
|
I tryied to work with the Seam Managed Persistence Context, but as far as I could see in the documentation I have to initialize the EntityManager through the Seam-@In-Annotation, which doesn´t seem very good, if I would like to have seam-independent controller-beans on my application server.
What would be the best solution to work with lazily-loaded objects in a distributed environment? Does anyone have some experiences with that and therefor has a good recommendation?
Thank you very much
Thomas
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4004859#4004859
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4004859
19 years, 3 months
[Installation, Configuration & Deployment] - java.lang.ClassCastException
by hussain_rangwala
hey guys,
i am stuck on this problem for a very long time and need some help....i request the Jboss technical team to please help me on this.......
i am trying to deploy a struts application as a portlet on jboss portal 2.4.0.GA.
However the application gets deployed successfully and i see the portal-page when i access http://localhost:8080/portal.
However when i click on the portal page It gives an error "Object not found SETLInstanceName".
| 2007-01-22 20:25:20,271 DEBUG [org.jboss.portal.portlet.container.PortletContainer] Loading portlet class org.apache.portals.bridges.struts.StrutsPortlet
| 2007-01-22 20:25:20,286 DEBUG [org.jboss.portal.portlet.container.PortletContainer] Creating portlet object org.apache.portals.bridges.struts.StrutsPortlet
| 2007-01-22 20:25:20,302 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=portal:container=Portlet,id=SETLAppName.SETLPortletName state=Create
| org.jboss.portal.portlet.container.PortletInitializationException: The portlet SETLPortletName threw a runtime exception during init at org.jboss.portal.portlet.container.PortletContainer.start(PortletContainer.java:287)
| at org.jboss.portal.portlet.container.PortletContainerAdapter.start(PortletContainerAdapter.java:74)
| at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.joinpoint.plugins.reflect.ReflectMethodJoinPoint.dispatch(ReflectMethodJoinPoint.java:72)
| at org.jboss.kernel.plugins.dependency.KernelControllerContextActions.dispatchJoinPoint(KernelControllerContextActions.java:92)
| at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$LifecycleAction.installAction(KernelControllerContextActions.java:452)
| at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$KernelControllerContextAction.install(KernelControllerContextActions.java:147)
| at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
| at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:226)
| at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:593)
| at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:346)
| at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:438)
| at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:379)
| at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:225)
| at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:151)
| at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:74)
| at org.jboss.portal.portlet.deployment.jboss.PortletAppDeployment.start(PortletAppDeployment.java:232)
| at org.jboss.portal.core.deployment.jboss.PortletAppDeployment.start(PortletAppDeployment.java:79)
| at org.jboss.portal.server.deployment.jboss.PortalDeploymentInfo$DeploymentContext.start(PortalDeploymentInfo.java:211)
| at org.jboss.portal.server.deployment.jboss.ServerDeployer.start(ServerDeployer.java:242)
| at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1007)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:808)
| 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:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy107.deploy(Unknown Source)
| at org.jboss.portal.server.deployment.jboss.ServerDeployer.deploy(ServerDeployer.java:296)
| 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:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy82.deploy(Unknown Source)
| at org.jboss.portal.server.deployment.WebAppAdapter.deploy(WebAppAdapter.java:54)
| at org.jboss.portal.server.deployment.WebAppIntercepter.handleNotification(WebAppIntercepter.java:133)
| at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:153)
| at $Proxy108.handleNotification(Unknown Source)
| at org.jboss.mx.util.JBossNotificationBroadcasterSupport.handleNotification(JBossNotificationBroadcasterSupport.java:127)
| at org.jboss.mx.util.JBossNotificationBroadcasterSupport.sendNotification(JBossNotificationBroadcasterSupport.java:108)
| at org.jboss.deployment.SubDeployerSupport.emitNotification(SubDeployerSupport.java:340)
| at org.jboss.deployment.SubDeployerSupport.start(SubDeployerSupport.java:308)
| at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:482)
| 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:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
| at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
| at org.jboss.ws.server.WebServiceDeployer.start(WebServiceDeployer.java:117)
| at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
| at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy86.start(Unknown Source)
| at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1007)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:808)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:771)
| at sun.reflect.GeneratedMethodAccessor76.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy8.deploy(Unknown Source)
| at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
| at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
| at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
| at $Proxy0.start(Unknown Source)
| at org.jboss.system.ServiceController.start(ServiceController.java:417)
| at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy4.start(Unknown Source)
| at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
| at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1007)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:808)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:771)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:755)
| 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:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy5.deploy(Unknown Source)
| at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
| at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
| at org.jboss.Main.boot(Main.java:200)
| at org.jboss.Main$1.run(Main.java:464)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: java.lang.ClassCastException: org.apache.portals.bridges.struts.StrutsPortlet
| at org.jboss.portal.portlet.container.PortletContainer.start(PortletContainer.java:249)
| ... 147 more
| 2007-01-22 20:25:20,521 DEBUG [org.jboss.portal.core.deployment.jboss.PortletAppDeployment] Looking for the WEB-INF path of SETLAppName
| 2007-01-22 20:25:20,536 DEBUG [org.jboss.deployment.MainDeployer] End deployment start on package: WEB-INF
| 2007-01-22 20:25:20,536 DEBUG [org.jboss.deployment.MainDeployer] Deployed package: file:/D:/JBoss/jboss-portal-2.4.0/server/default/tmp/deploy/tmp52383SETLAppName-exp.war/WEB-INF/
| 2007-01-22 20:25:20,567 DEBUG [org.jboss.deployment.MainDeployer] End deployment start on package: SETLAppName.war
| 2007-01-22 20:25:20,567 DEBUG [org.jboss.deployment.MainDeployer] Deployed package: file:/D:/JBoss/jboss-portal-2.4.0/server/default/deploy/SETLAppName.war
| 2007-01-22 20:25:20,567 DEBUG [org.jboss.deployment.scanner.URLDeploymentScanner] Watch URL for: file:/D:/JBoss/jboss-portal-2.4.0/server/default/deploy/SETLAppName.war -> file:/D:/JBoss/jboss-portal-2.4.0/server/default/deploy/SETLAppName.war
|
below are the deployment descriptors:
1.jboss-app.xml
| <jboss-app>
| <app-name>SETLAppName</app-name>
| </jboss-app>
|
2.jboss-portlet.xml
| <portlet-app>
|
| <portlet>
| <portlet-name>SETLPortletName</portlet-name>
| <!-- Use the specific struts container configuration -->
| <config-name>StrutsPortlet</config-name>
| </portlet>
| </portlet-app>
|
|
3. portlet.xml
| <?xml version="1.0" encoding="UTF-8"?>
| <portlet-app id="SETLAppName" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
| version="1.0">
|
| <portlet id="SETLPortletName">
| <init-param>
| <name>ServletContextProvider</name>
| <value>org.jboss.portal.bridge.JBossServletContextProvider</value>
| </init-param>
| <init-param>
| <name>ViewPage</name>
| <value>/Login.do</value>
| </init-param>
| <init-param>
| <name>HelpPage</name>
| <value>/signIn.do</value>
| </init-param>
| <portlet-name>SETLPortletName</portlet-name>
| <display-name>SETL Display Name</display-name>
| <description>This is the SETLBAAAAAANK</description>
| <portlet-class>org.apache.portals.bridges.struts.StrutsPortlet</portlet-class>
| <expiration-cache>-1</expiration-cache>
| <supports>
| <mime-type>text/html</mime-type>
| <portlet-mode>VIEW</portlet-mode>
| <portlet-mode>HELP</portlet-mode>
| </supports>
| <portlet-info>
| <title>SETL Bank Demo</title>
| <short-title>This is the short title</short-title>
| <keywords>SETL</keywords>
| </portlet-info>
| </portlet>
| </portlet-app>
|
|
4.portlet-instances.xml
| <?xml version="1.0" standalone="yes"?>
|
| <instances>
| <instance>
| <instance-name>SETLInstanceName</instance-name>
| <component-ref>SETLPortletName</component-ref>
| </instance>
| </instances>
|
|
5.SETLAppName-object.xml
| <?xml version="1.0" encoding="UTF-8"?>
| <deployments>
| <deployment>
| <if-exists>overwrite</if-exists>
| <parent-ref>default</parent-ref>
| <page>
| <page-name>SETLAppName</page-name>
| <window>
| <window-name>SETLWindowName</window-name>
| <instance-ref>SETLInstanceName</instance-ref>
| <region>center</region>
| <height>1</height>
| </window>
| </page>
| </deployment>
|
| </deployments>
|
6.SETLAppName-pages.xml
| <pages>
| <portal-name>default</portal-name>
| <page>
| <page-name>SETLStruts</page-name>
| <window>
| <window-name>SETLBankWindowName</window-name>
| <instance-ref>/SETLAppName.SETLPortletName.SETLInstanceName</instance-ref>
| <region>center</region>
| <height>0</height>
| </window>
| </page>
| </pages>
|
Also i am using jdk 1.5..that is placed under the program files
Any ideas and suggestions will be appreciated...please reply as soon as possible
Thanks
Hussain
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4004855#4004855
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4004855
19 years, 3 months
[Persistence, JBoss/CMP, Hibernate, Database] - Many-to-one writes non-existing IDs to the DB occasionally
by swenbarth
Hello,
I have encountered a strange problem.
I'm using JBoss4.0.4GA with EJB3.
I have a global ID scheme for all my "Entity" beans, the IDs are generated by a TableGenerator, and are Longs which start with 100.000 and count upwards.
I have an instance of bean A with a many-to-one relationship to instances of bean B. Recently I got the follwing exception when loading an certain instance of A from the DB:
javax.persistence.EntityNotFoundException: Unable to find {bean B} with id 87005
Which is pefectly sane, because there is no bean B with this ID (I checked in the DB). But I also found in the DB that in the row for bean A, in the column where B's Id should be found, there was indeed the value '87005'. That ID can never have existed before, because as I said, they started with 100.000 and count upwards.
Does anyone have an explanation for that behaviour? Why was this impossible ID ever written to the DB?
It is not reproducable, I have many rows in the table for bean A where the relationship to B is just fine. This occured for only 6 of about 6000 beans of type A.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4004853#4004853
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4004853
19 years, 3 months
[Beginners Corner] - Logging question (repository selector with local and global
by marcus.klein
Hi,
I have a question regarding logging with log4j. I used the example repositoryselector.zip (http://wiki.jboss.org/wiki/Wiki.jsp?page=Logging) from the Wiki Knowledge Base to enable logging on a per-webapp basis, i.e. now I can use a log4j.xml file for each deployment I have. This works fine so far. The problem I have now is that all logging messages are written to the appenders I specified in those 'local' log4j.xml file. How would I be able to specify that only some logging messages are written to the 'local' logging-file while others are still written, say, to the server.log? Is there a way to access the 'global' specified appender "FILE" from the JBoss\conf\log4j.xml file?
To make it a bit more precise, say, I have two classes A and B deployed as mydeployment application. Within the log4j.xml file below mydeployment I would like to specify that logging msgs from class A are written to a 'local' log-file (say classA.log), while logging messages from class B are written to the server.log (the server.log that is specified in JBoss\conf\log4j.xml). The example in repositoryselector.zip shows me only how to log either all msgs to server.log or to the 'local' specified log-file. Please note that the logging messages should appear only once, i.e. either in the server.log file xor in the 'local' log-file. Is there a way to do this by configuration, or will I need to change the repository selector implementation? Anyway a detailed answer would be appreciated.
Thank you very much for your time and help.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4004846#4004846
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4004846
19 years, 3 months