Go Back   Velocity Reviews > Newsgroups > Java
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

Java - problem with seam and sjsas

 
Thread Tools Search this Thread
Old 08-13-2007, 12:33 PM   #1
Default problem with seam and sjsas


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.MethodBindingMethodExpressio nAdapter.invoke(MethodBindingMethodExpressionAdapt
er.java:81)
at
com.sun.faces.application.ActionListenerImpl.proce ssAction(ActionListenerImpl.java:96)
at javax.faces.component.UICommand.broadcast(UIComman d.java:383)
at
org.ajax4jsf.framework.ajax.AjaxViewRoot.processEv ents(AjaxViewRoot.java:180)
at
org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcast Events(AjaxViewRoot.java:15
at
org.ajax4jsf.framework.ajax.AjaxViewRoot.processAp plication(AjaxViewRoot.java:329)
at
com.sun.faces.lifecycle.InvokeApplicationPhase.exe cute(InvokeApplicationPhase.java:97)
at
com.sun.faces.lifecycle.LifecycleImpl.phase(Lifecy cleImpl.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"
xmlnssi="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"
xmlnssi="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"
xmlnssi = "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>






qweer
  Reply With Quote
Old 08-13-2007, 12:54 PM   #2
Lew
 
Posts: n/a
Default Re: problem with seam and sjsas
qweer wrote:
> 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.MethodBindingMethodExpressio nAdapter.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.

--
Lew


Lew
  Reply With Quote
Old 08-13-2007, 01:37 PM   #3
qweer
 
Posts: n/a
Default Re: problem with seam and sjsas

> 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>




qweer
  Reply With Quote
Old 08-13-2007, 01:54 PM   #4
Lew
 
Posts: n/a
Default Re: problem with seam and sjsas
Lew wrote:
>> 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.


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


That confirms part of what I said, yes.

--
Lew


Lew
  Reply With Quote
Old 08-13-2007, 03:11 PM   #5
qweer
 
Posts: n/a
Default Re: problem with seam and sjsas
> 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"
xmlnssi="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.




qweer
  Reply With Quote
Old 08-13-2007, 09:17 PM   #6
Lew
 
Posts: n/a
Default Re: problem with seam and sjsas
qweer wrote:
>> That confirms part of what I said, yes.

>
> 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.

--
Lew


Lew
  Reply With Quote
Old 08-13-2007, 11:53 PM   #7
qweer
 
Posts: n/a
Default Re: problem with seam and sjsas

U¿ytkownik "Lew" <> napisa³ w wiadomo¶ci
news:. ..
> Lew wrote:
>>> 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.

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

>
> 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.

"




qweer
  Reply With Quote
Old 08-14-2007, 12:06 AM   #8
Lew
 
Posts: n/a
Default Re: problem with seam and sjsas
qweer wrote:
> U�ytkownik "Lew" <> napisa� w wiadomo�ci
> news:. ..
>> Lew wrote:
>>>> 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.

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

>> 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).


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?

--
Lew


Lew
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46