[JBoss Portal] - Problem when applying layouts and themes to portal
by praveenkumar82
Hi,
I am using jboss-portal-2.6-CR1 bundle which include JBoss Server 4.2 and portal 3.1 or higher. First of all can any body make me know how to add
layouts and themes to the portal. Is Render set required for applying themes and layouts. I learnt that for applying layouts portal-layouts.xml have to
be added in web-inf and in object.xml file the portal theme and layout descriptors need to be set according to theme we are using. After that when it
gave error as theme-basic-lib.tld is not found then I added it into web-inf folder. The file is as below. Also I added portal-layout.tld into
web-inf/theme/ and is as below, the theme phalanx folder I copied into helloworldportal-war folder. The edited helloworld-object.xml is shown below.
After building it into war file and deploying it in JBoss server it is showing the error as shown below.
File : theme-basic-lib.tld (file I got from JBoss portal 2.2.CR1 documentation)
<%@ taglib uri="/WEB-INF/theme/portal-layout.tld" prefix="p" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
html xmlns="http://www.w3.org/1999/xhtml">
head>
title>JBoss Portal: 2.2 early (Industrial)
meta http-equiv="Content-Type" content="text/html;" />
p:theme themeName='phalanx' />
p:headerContent />
/head>
body id="body">
div id="portal-container">
div id="sizer">
div id="expander">
div id="logoName">
table border="0" cellpadding="0" cellspacing="0" id="header-container">
tr>
td align="center" valign="top" id="header">
/tr>
/table>
div id="content-container">
p:region regionName='This-Is-The-Page-Region-To-Query-The-Page'
regionID='This-Is-The-Tag-ID-Attribute-To-Match-The-CSS-Selector'/>
p:region regionName='left' regionID='regionA'/>
p:region regionName='center' regionID='regionB'/>
hr class="cleaner" />
div id="footer-container" class="portal-copyright">Powered by
a class="portal-copyright" href="http://www.jboss.com/products/jbossportal">JBoss Portal
Theme by Novell
/div>
/div>
/div>
/div>
/div>
/body>
/html>
File : portal-layout.tld
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ JBoss, a division of Red Hat ~
~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
~ contributors as indicated by the @authors tag. See the ~
~ copyright.txt in the distribution for a full listing of ~
~ individual contributors. ~
~ ~
~ This is free software; you can redistribute it and/or modify it ~
~ under the terms of the GNU Lesser General Public License as ~
~ published by the Free Software Foundation; either version 2.1 of ~
~ the License, or (at your option) any later version. ~
~ ~
~ This software is distributed in the hope that it will be useful, ~
~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
~ Lesser General Public License for more details. ~
~ ~
~ You should have received a copy of the GNU Lesser General Public ~
~ License along with this software; if not, write to the Free ~
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
taglib
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3c.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
version="2.0">
tlib-version>1.0</tlib-version>
jsp-version>2.0</jsp-version>
short-name></short-name>
uri>http://www.jboss.org/portal
tag>
name>region
tag-class>org.jboss.portal.theme.tag.RegionTagHandler</tag-class>
body-content>empty</body-content>
attribute>
name>orientation
/attribute>
attribute>
name>regionName
/attribute>
attribute>
name>regionID
/attribute>
/tag>
tag>
name>portlet
tag-class>org.jboss.portal.theme.tag.PortletTagHandler</tag-class>
body-content>empty</body-content>
attribute>
name>windowName
/attribute>
/tag>
tag>
name>theme
tag-class>org.jboss.portal.theme.tag.ThemeTagHandler</tag-class>
body-content>empty</body-content>
attribute>
name>themeName
/attribute>
/tag>
tag>
name>headerContent
tag-class>org.jboss.portal.theme.tag.HeaderContentTagHandler</tag-class>
body-content>empty</body-content>
/tag>
/taglib>
FIle : helloworld-object.xml
?xml version="1.0" encoding="UTF-8"?>
deployments>
deployment>
parent-ref/>
if-exists>overwrite</if-exists>
portal>
portal-name>HelloPortal</portal-name>
properties>
!-- Set the layout for the default portal -->
!-- see also portal-layouts.xml -->
property>
name>layout.id
value>phalanx
/property>
!-- Set the theme for the default portal -->
!-- see also portal-themes.xml -->
property>
name>theme.id
value>Nphalanx
/property>
!-- set the default render set name (used by the render tag in layouts) -->
!-- see also portal-renderSet.xml -->
property>
name>theme.renderSetId
value>divRenderer
/property>
!-- set the default strategy name (used by the strategy interceptor) -->
!-- see also portal-strategies.xml -->
property>
name>layout.strategyId
value>maximizedRegion
/property>
/properties>
supported-modes>
mode>view
mode>edit
mode>help
/supported-modes>
supported-window-states>
window-state>normal</window-state>
window-state>minimized</window-state>
window-state>maximized</window-state>
/supported-window-states>
page>
page-name>default</page-name>
properties/>
window>
window-name>MyPortletWindow</window-name>
instance-ref>MyPortletInstance</instance-ref>
region>center
height>0
/window>
window>
window-name>MyPortletWindow1</window-name>
instance-ref>MyPortletInstance1</instance-ref>
region>left
height>0
/window>
security-constraint>
policy-permission>
unchecked/>
action-name>viewrecursive</action-name>
/policy-permission>
/security-constraint>
/page>
security-constraint>
policy-permission>
unchecked/>
action-name>personalizerecursive</action-name>
/policy-permission>
/security-constraint>
/portal>
/deployment>
deployment>
if-exists>overwrite</if-exists>
parent-ref>HelloPortal</parent-ref>
page>
page-name>foobar</page-name>
window>
window-name>MyPortletWindow</window-name>
instance-ref>MyPortletInstance</instance-ref>
region>center
height>0
/window>
security-constraint>
policy-permission>
unchecked/>
action-name>viewrecursive</action-name>
/policy-permission>
/security-constraint>
/page>
/deployment>
/deployments>
ERROR and Stack Trace:
20:06:00,998 INFO [TomcatDeployer] deploy, ctxPath=/helloworldportal, warUrl=.../tmp/deploy/tmp45553helloworldportal-exp.war/
20:06:04,826 ERROR [Digester] Parse Fatal Error at line 1 column 2: The markup in the document preceding the root element must be well-formed.
org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1561)
at org.apache.catalina.startup.TldConfig.tldScanStream(TldConfig.java:514)
at org.apache.catalina.startup.TldConfig.tldScanTld(TldConfig.java:553)
at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:301)
at org.apache.catalina.core.StandardContext.processTlds(StandardContext.java:4302)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4139)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at sun.reflect.GeneratedMethodAccessor284.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.apache.catalina.core.StandardContext.init(StandardContext.java:5052)
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:324)
at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:297)
at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:103)
at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:371)
at org.jboss.web.WebModule.startModule(WebModule.java:83)
at org.jboss.web.WebModule.startService(WebModule.java:61)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
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:324)
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.GeneratedMethodAccessor10.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
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 $Proxy166.start(Unknown Source)
at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
at sun.reflect.GeneratedMethodAccessor264.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
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.integration.jboss.DeployerInterceptor.start(DeployerInterceptor.java:92)
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 $Proxy167.start(Unknown Source)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at sun.reflect.GeneratedMethodAccessor112.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
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$ScannerThread.loop(AbstractDeploymentScanner.java:274)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
20:06:04,935 ERROR [StandardContext] Error reading tld listeners javax.servlet.ServletException: Exception processing TLD at resource path
/WEB-INF/theme-basic-lib.tld in context /helloworldportal
javax.servlet.ServletException: Exception processing TLD at resource path /WEB-INF/theme-basic-lib.tld in context /helloworldportal
at org.apache.catalina.startup.TldConfig.tldScanTld(TldConfig.java:555)
at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:301)
at org.apache.catalina.core.StandardContext.processTlds(StandardContext.java:4302)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4139)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at sun.reflect.GeneratedMethodAccessor284.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.apache.catalina.core.StandardContext.init(StandardContext.java:5052)
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:324)
at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:297)
at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:103)
at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:371)
at org.jboss.web.WebModule.startModule(WebModule.java:83)
at org.jboss.web.WebModule.startService(WebModule.java:61)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
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:324)
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.GeneratedMethodAccessor10.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
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 $Proxy166.start(Unknown Source)
at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
at sun.reflect.GeneratedMethodAccessor264.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
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.integration.jboss.DeployerInterceptor.start(DeployerInterceptor.java:92)
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 $Proxy167.start(Unknown Source)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at sun.reflect.GeneratedMethodAccessor112.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
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$ScannerThread.loop(AbstractDeploymentScanner.java:274)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4109537#4109537
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4109537
16 years, 12 months
[JBoss Seam] - Re: Handling dynamic data in RDBMS (i.e. no direct column ma
by tailor
After some further investigation I'm now able to do what I want. I can now modify multiple rows at once in one transaction.
My SLSB with an added update() method:
@Stateless
| @Name("recordList")
| public class RecordListAction implements RecordList, Serializable {
|
| private static final long serialVersionUID = 1L;
|
| @PersistenceContext
| private EntityManager em;
|
| @In
| private User user;
|
| @DataModel
| private List<DataValue> dataValues;
|
| @In
| private FacesMessages facesMessages;
|
| // needed to prevent spurious warning
| // getResultList() returns a non generic version of List
| @SuppressWarnings("unchecked")
| @Factory("dataValues")
| public void getDataValues() {
| dataValues = em.createQuery(
| "select dv from DataValue dv "
| + "inner join dv.record as record "
| + "inner join dv.dataType as dataType "
| + "where record.user.id = :userId")
| .setParameter("userId", user.getId())
| .getResultList();
| }
|
| @TransactionAttribute
| public void update() {
| for (DataValue dataValue : dataValues) {
| em.merge(dataValue);
| }
| facesMessages.add("Data successfully saved.");
| }
|
| @Remove
| public void destroy() {
| }
| }
My corresponding facelet:
<h:form>
| <rich:panel>
| <f:facet name="header">Edit Data</f:facet>
|
| <ui:repeat var="dataValue" value="#{dataValues}">
|
| <s:decorate id="idDecoration" template="layout/edit.xhtml">
| <ui:define name="label">
| <h:outputText value="#{dataValue.dataType.name}" />
| </ui:define>
|
| <h:inputText value="#{dataValue.value}" />
| </s:decorate>
|
| </ui:repeat>
|
| <div style="clear: both"><span class="required">*</span>
| required fields</div>
| </rich:panel>
|
| <div class="actionButtons"><h:commandButton
| action="#{recordList.update}" value="submit" /></div>
| </h:form>
Everything fine so far, but I'm now stucked at validating entered data. The actual data is stored in the column "value" of the table "data_value". The column "value" is a varchar(255) in MySQL but its validation rules depend on "data_type_id" which references the table "data_type".
To give you an example:
There are 2 entries in "data_type". One is a type for e-mail addresses and one for surnames. This results in different validation rules that have to be applied to the same column in table "data_value".
Again I'm asking for some hints how to do so. Has anyone some suggestions?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4109528#4109528
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4109528
16 years, 12 months
[JBoss Seam] - JPA/Hibernate Entity: broken identity between Entity & Objec
by pierospinelli
Since I've some trouble in extracting a significant frame of code, I'll try to put the question in general terms:
During the same SEAM request to an action (an EJB method), I build a set of entities navigating relations from other entities returned by different queries, expecting the same entity can be navigated more than once.
I expected that, in this case, the same Entity (same class & id) would be even the same Java Object instance (since all the navigations & queries were inside the same request): but in some case I HAVE TWO DIFFERENT OBJECT INSTANCES (both verified to be contained in the same EntityManager) FOR THE SAME ENTITY (same class & id).
I thought it were against the JPA specification, can anyone confirm this?
I am trying to play with the Hibernate properties & with the query hints about cache, but I have had no luck till now.
Does anyone know if the are some specific situations where more objects can represent the same entity inside the same EntityManager and if it exists some method to avoid this?
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4109527#4109527
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4109527
16 years, 12 months