[JNDI and Naming] - Can't find JNDI datasource
by zxcvzxcv poiuyu
zxcvzxcv poiuyu [http://community.jboss.org/people/qwertqwert] created the discussion
"Can't find JNDI datasource"
To view the discussion, visit: http://community.jboss.org/message/593673#593673
--------------------------------------------------------------
Dear all
I defin a datasource in the JBoss 4.2.3
The configure as below
jboss-web.xml
<jboss-web>
<resource-ref>
<res-ref-name>MyDB</res-ref-name>
<jndi-name>java:/db</jndi-name>
</resource-ref>
</jboss-web>
web.xml
<resource-ref>
<res-ref-name>MyDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
oracle-ds.xml
<datasources>
<local-tx-datasource>
<jndi-name>db</jndi-name>
<connection-url>jdbc:oracle:thin:@localhost:1521:TESTDB</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>user</user-name>
<password>user123</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
In my hibernate.cfg.xml
<property name="hibernate.connection.datasource">MyDB</property>
But I can't find the jndi datasource.
If I use the following configure, it works fine.
<property name="hibernate.connection.datasource">java:comp/env/MyDB</property>
Are there any solution that I just only use MyDB instead of java:comp/env/MyDB?
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/593673#593673]
Start a new discussion in JNDI and Naming at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years
[jBPM] - java.lang.NullPointerException
by frh10 ff
frh10 ff [http://community.jboss.org/people/frh10] created the discussion
"java.lang.NullPointerException"
To view the discussion, visit: http://community.jboss.org/message/593654#593654
--------------------------------------------------------------
Hi !
I use jbpm4.4 in my project,now i have deployed a ProcessDefinition ,when i complete design my task's form,i want to add this form to jbpm's lob ,here is my codes:
DeploymentImpl di =(DeploymentImpl)this.repositoryService.createDeploymentQuery().deploymentId(deploymentId).uniqueResult();
di.addResourceFromString("start.html", "<html>.......</html>").deploy();
it throw this error:
java.lang.NullPointerException
at org.jbpm.pvm.internal.repository.DeploymentImpl.deploy(DeploymentImpl.java:90)
at com.victop.workflow.core.WFServiceImpl.addFormHtml(WFServiceImpl.java:357)
at com.victop.core.formservice.impl.Form6004.save(Form6004.java:172)
at com.victop.core.action.ShowWebpageAction.save(ShowWebpageAction.java:79)
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:597)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.victop.core.interceptor.AuthenticationInterceptor.intercept(AuthenticationInterceptor.java:53)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
I want to know , can jbpm4.4 add a form source with a deployed ProcessDefinition's deploymentId,or how can i add my form source to jbpm's lob table? Thanks.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/593654#593654]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years
Null class exception
by Mansour Al Akeel
Hello,
I have an ejb jar created with maven, and included in an EAR file. The EJB
jar is very simple, just one DAO class. When I deploy the EAR I get this:
00:50:26,984 INFO [org.jboss.ejb3.deployers.Ejb3DependenciesDeployer]
Encountered deployment
AbstractVFSDeploymentContext@681086685{vfs:///opt/Programs/jboss-6.0.0.Final/server/default/deploy/intracore.ear/addblox-impl-1.0-SNAPSHOT.jar/}
00:50:27,040 WARN [org.jboss.ejb3.interceptor.InterceptorInfoRepository]
EJBTHREE-1852: InterceptorInfoRepository is
deprecated
00:50:27,254 WARN [org.jboss.ejb3.interceptor.InterceptorInfoRepository]
EJBTHREE-1852: InterceptorInfoRepository is
deprecated
00:50:27,261 WARN [org.jboss.ejb3.Ejb3AnnotationHandler] JBMETA-4: did not
find any bean meta data for annotation bean UserService, will create
some
00:50:27,711 ERROR
[org.jboss.weld.integration.instantiator.RedirectingBeanInstantiatorDeployer]
Error during undeploy:
vfs:///opt/Programs/jboss-6.0.0.Final/server/default/deploy/intracore.ear/addblox-impl-1.0-SNAPSHOT.jar/:
java.lang.IllegalStateException: Not installed:
org.jboss.ejb.bean.instantiator/intracore/addblox-impl-1.0-SNAPSHOT/UserService
at
org.jboss.dependency.plugins.AbstractController.uninstall(AbstractController.java:790)
[jboss-dependency.jar:2.2.0.GA]
at
org.jboss.dependency.plugins.AbstractController.uninstall(AbstractController.java:669)
[jboss-dependency.jar:2.2.0.GA]
I looked around and found few bugs with work around
http://community.jboss.org/thread/160334
However the MANIFEST.MF file contains no MAIN-CLASS: at all.
Any advice ? It's a bit urgent.
Thank you.
15 years
[JBoss Messaging] - Unable to publish after remote JBoss JMS restart
by Carl Schmidt
Carl Schmidt [http://community.jboss.org/people/cschmidt001] created the discussion
"Unable to publish after remote JBoss JMS restart"
To view the discussion, visit: http://community.jboss.org/message/593617#593617
--------------------------------------------------------------
Hello all,
I've been searching quite a bit for a solution to this problem, and would appreciate any assistance, TIA. I have a local durable MDB consuming messages from a local topic, then publishing them to a topic on a remote jboss messaging instance.
If I shut down the remote jboss instance, I get the expected warning in the local jboss logs:
011-03-16 21:55:18,774 TRACE [org.jboss.jms.server.endpoint.ServerSessionEndpoint] (WorkManager(2)-4) SessionEndpoint[rc-kpow0dlg-1-zw6v0dlg-tyrpht-04v2gs4] acknowledging transactionally 1 messages for TX(21304556237193217):ACTIVE
2011-03-16 22:00:35,518 WARN [org.jboss.resource.adapter.jms.JmsManagedConnection] (Thread-38) Handling jms exception failure: org.jboss.resource.adapter.jms.JmsManagedConnection@1f6d10f
javax.jms.JMSException: Failure on underlying remoting connection
at org.jboss.jms.client.remoting.ConsolidatedRemotingConnectionListener.handleConnectionException(ConsolidatedRemotingConnectionListener.java:102)
at org.jboss.remoting.ConnectionValidator$1.run(ConnectionValidator.java:744)
Attempting to publish messages to the remote topic throws the following exception after each retry:
2011-03-16 22:01:53,985 ERROR [org.jboss.messaging.util.ExceptionUtil] (WorkManager(2)-5) SessionEndpoint[wd-9u4b1dlg-1-zw6v0dlg-tyrpht-04v2gs4] createTopic [yd-9u4b1dlg-1-zw6v0dlg-tyrpht-04v2gs4]
javax.jms.JMSException: There is no administratively defined topic with name:pendingBatching
at org.jboss.jms.server.endpoint.ServerSessionEndpoint.createTopic(ServerSessionEndpoint.java:323)
at org.jboss.jms.server.endpoint.advised.SessionAdvised.org$jboss$jms$server$endpoint$advised$SessionAdvised$createTopic$aop(SessionAdvised.java:110)
at org.jboss.jms.server.endpoint.advised.SessionAdvised$createTopic_N1144803973659535745.invokeTarget(SessionAdvised$createTopic_N1144803973659535745.java)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)
at org.jboss.jms.server.container.ServerLogInterceptor.invoke(ServerLogInterceptor.java:105)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.jms.server.endpoint.advised.SessionAdvised.createTopic(SessionAdvised.java)
at org.jboss.jms.wireformat.SessionCreateTopicRequest.serverInvoke(SessionCreateTopicRequest.java:74)
at org.jboss.jms.server.remoting.JMSServerInvocationHandler.invoke(JMSServerInvocationHandler.java:143)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)
at org.jboss.remoting.transport.local.LocalClientInvoker.invoke(LocalClientInvoker.java:106)
at org.jboss.remoting.Client.invoke(Client.java:1724)
at org.jboss.remoting.Client.invoke(Client.java:629)
at org.jboss.remoting.Client.invoke(Client.java:617)
at org.jboss.jms.client.delegate.DelegateSupport.doInvoke(DelegateSupport.java:189)
at org.jboss.jms.client.delegate.DelegateSupport.doInvoke(DelegateSupport.java:160)
at org.jboss.jms.client.delegate.ClientSessionDelegate.org$jboss$jms$client$delegate$ClientSessionDelegate$createTopic$aop(ClientSessionDelegate.java:353)
at org.jboss.jms.client.delegate.ClientSessionDelegate$createTopic_N1144803973659535745.invokeTarget(ClientSessionDelegate$createTopic_N1144803973659535745.java)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)
at org.jboss.jms.client.container.FailoverValveInterceptor.invoke(FailoverValveInterceptor.java:92)
at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:86)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170)
at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:86)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.jms.client.delegate.ClientSessionDelegate.createTopic(ClientSessionDelegate.java)
at org.jboss.jms.client.JBossSession.createTopic(JBossSession.java:260)
at org.jboss.resource.adapter.jms.JmsSession.createTopic(JmsSession.java:334)
at com.companyName.appName.service.mdb.OutboundOrderListener.onMessage(OutboundOrderListener.java:35)
But once I restart the remote jboss instance, I _still_ get the above exception each time the local MDB tries to publish to the remote topic. Additional details follow:
JBoss 5.1.0
Jboss Messaging 1.4.3
jms-ds.xml
<tx-connection-factory>
<jndi-name>XADefaultJMSProviderremoteJboss</jndi-name>
<xa-transaction/>
<rar-name>jms-ra.rar</rar-name>
<connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
<config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
<config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/remoteJbossJMS</config-property>
<max-pool-size>1</max-pool-size>
<depends>jboss.messaging:service=ServerPeer</depends>
</tx-connection-factory>
<mbean code="org.jboss.jms.jndi.JMSProviderLoader"
name="jboss.messaging:service=JMSProviderLoader,name=remoteJbossJMS">
<attribute name="ProviderName">remoteJbossJMS</attribute>
<attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
<attribute name="FactoryRef">java:/XAConnectionFactory</attribute>
<attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>
<attribute name="TopicFactoryRef">java:/XAConnectionFactory</attribute>
<attribute name="Properties">
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jnp.interfaces
java.naming.provider.url=jnp://foo.dev.remoteJboss.companyName-inc.com:1099
</attribute>
</mbean>
The mdb:
package com.companyName.appName.service.mdb;
import javax.annotation.Resource;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.Topic;
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "subscriptionName", propertyValue = "OutboundOrderListenerSubscription"),
@ActivationConfigProperty(propertyName = "clientId", propertyValue = "OutboundOrderListener"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "topic/orderBatchesBoundForOS"),
@ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable"),
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge") })
public class OutboundOrderListener implements MessageListener{
@Resource(mappedName = "java:XADefaultJMSProviderremoteJboss")
private ConnectionFactory connectionFactory;
@Override
public void onMessage(Message message) {
Connection connection = null;
boolean sendOrderException = false;
try {
connection = connectionFactory.createConnection();
Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
Topic topic = session.createTopic("pendingBatching");
MessageProducer publisher = session.createProducer(topic);
publisher.send(message);
} catch (JMSException e) {
sendOrderException = true;
// re-throw as run time exception because it indicates an
// unrecoverable error
throw new RuntimeException(e);
} finally {
try {
if (connection != null) {
connection.close();
}
} catch (JMSException e) {
if (!sendOrderException) {
// re-throw as run time exception only if sending message
// didn't cause one
throw new RuntimeException(e);
}
}
}
}
}
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/593617#593617]
Start a new discussion in JBoss Messaging at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years
[JBoss Tools] - JBoss Tools 3.2.0.GA JSF2 Composite Components Features
by Denis Golovin
Denis Golovin [http://community.jboss.org/people/dgolovin] modified the document:
"JBoss Tools 3.2.0.GA JSF2 Composite Components Features"
To view the document, visit: http://community.jboss.org/docs/DOC-16511
--------------------------------------------------------------
JBoss Tools introduced JSF 2 Composite Component support in version 3.2.0.M1, it matured through several development versions and got a lot of useful features like:
1. Content assist for component developers
2. Content assist for component users
3. Validation and quick fixes
4. Refactoring
5. Rendering in Visual Editor
6. Source Navigation* in text editor by Ctrl+Right Mouse Button Click on hyperlink
* in visual part by Double Mouse Click
h2. Prerequisites
To check this out lets start from New JSF Project wizard and follow simple steps. Select +"Find JBoss Tools Web -> JSF -> JSF Project"+ in New Dialog (see screenshot below)
http://community.jboss.org/servlet/JiveServlet/showImage/11402/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11402/399-35...
Then fill "Create JSF Project" step with name and select "JSF 2.0" in "JSF Environment"
http://community.jboss.org/servlet/JiveServlet/showImage/11403/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11403/400-32...
On last step select Runtime Servlet Container and server to deploy your application to. Runtime is required, if you don't have one just create new.
http://community.jboss.org/servlet/JiveServlet/showImage/11404/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11404/400-32...
After Finish button's pressed new project appears in navigator. Its structure is shown below and it is reincarnation of JSF 1.2 KickStart project which is implemented using JSF 2 Composite Components.
http://community.jboss.org/servlet/JiveServlet/showImage/11405/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11405/398-54...
At runtime it should look in your browser like this
http://community.jboss.org/servlet/JiveServlet/showImage/11407/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11407/420-21...
Lets see what features JBoss Tools provides for JSF 2 Composite Components.
h2. Rendering in Visual Editor
Visual Editor discovers composite components and it is able to render them. inputname.xhtml opened in xhtml editor looks almost the same (see picture below) as at runtime (see picture above)
http://community.jboss.org/servlet/JiveServlet/showImage/11419/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11419/600-65...
greeting.xhtm does not use composite component to render greeting and this article is going to show how to do this using JBoss Tools features for composite components. We're going to replace greeting text rendering form greeting.xhtml with new demo:greeting component, which takes +demo.User+ instance as attribute and render greeting the same way greeting.xhtml does.
h2. Composite Component Wizard
First, new composite component should be created using JBoss Tools XHTML New Wizard. Picture below show how to call XHTML New Wizard from Web Development Perspective.
http://community.jboss.org/servlet/JiveServlet/showImage/11408/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11408/600-43...
Then in first step input component name as as shown below.
http://community.jboss.org/servlet/JiveServlet/showImage/11409/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11409/400-41...
Select Use XHTL Template checkbox and JSF Composite Component from template list.
http://community.jboss.org/servlet/JiveServlet/showImage/11410/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11410/400-41...
h2. Content Assist
After finishing in opened editor composite:interface and composite:implementation elements should be filed with template attributes and template content. Short description can be provided for composite:interface through shortDescription attribute, but is not used now by JBoss Tools.
http://community.jboss.org/servlet/JiveServlet/showImage/11411/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11411/599-31...
We are creating component to show greeting message for user, so we need to add attribute "user" to pass it to component. Content assist provides proposal list for all composite:interface children nodes. It also shows documentation in documentation hover for selected proposal.
http://community.jboss.org/servlet/JiveServlet/showImage/11412/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11412/600-34...
Inserted attribute has cursor located inside quotation marks and that lets to type attribute name as "user" right after proposal is inserted.
http://community.jboss.org/servlet/JiveServlet/showImage/11413/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11413/screen...
Text editor provides content assist with help for attributes inside tags from composite component namespace.
http://community.jboss.org/servlet/JiveServlet/showImage/11421/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11421/screen...
Using this content assist it is easy to mark new greeting component attribute "user" as required and provide short description for it. For most attributes there are predefined values available through content assist like it is shown below for "required" attribute.
http://community.jboss.org/servlet/JiveServlet/showImage/11422/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11422/screen...
After we're done with component's attribute definition it should look like this
http://community.jboss.org/servlet/JiveServlet/showImage/11414/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11414/597-82...
Implementation for greeting component is going to be simple, it looks almost the same as body definition in greeting.xhtml page. The diffrence is in using cc.attr to reference user attribute.
#{megs.greeting} #{cc.attrs.user.name}!
Finished component in resources/demo/greeting.xhtml should look like it is shown below
http://community.jboss.org/servlet/JiveServlet/showImage/11423/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11423/screen...
Full text for greeting component is here:
<!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"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<head>
<title>Not present in rendered output</title>
</head>
<body>
<composite:interface>
<composite:attribute name="user" required=""/>
</composite:interface>
<composite:implementation>
#{megs.greeting} #{cc.attrs.user.name}!
</composite:implementation>
</body>
</html>
To use new greeting component in greeting.xhtml page root html element should be extended with demo composite component namespace. Add namespace *xmlns:ez=" http://java.sun.com/jsf/composite/demo http://java.sun.com/jsf/composite/demo"* after xmlns:f namespce and save the file or new component is not going to be visible for content assist. After removing content of <ui:define name="body"> request content assist by Ctrl+Space and content assist proposal list with components from resources/demo directory appears.
http://community.jboss.org/servlet/JiveServlet/showImage/11415/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11415/screen...
Select ez:greeting completion proposal and it inserts composite component tag with all required attributes, for greeting component we've defined above it is going to be only user attribute
http://community.jboss.org/servlet/JiveServlet/showImage/11416/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11416/screen...
If optional attribute should be set use content assist for composite component attributes. For example for greeting component. which has only one attribute, content assist would look like
http://community.jboss.org/servlet/JiveServlet/showImage/11417/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11417/600-29...
and it contains attributes with documentation hover filled with shortDescription text.
h2. Validation
JSF 2 Composite Components validator checks correctness of namespace declaration for component and each component from declared namespace. If *demo* component from examples above is renamed to *demos* like it is done on screenshot below
http://community.jboss.org/servlet/JiveServlet/showImage/102-16511-1-1139... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-16511-1-...
then two warning markers are created for new file after it is saved.
http://community.jboss.org/servlet/JiveServlet/showImage/102-16511-1-1139... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-16511-1-...
Marker for namespace declaration provides Quick Fix to create a missing folder. If it is selected, demos folder is created in JSF 2 resources folder.
http://community.jboss.org/servlet/JiveServlet/showImage/102-16511-1-1140... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-16511-1-...
Marker for component from missing namespace also provides Quick Fix, which suggests to create component XHTML file.
http://community.jboss.org/servlet/JiveServlet/showImage/102-16511-1-1140... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-16511-1-...
If Quick Fix for missing component is selected it reconstructs JSF 2 Composite Component based on tag name and attributes. It leaves implementation part of the component empty
http://community.jboss.org/servlet/JiveServlet/showImage/11418/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11418/screen...
h2. Refactoring
Refactoring supported for renaming folders referenced in composite component URI and for renaming component XHTML files.
Lets imagine WebContent/resources/demo folder from our project is going to be renamed through Rename action in Package Explorer view. After new folder name is entered, Preview button is going to be activated and it shows that renaming of *demo* folder affects composite component URI in inputname.xhtml page.
http://community.jboss.org/servlet/JiveServlet/showImage/11434/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11434/screen...
For renaming actual component's xhtml files it suggests to update component names in affected files. On screenshot below it shows what happens when input.xhtml component is renamed in demo folder
http://community.jboss.org/servlet/JiveServlet/showImage/11435/screenshot... http://community.jboss.org/servlet/JiveServlet/downloadImage/11435/screen...
--------------------------------------------------------------
Comment by going to Community
[http://community.jboss.org/docs/DOC-16511]
Create a new document in JBoss Tools at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&co...]
15 years