You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Peter Gerstbach <pe...@gerstbach.at> on 2004/11/14 11:22:42 UTC

axis-client in EJB session bean (jboss)

Hi,

I've generated with Axis-1.1 stubs for the Google-webservice and built a
working client. Then I've built an EJB session bean in JBoss were I call
the google-webservice. I use the same (copy-paste) methods in the bean
as in the axis-client but every time I invoke the bean-method from an
ejb client there is a NoSuchMethodError. The bean is working, because
I'm able to invoke other methods without problems.

The exception always occured at this line:

    GoogleSearchService service = new GoogleSearchServiceLocator();
-> GoogleSearchPort port = service.getGoogleSearchPort();

I use jboss-3.2.6 and axis-1.1.
This ist the stack-trace in detail:

java.rmi.ServerException: RemoteException occurred in server thread;
nested exception is:
     java.rmi.ServerError: Unexpected Error:; nested exception is:
     java.lang.NoSuchMethodError:
org.apache.axis.description.TypeDesc.<init>(Ljava/lang/Class;Z)V
     at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
.
.
.
Caused by: java.rmi.ServerError: Unexpected Error:; nested exception is:
     java.lang.NoSuchMethodError:
org.apache.axis.description.TypeDesc.<init>(Ljava/lang/Class;Z)V
     at
org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:398)
.
.
.
Caused by: java.lang.NoSuchMethodError:
org.apache.axis.description.TypeDesc.<init>(Ljava/lang/Class;Z)V
     at
GoogleSearch.GoogleSearchResult.<clinit>(GoogleSearchResult.java:332)
     at java.lang.Class.forName0(Native Method)
     at java.lang.Class.forName(Class.java:141)
     at
GoogleSearch.GoogleSearchBindingStub.class$(GoogleSearchBindingStub.java:27)
...


When I call the bean-method a second time, there is another exception,
but on the same lines:

java.rmi.ServerException: RemoteException occurred in server thread;
nested exception is:
	java.rmi.ServerError: Unexpected Error:; nested exception is:
	java.lang.NoClassDefFoundError
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
.
.
.
Caused by: java.lang.NoClassDefFoundError
	at
GoogleSearch.GoogleSearchServiceLocator.getGoogleSearchPort(GoogleSearchServiceLocator.java:43)
	at
GoogleSearch.GoogleSearchServiceLocator.getGoogleSearchPort(GoogleSearchServiceLocator.java:38)




Does anybody know what the problem might be?
Are there some libraries missing? I put them all in jboss-lib dir, but
the error is the same.

regards,
Peter Gerstbach


Re: axis-client in EJB session bean (jboss)

Posted by Peter Gerstbach <pe...@gerstbach.at>.
Peter Mount wrote:
> Peter Gerstbach wrote:
>>
>> I've generated with Axis-1.1 stubs for the Google-webservice and built a
>> working client. Then I've built an EJB session bean in JBoss were I call
>> the google-webservice. I use the same (copy-paste) methods in the bean
>> as in the axis-client but every time I invoke the bean-method from an
>> ejb client there is a NoSuchMethodError. The bean is working, because
>> I'm able to invoke other methods without problems.
>>
>> The exception always occured at this line:
>>
>>    GoogleSearchService service = new GoogleSearchServiceLocator();
>> -> GoogleSearchPort port = service.getGoogleSearchPort();
>>
>> I use jboss-3.2.6 and axis-1.1.
>> This ist the stack-trace in detail:
>>
>> java.rmi.ServerException: RemoteException occurred in server thread;
>> nested exception is:
>>     java.rmi.ServerError: Unexpected Error:; nested exception is:
>>     java.lang.NoSuchMethodError:
>> org.apache.axis.description.TypeDesc.<init>(Ljava/lang/Class;Z)V
>>     at 
>> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
> 
> 
> I've not (yet) tried to deploy a webservice under jboss (apart from 
> migrating a legacy webapp to it), but over the last few weeks I've been 
> hitting the same problem with various other jboss components. Every time 
> it's been down to which classloader the components are located.
> 
> I've found the following link on the jboss site helpful: 
> http://www.jboss.org/wiki/Wiki.jsp?page=ClassLoadingConfiguration
> 
> It may be a case that your webservice classes are either hidden away 
> within a different class loader than your session bean, or are deployed 
> after it. (I've hit that problem recently as well).
> 
> One way around it may be to place your webservice's classes in the same 
> jar as the session bean. As the EJB's tend to be visible to webapps, the 
> app (& if I remember correctly jboss deploys webservices in their own 
> webapp), it will also still access them.
> 
> I'm just thinking of the top of my head at the moment, but would 
> probably be hitting this problem sometime over the next couple of weeks 
> myself, so it would be interesting to hear other peoples ideas on this one.
> 
> Peter

Yes, now it works. It was the class loading.

I had to put the axis-libs together with my ejb in the jar-file. Then I 
had to configure the class-loading in the jboss-app.xml in the ear-file:

<jboss-app>
   <loader-repository>
     own.test:loader=nameof.ear
	<loader-repository-config>
           java2ParentDelegation=false
	</loader-repository-config>
   </loader-repository>
</jboss-app>

Thanks a lot,
Peter

Re: axis-client in EJB session bean (jboss)

Posted by Peter Mount <pe...@retep.org.uk>.
Peter Gerstbach wrote:

> Hi,
>
> I've generated with Axis-1.1 stubs for the Google-webservice and built a
> working client. Then I've built an EJB session bean in JBoss were I call
> the google-webservice. I use the same (copy-paste) methods in the bean
> as in the axis-client but every time I invoke the bean-method from an
> ejb client there is a NoSuchMethodError. The bean is working, because
> I'm able to invoke other methods without problems.
>
> The exception always occured at this line:
>
>    GoogleSearchService service = new GoogleSearchServiceLocator();
> -> GoogleSearchPort port = service.getGoogleSearchPort();
>
> I use jboss-3.2.6 and axis-1.1.
> This ist the stack-trace in detail:
>
> java.rmi.ServerException: RemoteException occurred in server thread;
> nested exception is:
>     java.rmi.ServerError: Unexpected Error:; nested exception is:
>     java.lang.NoSuchMethodError:
> org.apache.axis.description.TypeDesc.<init>(Ljava/lang/Class;Z)V
>     at 
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)

I've not (yet) tried to deploy a webservice under jboss (apart from 
migrating a legacy webapp to it), but over the last few weeks I've been 
hitting the same problem with various other jboss components. Every time 
it's been down to which classloader the components are located.

I've found the following link on the jboss site helpful: 
http://www.jboss.org/wiki/Wiki.jsp?page=ClassLoadingConfiguration

It may be a case that your webservice classes are either hidden away 
within a different class loader than your session bean, or are deployed 
after it. (I've hit that problem recently as well).

One way around it may be to place your webservice's classes in the same 
jar as the session bean. As the EJB's tend to be visible to webapps, the 
app (& if I remember correctly jboss deploys webservices in their own 
webapp), it will also still access them.

I'm just thinking of the top of my head at the moment, but would 
probably be hitting this problem sometime over the next couple of weeks 
myself, so it would be interesting to hear other peoples ideas on this one.

Peter

> Does anybody know what the problem might be?
> Are there some libraries missing? I put them all in jboss-lib dir, but
> the error is the same.
>
> regards,
> Peter Gerstbach