Exposing EJB3.1 bean as webservice and use from servlet!?

2012-03-17 Thread sim085
Hello, can please someone help me. I am at a loss how I can expose an EJB3.1
as a  Webservice in a maven project and access this from a Servlet. 

My EJB class is as follows:

[code]
@WebService(serviceName=EcoService)
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
@Stateless
public class EchoBean {

@WebMethod(operationName=EchoIn, action=EchoIn)
@WebResult(name=EchoOut)
public String echo(@WebParam(name = Message) String message){
return message;
}
}
[/code]

Now from my reading and examples on the Internet, I understand that somehow
I need to generate an Service to access 

[code]
@WebServiceRef(wsdlLocation=http://localhost:8080/EchoService/EcoBean?WSDL;)
EchoService echoService = null;
...
EchoBean echoBean = EchoService.getEchoBeanPort();
String result = echoBean.echo();
[/code]

However I am at a loss how I will generate the EchoService class! I tried
looking in to org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.2:wsgen and this
is generating classes for every method I have in EchoBean, but not a Service
class on which I can use the @WebServiceRef annotation on!! This could be
because I did not configure the plugin correctly

[code]
plugin
groupIdorg.jvnet.jax-ws-commons/groupId
artifactIdjaxws-maven-plugin/artifactId
version2.2/version
configuration
verbosetrue/verbose
/configuration
executions
execution
goals
goalwsgen/goal
/goals
/execution
/executions
/plugin   
[/code]
Can please someone help me out!! I have also made the whole project
available on my drop box account available from here:

http://dl.dropbox.com/u/27542229/webservice-example.zip



 

--
View this message in context: 
http://maven.40175.n5.nabble.com/Exposing-EJB3-1-bean-as-webservice-and-use-from-servlet-tp5574228p5574228.html
Sent from the Maven - Users mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



How to package a JAR file in an EAR file so that this can be accessed by all other modules (ex: EJB, WAR, etc)

2010-12-15 Thread sim085

Hello, I have a problem when trying to package a JAR file in an EAR file. In
short my EAR file has three modules; and EJB module, a JAR module and a WAR
module. The EJB module makes use of the JAR module. My POM is as follows;

...
modules
   jarModule
  groupIdcom.test.persistence/groupId
  artifactIdpersistence/artifactId
  !-- includeInApplicationXmltrue/includeInApplicationXml --
   /jarModule
   ejbModule
  groupIdcom.test.ejb/groupId
  artifactIdejb/artifactId
   /ejbModule
   webModule
  groupIdcom.test.web/groupId
  artifactIdweb/artifactId
   /webModule
/modules
...

However when I deploy the application on Geronimo I get an error telling me
that an EJB cannot be deployed because of a class in the persistence jar
file (which is used from the EJB). The exact error is as follows;

-
The application was not deployed.

The application was not deployed.
Could not fully load class: com.test.ejb.MyEjbBean
 due to:com/test/persistence/User
 in classLoader: 
org.apache.geronimo.kernel.classloader.temporaryclassloa...@cf0aa9b
java.lang.NoClassDefFoundError: Could not fully load class:
com.test.ejb.MyEjbBean
 due to:com/test/persistence/User
 in classLoader: 
org.apache.geronimo.kernel.classloader.temporaryclassloa...@cf0aa9b
-

I checked the documentation and the only thing i could see realted is the
option includeInApplicationXml. However if I set this to true then I get the
following error;

-
Module was not an application client: persistence-1.0-SNAPSHOT.jar
-

Does anyone know how thtough maven I can package a JAR in an EAR file so
that this can be used by any other module within that EAR file?



-- 
View this message in context: 
http://maven.40175.n5.nabble.com/How-to-package-a-JAR-file-in-an-EAR-file-so-that-this-can-be-accessed-by-all-other-modules-ex-EJB-WA-tp3306790p3306790.html
Sent from the Maven - Users mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: How to package a JAR file in an EAR file so that this can be accessed by all other modules (ex: EJB, WAR, etc)

2010-12-15 Thread sim085

I do have com.test.persistence project listed under the dependencies and in
fact this is added to the ear file just like the other projects (ejb and
war). However when I try to deploy the ear file I get the error from
geronimo. 

I do not know if the error is because I lack some configuration setting or
else because Geronimo does not realise that the ehb module needs the
persistence module and therefore one should be deplpoyed before the other.
-- 
View this message in context: 
http://maven.40175.n5.nabble.com/How-to-package-a-JAR-file-in-an-EAR-file-so-that-this-can-be-accessed-by-all-other-modules-ex-EJB-WA-tp3306790p3307114.html
Sent from the Maven - Users mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: Problem running unit tests from maven (JPA related)

2009-12-01 Thread sim085


Thank you for that, I totally agree. Yesterday I still had some problems
because my persistence module has some session beans. All problems where
solved when org.apache.openejb javaee-api dependency rather then the javaee
javaee-api I used before.

thanks again.


Stephen Connolly-2 wrote:
 
 2009/11/30 sim085 sim...@hotmail.com:

 Wayne,

 Thank you very much for your help. I solved the problem using the first
 link
 you suggested. Because that thread might not be very clear I decided to
 offer an explanation here.

 Basically the problem was because in my pom.xml file I had the following
 parts;

 repository
        idjava.net1/id
        nameJava.Net Maven1 Repository, hosts the javaee-api
 dependency/name
        urlhttp://download.java.net/maven/1/url
        layoutlegacy/layout
 /repository
 ...
 dependency
        groupIdjavaee/groupId
        artifactIdjavaee-api/artifactId
        version5/version
        scopeprovided/scope
 /dependency

 
 The above artifact is a pile of cack.
 
 You're better off using
 
 dependency
 groupIdorg.apache.openejb/groupId
 artifactIdjavaee-api/artifactId
 version5.0-1/version
 /dependency
 
 or another equivalent I think geronimo has one too
 I am not actually making use of this library from my persistence module
 and
 therefore I have no problem to remove it (was there by mistake when
 splitting my project apart). I guess I might face a similar problem when
 I
 will unit test my ejb's, however I hope the provided link will help be
 there
 as well :)

 Thanks again.




 Wayne Fay wrote:

 java.lang.ClassFormatError: Absent Code attribute in method that is not
 native or abstract in class file javax/persistence/Persistence

 This suggests the jar you are using as a dependency which contains
 javax.persistence.Persistence has an issue of some kind. I'd assume
 you're depending on the API jar (containing only stubs for the
 methods) and yet your tests need an implementation Jar to work
 properly.

 I just now Googled and found this thread:
 http://forums.java.net/jive/message.jspa?messageID=226931
 which links to this blog:
 http://weblogs.java.net/blog/ludo/archive/2007/01/java_ee_5_apis.html
 which confirms exactly what I stated above.

 Wayne




 --
 View this message in context:
 http://old.nabble.com/Problem-running-unit-tests-from-maven-%28JPA-related%29-tp26540500p26570571.html
 Sent from the Maven - Users mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
 For additional commands, e-mail: users-h...@maven.apache.org


 
 -
 To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
 For additional commands, e-mail: users-h...@maven.apache.org
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Problem-running-unit-tests-from-maven-%28JPA-related%29-tp26540500p26591982.html
Sent from the Maven - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: Problem running unit tests from maven (JPA related)

