weld-examples deployment
by Marcin Mieszek
Hi,
I am working currently on issue https://jira.jboss.org/browse/WELD-273
Add GlassFish targets to example POMs
My solution employs glassfish embedded server called from the maven
directly. To deploy to jetty it will be enough to call mvn install
with dedicated profile embedded-glassfish
Please find below the problems I encountered. As I am starting with
the project please excuse me if ther are lame :) I am still learning
how the code is organized and how to use it.
1. Add domain.xml file with glassfich configuration. This file will
contain datasource definition.
Due to severalproblems I gave up with Derby (sample database used from
the login example uses table User which is reserved keyword in Derby +
I found suggestion to switch to HSQL at
http://docs.jboss.org/seam/2.2.1.CR1/reference/en-US/html/glassfish.html
)
2.Adding glassfish specific persistence.xml file with
<jta-data-source> not prefixed with java: (it did not work with
glassfish).
3. I also had following problem with login application:
2010-06-06 01:31:00 org.glassfish.api.ActionReport failure
SEVERE: Exception while loading the app
org.glassfish.deployment.common.DeploymentException: The bean
org.jboss.weld.bean-/D:/weld-examples/jsf/login/target/applications/weld-login/-ManagedBean-class
org.jboss.weld.examples.login.Login declares a passivating scope but
has non-serializable dependency:
org.jboss.weld.bean-/D:/weld-examples/jsf/login/target/applications/weld-login/-ManagedBean-class
org.jboss.weld.examples.login.Credentials
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:183)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:125)
...and marked Credentials application as serializable.
4. I tried to retest login example with Jetty but got problem with
jetty-env.xml file, which was search in wrong location:
Caused by: org.apache.maven.plugin.MojoExecutionException:
jetty-env.xml file does not exist at location
D:\weld-examples\jsf\numberguess\src\main\resources\jetty-env.xml
I added a parameter to jetty plugin:
<jettyEnvXml>${basedir}/src/main/webapp/WEB-INF/jetty-env.xml</jettyEnvXml>
5. After that I still got error:
2010-06-06 01:52:45.322::INFO: seeing JVM BUG(s) - cancelling interestOps==0
2010-06-06 01:52:45.806::WARN: /weld-numberguess/home.jsf
org.jboss.weld.context.ContextNotActiveException: WELD-001303 No
active contexts for scope type @ConversationScoped
at org.jboss.weld.conversation.ConversationImpl.checkConversationActive(ConversationImpl.java:79)
at org.jboss.weld.conversation.ConversationImpl.isTransient(ConversationImpl.java:234)
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 org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:304)
at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:298)
..and did not succeed with jetty deployment.
I will prepare the patch once I have retested all the examples.
Looking forward to feedback from you,
Marcin
13 years, 10 months
beans.xsd validation forbeans.xml
by Marcin Mieszek
Hi,
I am working right now on issue:
Weld WELD-379Use beans.xsd for validation of beans.xml
1. Currently in MergedElements class there is a logic that checks
ifsome elements occur more then once, which is not allowed:
private List<BeansXmlElement> getNamedElement(URL url, Element
beans, String name, XmlMessage multipleViolationMessage)
{
List<BeansXmlElement> elements = new ArrayList<BeansXmlElement>();
NodeList nodeList = beans.getElementsByTagName(name);
if (nodeList.getLength() > 1)
{
throw new WeldXmlException(multipleViolationMessage);
}
else if (nodeList.getLength() == 1)
{
BeansXmlElement element = BeansXmlElement.of(url, nodeList.item(0));
elements.add(element);
}
return elements;
}
Such files arenot valid according to XSD schema neither. I am planning
to add XSD validation during parsing of the file - it means that it
won't be possible to get error with message one of:
@MessageId("001203") MULTIPLE_ALTERNATIVES,
@MessageId("001204") MULTIPLE_DECORATORS,
@MessageId("001205") MULTIPLE_INTERCEPTORS,
Please let me know how you would like to proceed with it as it is more
functional question then technical. For schema errors I will add new
message XSD_SCHEMA_ERROR.
2. Minor issue: all test beans.xml files must be changed after adding
schema validation so that it references correct namespace:
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
I will prepare the patch for this one as well.
Cheers,
Marcin
13 years, 10 months