If i put the configuration of the interceptor inside struts.xml i've
no error message, but when i recall the ejb.method() i've a
nullPointException
java.lang.NullPointerException
example.HelloWorld.execute(HelloWorld.java:44)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440)
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:128)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
On Wed, Apr 15, 2009 at 13:52, Stefano Tranquillini
<[email protected]> wrote:
> Hi,
> i've done this:
>
> web.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app version="2.5" 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/web-app_2_5.xsd">
> <filter>
> <filter-name>struts2</filter-name>
>
> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
> </filter>
> <filter-mapping>
> <filter-name>struts2</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>struts2</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
> <listener>
>
> <listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
> </listener>
> <session-config>
> <session-timeout>
> 30
> </session-timeout>
> </session-config>
> <welcome-file-list>
> <welcome-file>index.jsp</welcome-file>
> </welcome-file-list>
> <interceptors>
> <interceptor
> class="com.opensymphony.xwork2.ejb3plugin.InjectEJBInterceptor"
> name="ejb3"/>
> <interceptor-stack name="new.stack">
> <interceptor-ref name="ejb3"/>
> <interceptor-ref name="defaultStack"/>
> </interceptor-stack>
> </interceptors>
> <default-interceptor-ref name="new.stack"/>
> </web-app>
>
> action:
> package example;
>
> import com.opensymphony.xwork2.ActionSupport;
> import com.opensymphony.xwork2.ejb3plugin.InjectEJB;
> import java.util.logging.Level;
> import java.util.logging.Logger;
> import javax.naming.Context;
> import javax.naming.InitialContext;
> import javax.naming.NamingException;
> import session.ShopCartLocal;
>
>
> /**
> * <code>Set welcome message.</code>
> */
> public class HelloWorld extends ActionSupport {
>
> @InjectEJB(name="ShopCartBean")
> private ShopCartLocal scl;
>
> public String execute() throws Exception {
> System.out.println("" + scl.enableShopping("ste", "123"));
> setMessage(getText(MESSAGE));
> return SUCCESS;
> }
> /**
> * Provide default valuie for Message property.
> */
> public static final String MESSAGE = "HelloWorld.message";
> /**
> * Field for Message property.
> */
> private String message;
>
> /**
> * Return Message property.
> *
> * @return Message property
> */
> public String getMessage() {
> return message;
> }
>
> /**
> * Set Message property.
> *
> * @param message Text to display on HelloWorld page.
> */
> public void setMessage(String message) {
> this.message = message;
> }
>
> }
>
> i've this error:
>
> 2009-04-15 13:49:28,500 DEBUG
> [org.jboss.deployment.WebAppParsingDeployer] (HDScanner) Error during
> deploy:
> vfszip:/C:/Documents%20and%20Settings/Stefano/Documenti/Uni/Corrente/WebArchitectures/jboss-5.0.0.GA/server/default/deploy/WAP-Shop.ear/WAP-Shop-war.war
> org.jboss.deployers.spi.DeploymentException: Error creating managed
> object for
> vfszip:/C:/Documents%20and%20Settings/Stefano/Documenti/Uni/Corrente/WebArchitectures/jboss-5.0.0.GA/server/default/deploy/WAP-Shop.ear/WAP-Shop-war.war
> at
> org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
> at
> org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:337)
> at
> org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:297)
> at
> org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:269)
> at
> org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.deploy(AbstractParsingDeployerWithOutput.java:230)
> at
> org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
> at
> org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
> at
> org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
> at
> org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
> at
> org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
> at
> org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
> at
> org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
> at
> org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
> at
> org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
> at
> org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
> at
> org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
> at
> org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
> at
> org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
> at
> org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:545)
> at
> org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:290)
> at
> org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:221)
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at
> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
> at java.lang.Thread.run(Thread.java:619)
> Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse
> source: cvc-complex-type.2.4.a: Invalid content was found starting
> with element 'interceptors'. One of
> '{"http://java.sun.com/xml/ns/javaee":description,
> "http://java.sun.com/xml/ns/javaee":display-name,
> "http://java.sun.com/xml/ns/javaee":icon,
> "http://java.sun.com/xml/ns/javaee":distributable,
> "http://java.sun.com/xml/ns/javaee":context-param,
> "http://java.sun.com/xml/ns/javaee":filter,
> "http://java.sun.com/xml/ns/javaee":filter-mapping,
> "http://java.sun.com/xml/ns/javaee":listener,
> "http://java.sun.com/xml/ns/javaee":servlet,
> "http://java.sun.com/xml/ns/javaee":servlet-mapping,
> "http://java.sun.com/xml/ns/javaee":session-config,
> "http://java.sun.com/xml/ns/javaee":mime-mapping,
> "http://java.sun.com/xml/ns/javaee":welcome-file-list,
> "http://java.sun.com/xml/ns/javaee":error-page,
> "http://java.sun.com/xml/ns/javaee":jsp-config,
> "http://java.sun.com/xml/ns/javaee":security-constraint,
> "http://java.sun.com/xml/ns/javaee":login-config,
> "http://java.sun.com/xml/ns/javaee":security-role,
> "http://java.sun.com/xml/ns/javaee":env-entry,
> "http://java.sun.com/xml/ns/javaee":ejb-ref,
> "http://java.sun.com/xml/ns/javaee":ejb-local-ref,
> "http://java.sun.com/xml/ns/javaee":service-ref,
> "http://java.sun.com/xml/ns/javaee":resource-ref,
> "http://java.sun.com/xml/ns/javaee":resource-env-ref,
> "http://java.sun.com/xml/ns/javaee":message-destination-ref,
> "http://java.sun.com/xml/ns/javaee":persistence-context-ref,
> "http://java.sun.com/xml/ns/javaee":persistence-unit-ref,
> "http://java.sun.com/xml/ns/javaee":post-construct,
> "http://java.sun.com/xml/ns/javaee":pre-destroy,
> "http://java.sun.com/xml/ns/javaee":message-destination,
> "http://java.sun.com/xml/ns/javaee":locale-encoding-mapping-list}' is
> expected. @
> vfszip:/C:/Documents%20and%20Settings/Stefano/Documenti/Uni/Corrente/WebArchitectures/jboss-5.0.0.GA/server/default/deploy/WAP-Shop.ear/WAP-Shop-war.war/WEB-INF/web.xml[26,19]
> at
> org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:203)
> at
> org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:168)
> at
> org.jboss.deployers.vfs.spi.deployer.JBossXBDeployerHelper.parse(JBossXBDeployerHelper.java:199)
> at
> org.jboss.deployers.vfs.spi.deployer.JBossXBDeployerHelper.parse(JBossXBDeployerHelper.java:170)
> at
> org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer.parse(SchemaResolverDeployer.java:132)
> at
> org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer.parse(SchemaResolverDeployer.java:118)
> at
> org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parseAndInit(AbstractVFSParsingDeployer.java:256)
> at
> org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parse(AbstractVFSParsingDeployer.java:188)
> at
> org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:323)
> ... 28 more
> Caused by: org.xml.sax.SAXException: cvc-complex-type.2.4.a: Invalid
> content was found starting with element 'interceptors'. One of
> '{"http://java.sun.com/xml/ns/javaee":description,
> "http://java.sun.com/xml/ns/javaee":display-name,
> "http://java.sun.com/xml/ns/javaee":icon,
> "http://java.sun.com/xml/ns/javaee":distributable,
> "http://java.sun.com/xml/ns/javaee":context-param,
> "http://java.sun.com/xml/ns/javaee":filter,
> "http://java.sun.com/xml/ns/javaee":filter-mapping,
> "http://java.sun.com/xml/ns/javaee":listener,
> "http://java.sun.com/xml/ns/javaee":servlet,
> "http://java.sun.com/xml/ns/javaee":servlet-mapping,
> "http://java.sun.com/xml/ns/javaee":session-config,
> "http://java.sun.com/xml/ns/javaee":mime-mapping,
> "http://java.sun.com/xml/ns/javaee":welcome-file-list,
> "http://java.sun.com/xml/ns/javaee":error-page,
> "http://java.sun.com/xml/ns/javaee":jsp-config,
> "http://java.sun.com/xml/ns/javaee":security-constraint,
> "http://java.sun.com/xml/ns/javaee":login-config,
> "http://java.sun.com/xml/ns/javaee":security-role,
> "http://java.sun.com/xml/ns/javaee":env-entry,
> "http://java.sun.com/xml/ns/javaee":ejb-ref,
> "http://java.sun.com/xml/ns/javaee":ejb-local-ref,
> "http://java.sun.com/xml/ns/javaee":service-ref,
> "http://java.sun.com/xml/ns/javaee":resource-ref,
> "http://java.sun.com/xml/ns/javaee":resource-env-ref,
> "http://java.sun.com/xml/ns/javaee":message-destination-ref,
> "http://java.sun.com/xml/ns/javaee":persistence-context-ref,
> "http://java.sun.com/xml/ns/javaee":persistence-unit-ref,
> "http://java.sun.com/xml/ns/javaee":post-construct,
> "http://java.sun.com/xml/ns/javaee":pre-destroy,
> "http://java.sun.com/xml/ns/javaee":message-destination,
> "http://java.sun.com/xml/ns/javaee":locale-encoding-mapping-list}' is
> expected. @
> vfszip:/C:/Documents%20and%20Settings/Stefano/Documenti/Uni/Corrente/WebArchitectures/jboss-5.0.0.GA/server/default/deploy/WAP-Shop.ear/WAP-Shop-war.war/WEB-INF/web.xml[26,19]
> at
> org.jboss.xb.binding.parser.sax.SaxJBossXBParser$MetaDataErrorHandler.error(SaxJBossXBParser.java:426)
> at org.apache.xerces.util.ErrorHandlerWrapper.error(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.XMLErrorReporter.reportError(Unknown Source)
> at
> org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown
> Source)
> at
> org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown
> Source)
> at
> org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
> Source)
> at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown
> Source)
> at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.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.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:199)
> ... 36 more
>
>
> is like the interceptor tag is not permitted inside web.xml or i miss
> something.
>
>
> 2009/4/15 Ignacio de Córdoba <[email protected]>:
>>
>> Are you including the interceptor in your interceptor-stack?
>>
>>
>> Stefano Tranquillini wrote:
>>>
>>> I'd try.
>>> i've use the @InjectEJB(name="..")
>>>
>>> but the variable is null
>>>
>>> tomorrow i take a better look.
>>>
>>> thanks.
>>>
>>> anyway, i can use the ejb2 jndi method, works and no contradiction (or
>>> not?)
>>>
>>> 2009/4/14 Ignacio de Córdoba <[email protected]>:
>>>>
>>>> Hi there...just google "struts2 ejb3 plugin"
>>>>
>>>> In the 2 first links you'll find the plugin and the doc page about it. I
>>>> personally use a the JBoss plugin, which includes a cache. I've extended
>>>> it
>>>> to do lookups annotated on parent classes.
>>>>
>>>> Try which ever fits you and write here abut any concrete problems.
>>>>
>>>> Regards,
>>>> Ignacio
>>>>
>>>>
>>>> Stefano Tranquillini wrote:
>>>>>
>>>>> Someone can explain me how to use (and find) the ejb3 plugin for
>>>>> sturts2?
>>>>> thanks folks
>>>>>
>>>>> --
>>>>> Stefano
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [email protected]
>>>>> For additional commands, e-mail: [email protected]
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/EJB3-plugin-struts2-tp23041889p23044375.html
>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Stefano
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/EJB3-plugin-struts2-tp23041889p23049778.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
>
>
> --
> Stefano
>
--
Stefano
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]