2009-11-30 Thread sim085

Wayne,

Thank you very much for your help. I solved the problem using the first link
you suggested. Because that thread might not be very clear I decided to
offer an explanation here. 

Basically the problem was because in my pom.xml file I had the following
parts; 

repository
idjava.net1/id  
nameJava.Net Maven1 Repository, hosts the javaee-api 
dependency/name
urlhttp://download.java.net/maven/1/url 
layoutlegacy/layout 
/repository   
...
dependency  
groupIdjavaee/groupId  
artifactIdjavaee-api/artifactId  
version5/version  
scopeprovided/scope  
/dependency

I am not actually making use of this library from my persistence module and
therefore I have no problem to remove it (was there by mistake when
splitting my project apart). I guess I might face a similar problem when I
will unit test my ejb's, however I hope the provided link will help be there
as well :)

Thanks again.




Wayne Fay wrote:
 
 java.lang.ClassFormatError: Absent Code attribute in method that is not
 native or abstract in class file javax/persistence/Persistence
 
 This suggests the jar you are using as a dependency which contains
 javax.persistence.Persistence has an issue of some kind. I'd assume
 you're depending on the API jar (containing only stubs for the
 methods) and yet your tests need an implementation Jar to work
 properly.
 
 I just now Googled and found this thread:
 http://forums.java.net/jive/message.jspa?messageID=226931
 which links to this blog:
 http://weblogs.java.net/blog/ludo/archive/2007/01/java_ee_5_apis.html
 which confirms exactly what I stated above.
 
 Wayne
 



