problem with seam and sjsas

Q

qweer

I write simple application and I have problem, that I can't resolve. It
always show me error that, method test.TestLocal_15902127.test() hasn't been
found. There is Seam.propertis in web/conf dir in ejb project and there are
all business interfaces (local and remote in ejb project). Please help.
My error:
Code:
javax.el.MethodNotFoundException: /template-client.xhtml @23,78
action="#{test.test}": Method not found: test.TestLocal_15902127.test()
javax.faces.el.MethodNotFoundException: javax.el.MethodNotFoundException:
/template-client.xhtml @23,78 action="#{test.test}": Method not found:
test.TestLocal_15902127.test()
at
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapt
er.java:81)
at
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:96)
at javax.faces.component.UICommand.broadcast(UICommand.java:383)
at
org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
at
org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
at
org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:329)
at
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
at
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:244)



web.xml
Code:
<?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">
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>facelets.SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>
index.xhtml
</welcome-file>
</welcome-file-list>
<context-param>
<description>
</description>
<param-name>org.jboss.seam.core.init.jndiPattern</param-name>
<param-value>java:comp/env/Tets-ejb/#{ejbName}/local</param-value>
</context-param>

<listener>
<listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
</listener>

<ejb-local-ref>
<ejb-ref-name>Tets-ejb/TestBean/local</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local>test.TestLocal</local>
<ejb-link>TestBean</ejb-link>
</ejb-local-ref>
</web-app>




Code:
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="1.2"
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-facesconfig_1_2.xsd">

<application>
<view-handler>
com.sun.facelets.FaceletViewHandler
</view-handler>
</application>
<lifecycle>
<phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>
</lifecycle>
<application>
<el-resolver>
org.jboss.seam.jsf.SeamELResolver
</el-resolver>
</application>
</faces-config>


ejb-jar.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns = "http://java.sun.com/xml/ns/javaee" version = "3.0"
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/ejb-jar_3_0.xsd">
<interceptors>
<interceptor>
<interceptor-class>
org.jboss.seam.ejb.SeamInterceptor
</interceptor-class>
</interceptor>
</interceptors>
<assembly-descriptor>
<interceptor-binding>
<ejb-name>*</ejb-name>
<interceptor-class>
org.jboss.seam.ejb.SeamInterceptor
</interceptor-class>
</interceptor-binding>
</assembly-descriptor>
</ejb-jar>
 
L

Lew

qweer said:
I write simple application and I have problem, that I can't resolve. It
always show me error that, method test.TestLocal_15902127.test() hasn't been
found. There is Seam.propertis in web/conf dir in ejb project and there are
all business interfaces (local and remote in ejb project). Please help.
My error:
Code:
javax.el.MethodNotFoundException: /template-client.xhtml @23,78
action="#{test.test}": Method not found: test.TestLocal_15902127.test()
javax.faces.el.MethodNotFoundException: javax.el.MethodNotFoundException:
/template-client.xhtml @23,78 action="#{test.test}": Method not found:
test.TestLocal_15902127.test()
at
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapt
er.java:81)

This is a Java Server Faces (JSF) issue, not EJB.
web.xml and
ejb-jar.xml
are not at issue. Nor are any properties files. This is a JSF Expression
Language (EL) construct in a JSP that doesn't match its declared backing bean
invocation.

You have a backing bean named "test" defined by a "managed-bean" tag in the
faces-config.xml, or should, that is invoked by "action" attribute of a
commandButton or commandLink in your JSP, which code you have not shown us.
Either the bean doesn't have a test() method or you failed to define that
backing bean in your faces-config.xml.
 
Q

qweer

You have a backing bean named "test" defined by a "managed-bean" tag in
the
faces-config.xml, or should, that is invoked by "action" attribute of a
commandButton or commandLink in your JSP, which code you have not shown
us. Either the bean doesn't have a test() method or you failed to define
that backing bean in your faces-config.xml.

My template-client.xhtml

<?xml version='1.0' encoding='UTF-8' ?>
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html">
<body>
<ui:composition template="/template.xhtml">
<ui:define name="title">
Facelets
</ui:define>
<ui:define name="body">
Hello, this text comming from template client.
<h:form>
<h:commandButton value="Click me"
action="#{test.test}"/>
</h:form>
</ui:define>
</ui:composition>
</body>
</html>
 
Q

qweer

That confirms part of what I said, yes.

Ok. I dont't understand something. Do I have to create bean in war project?
Now, I have faces config like that:
<faces-config version="1.2"
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-facesconfig_1_2.xsd">

<application>
<view-handler>
com.sun.facelets.FaceletViewHandler
</view-handler>
</application>
<lifecycle>
<phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>
</lifecycle>
<application>
<el-resolver>
org.jboss.seam.jsf.SeamELResolver
</el-resolver>
</application>
<managed-bean>
<managed-bean-name>test</managed-bean-name>
<managed-bean-class>test.TestBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>

and
<h:form>
<h:commandButton value="Click me" action="#{test.test}"/>
</h:form>

in template-client.xhtml. I have the same error like before. What do I have
to do to eliminate this isue? Sorry, I'm newbe.
 
L

Lew

qweer said:
Ok. I dont't understand something. Do I have to create bean in war project?

I'm not sure what you mean by this question. If you mean, "Must there be a
class in the project that corresponds to the managed bean class?" the answer
is, "Yes." If you mean, "Must there be an explicit instantation of the
TestBean class?" the answer is, "No."
<h:form>
<h:commandButton value="Click me" action="#{test.test}"/>
</h:form>

in template-client.xhtml. I have the same error like before. What do I have
to do to eliminate this isue? Sorry, I'm newbe.

Does "test.TestBean" have a "public String test()" method?

Does the test() method return a String (or Object with a toString() that
returns a String) that represents the outcome of the action?

I am not familiar with facelets, so I don't know if you need a
"navigation-rule" element in your faces-config.xml that corresponds to that
return value, but I suspect that you do. You would if you were using just JSF
without facelets.
 
Q

qweer

U¿ytkownik "Lew said:
That confirms part of what I said, yes.

I think I don't have to define in faces-config any manage bean (meybe I'm
wrong).
There is a part of seam ofiicial tutorial:
"The faces-config.xml file integrates Seam into JSF. Note that we don't need
any JSF managed bean declarations! The managed beans are the Seam
components. In Seam applications, the faces-config.xml is used much less
often than in plain JSF.
In fact, once you have all the basic descriptors set up, the only XML you
need to write as you add new functionality to a Seam application is the
navigation rules, and possibly jBPM process definitions. Seam takes the view
that process flow and configuration data are the only things that truly
belong in XML.

In this simple example, we don't even need a navigation rule, since we
decided to embed the view id in our action code.

"
 
L

Lew

qweer said:
I think I don't have to define in faces-config any manage bean (meybe I'm
wrong).

Maybe you don't, but you still have to have a test() method for the JSP EL
expression to invoke. Remember, your error is:
javax.el.MethodNotFoundException: /template-client.xhtml @23,78
action="#{test.test}": Method not found: test.TestLocal_15902127.test()
javax.faces.el.MethodNotFoundException: javax.el.MethodNotFoundException:
/template-client.xhtml @23,78 action="#{test.test}": Method not found:
test.TestLocal_15902127.test()

This tells you that the test() method doesn't exist. I also wonder what the
"TestLocal_.+" part of the class name is.

The problem is with the EL expression mentioned in the error message. Is
there such a method?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top