-- 
View this message in context: 
http://old.nabble.com/Problem-running-unit-tests-from-maven-%28JPA-related%29-tp26540500p26570571.html
Sent from the Maven - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: Problem running unit tests from maven (JPA related)

2009-11-30 Thread sim085


mickknutson wrote:
 
 Do you have an error trace?
 

Problem solved :) For future reference (in case anyone else has this
problem) I am going to put the error trace here. I solved the problem using
the link provided by Wayne Fay -
http://forums.java.net/jive/message.jspa?messageID=226931


---
Test set: jpa.test.persistence.EntityTest
---
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.729 sec
 FAILURE!
testPersistence(jpa.test.persistence.EntityTest)  Time elapsed: 1.636 sec 
 ERROR!
java.lang.ClassFormatError: Absent Code attribute in method that is not
native or abstract in class file javax/persistence/Persistence
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at 
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at jpa.test.persistence.EntityTest.setUp(EntityTest.java:105)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
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.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
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.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:334)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:980)



-- 
View this message in context: 
http://old.nabble.com/Problem-running-unit-tests-from-maven-%28JPA-related%29-tp26540500p26570570.html
Sent from the Maven - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Problem running unit tests from maven (JPA related)

2009-11-27 Thread sim085

Hi,

I am trying to set some unit tests that will create a derby database in
memory and persist objects in this database using openJPA. However when I
run the test scripts from maven I get the following exception:

java.lang.ClassFormatError: Absent Code attribute in method that is not
native or abstract in class file javax/persistence/Persistence

The fact is that if I move the same unit test code and run it as a normal
java application (with proper class-path set in META-INF file) then I have
no problems and the application runs as a charm (i.e. - objects are
persisted accordingly).

For a JPA application to run properly you need an xml file called
persistence.xml. I placed this file in both src\main\resources\META-INF\
directory and also in the src\test\resources\META-INF\ directory, however to
no avail! 

The fact is that the unit test only fails on the Persistence dependency
(defined in pom as dependency with scope 'test') while the Derby dependency
(used to create database) works like a charm from unit tests as well.

Does anyone have any idea what this might be?

Regards,
Simon J. 
-- 
View this message in context: 
http://old.nabble.com/Problem-running-unit-tests-from-maven-%28JPA-related%29-tp26540500p26540500.html
Sent from the Maven - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: Problem running unit tests from maven (JPA related)

2009-11-27 Thread sim085

Does anyone know at least where I can find more information on how maven run
unit tests? I am sure it is something related to this, since when I pakcage
the application in a jar file and run it using java -jar jarfilename the
whole application runs without any problem!
-- 
View this message in context: 
http://old.nabble.com/Problem-running-unit-tests-from-maven-%28JPA-related%29-tp26540500p26545399.html
Sent from the Maven - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org