[JBoss Seam] - Embedded EJB Testing Woes
by mwkohout
I'm trying to use the embedded EJB container for testing a seam 2.0 seam-gen based app but am having problems.
I've got a datasource set up as so:
| <?xml version="1.0" encoding="UTF-8"?>
|
| <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
| xmlns="urn:jboss:bean-deployer">
|
| <bean name="ICTRCoreDatasourceBootstrap"
| class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource">
| <property name="driverClass">com.mysql.jdbc.Driver</property>
| <property name="connectionURL">jdbc:mysql://de01.gcrc.umn.edu/mwkohout_ictrcore</property>
| <property name="userName">mwkohout</property>
| <property name="password">password</property>
| <property name="jndiName">java:/ICTRCoreDatasource</property>
| <property name="minSize">0</property>
| <property name="maxSize">10</property>
| <property name="blockingTimeout">1000</property>
| <property name="idleTimeout">100000</property>
| <property name="transactionManager">
| <inject bean="TransactionManager"/>
| </property>
| <property name="cachedConnectionManager">
| <inject bean="CachedConnectionManager"/>
| </property>
| <property name="initialContextProperties">
| <inject bean="InitialContextProperties"/>
| </property>
| </bean>
|
| <bean name="ICTRCoreDatasource" class="java.lang.Object">
| <constructor factoryMethod="getDatasource">
| <factory bean="ICTRCoreDatasourceBootstrap"/>
| </constructor>
| </bean>
|
| </deployment>
|
It's living in test-build/META-INF/
and I've got a PU set up like so:
| <?xml version="1.0" encoding="UTF-8"?>
| <!-- Persistence deployment descriptor for dev profile -->
| <persistence xmlns="http://java.sun.com/xml/ns/persistence"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
| version="1.0">
|
| <persistence-unit name="ICTRCore">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:/ICTRCoreDatasource</jta-data-source>
| <properties>
| <property name="hibernate.hbm2ddl.auto" value="update"/>
| <property name="hibernate.cache.use_query_cache" value="true"/>
| <property name="hibernate.show_sql" value="true"/>
| <property name="jboss.entity.manager.factory.jndi.name" value="java:/ICTRCoreEntityManagerFactory"/>
| </properties>
| </persistence-unit>
|
| </persistence>
|
It lives in the test-build/META-INF dir as well.
But I'm getting this error:
| INFO 21-08 13:46:47,955 [org.hibernate.cfg.annotations.EntityBinder.bindTable():340] Bind entity edu.umn.ictr.authentication.Role on table Role
| INFO 21-08 13:46:47,999 [org.hibernate.cfg.annotations.CollectionBinder.bindOneToManySecondPass():581] Mapping collection: edu.umn.ictr.IRBInterface.IrbStudy.studyActions -> STUDY_ACTION
| INFO 21-08 13:46:48,000 [org.hibernate.cfg.annotations.CollectionBinder.bindOneToManySecondPass():581] Mapping collection: edu.umn.ictr.IRBInterface.IrbStudy.studyFundings -> STUDY_FUNDING
| INFO 21-08 13:46:48,000 [org.hibernate.cfg.annotations.CollectionBinder.bindOneToManySecondPass():581] Mapping collection: edu.umn.ictr.IRBInterface.IrbStudy.studyTitles -> STUDY_TITLE
| INFO 21-08 13:46:48,003 [org.hibernate.cfg.annotations.CollectionBinder.bindOneToManySecondPass():581] Mapping collection: edu.umn.ictr.IRBInterface.IrbStudy.studyPersons -> STUDY_PERSONNEL
| INFO 21-08 13:46:48,120 [org.hibernate.util.NamingHelper.getInitialContext():26] JNDI InitialContext properties:{}
| FATAL 21-08 13:46:48,141 [org.hibernate.connection.DatasourceConnectionProvider.configure():55] Could not find datasource: java:/ICTRCoreDatasource
| javax.naming.NameNotFoundException: ICTRCoreDatasource not bound
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:542)
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:550)
| at org.jnp.server.NamingServer.getObject(NamingServer.java:556)
| at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:628)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:590)
| at javax.naming.InitialContext.lookup(InitialContext.java:392)
| at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
| at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
| at org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29)
| at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
| at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2006)
| at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1289)
| at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:691)
| at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
| at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
| at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
| at edu.umn.ictr.core.test.entity.UserTest.init(UserTest.java:52)
| 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.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:604)
| at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:394)
| at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
| at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:79)
| at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:165)
| at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:103)
| at org.testng.TestRunner.runWorkers(TestRunner.java:678)
| at org.testng.TestRunner.privateRun(TestRunner.java:624)
| at org.testng.TestRunner.run(TestRunner.java:495)
| at org.testng.SuiteRunner.runTest(SuiteRunner.java:300)
| at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:295)
| at org.testng.SuiteRunner.privateRun(SuiteRunner.java:275)
| at org.testng.SuiteRunner.run(SuiteRunner.java:190)
| at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:792)
| at org.testng.TestNG.runSuitesLocally(TestNG.java:765)
| at org.testng.TestNG.run(TestNG.java:699)
| at org.testng.TestNG.privateMain(TestNG.java:824)
| at org.testng.TestNG.main(TestNG.java:802)
|
| ===============================================
| Suite1
| Total tests run: 1, Failures: 0, Skips: 1
| Configuration Failures: 2, Skips: 2
| ===============================================
|
What am I missing? Is there any obvious errors I'm making?
thanks
Mike Kohout
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4076453#4076453
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4076453
18Â years, 8Â months
[JBossWS] - 2 ejb3s exposed as web services. Can't have same methods wit
by sursha
Hello,
I've 2 ejb3s exposed as 2 separate web services. They are packaged in the same ear file.
I use the WebContext annotation to keep the context root same for 2 services.
I've a method, authenticate(String userName) in one ejb and
authenticate(String userName, String password) in the other ejb.
When I deploy the ear file, I get the error as follows:
Looks like there is a name collision. It is complaining about the first ejb not having
password as a parameter. Any one seen this issue?
by: org.jboss.ws.WSException: password is not a valid property on class com.xxx.services.MyService1.v2.jaxws.Authenticate
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessor(JAXBContextImpl.java:816)
at org.jboss.ws.metadata.acessor.JAXBAccessor$1$1.create(JAXBAccessor.java:84)
at org.jboss.ws.metadata.umdm.ParameterMetaData.eagerInitialize(ParameterMetaData.java:472)
at org.jboss.ws.metadata.umdm.OperationMetaData.eagerInitialize(OperationMetaData.java:466)
at org.jboss.ws.metadata.umdm.EndpointMetaData.eagerInitializeOperations(EndpointMetaData.java:516)
at org.jboss.ws.metadata.umdm.EndpointMetaData.initializeInternal(EndpointMetaData.java:502)
at org.jboss.ws.metadata.umdm.EndpointMetaData.eagerInitialize(EndpointMetaData.java:490)
at org.jboss.ws.metadata.umdm.ServiceMetaData.eagerInitialize(ServiceMetaData.java:429)
at org.jboss.ws.metadata.umdm.UnifiedMetaData.eagerInitialize(UnifiedMetaData.java:192)
at org.jboss.ws.core.server.ServiceEndpoint.start(ServiceEndpoint.java:112)
at org.jboss.ws.core.server.ServiceEndpointManager.startServiceEndpoint(ServiceEndpointManager.java:646)
at org.jboss.ws.core.server.ServiceEndpointDeployer.start(ServiceEndpointDeployer.java:140)
at org.jboss.ws.integration.jboss42.DeployerInterceptor.startServiceEndpoint(DeployerInterceptor.java:144)
at org.jboss.ws.integration.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:96)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4076450#4076450
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4076450
18Â years, 8Â months
[EJB 3.0] - EJB3 client error - java.io.EOF exception
by Jihnd
hello all,
i'm folllowing the samples in bill burke's ejb3 book, i''ve successfully deployed my ejb bean, and i've got an simple database i've made in oracle xe as my datasource
i'm now at the stage where i'm tryng to access i through a client application - but whenever i run the client app, it hangs about 4/5 hours - after which i get these error messages:
(reconfigured port to 1201 for my install)
anonymous wrote :
| C:\>java Client
| javax.naming.CommunicationException: Could not obtain connection to any of these
| urls: jnp://localhost:1201 and discovery failed with error: javax.naming.Commun
| icationException: error setting options [Root exception is java.net.SocketExcept
| ion: error setting options] [Root exception is javax.naming.CommunicationExcepti
| on: Failed to retrieve stub from server localhost:1201 [Root exception is java.i
| o.EOFException]]
| at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1414)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:594)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
| at javax.naming.InitialContext.lookup(InitialContext.java:392)
| at Client.main(Client.java:14)
| Caused by: javax.naming.CommunicationException: Failed to retrieve stub from ser
| ver localhost:1201 [Root exception is java.io.EOFException]
| at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:263)
| at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1385)
| ... 4 more
| Caused by: java.io.EOFException
| at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream
| .java:2279)
| at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputS
| tream.java:2748)
| at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:780
| )
| at java.io.ObjectInputStream.(ObjectInputStream.java:280)
| at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:250)
| ... 5 more
|
in my searches it seems to be the jndicontext.lookup variable that could an issue, so i've been trying a variety of names including (AVman is the nname of my jar & the jndi name) "java:AVman/com/AVman/Audiorec/AVmanRemote", "java:com/AVman/Audiorec/AVmanRemote", "java:AVman/com/AVman/Audiorec/AVman/remote"
but no joy
my log gives me a series of these errors:
anonymous wrote :
|
| 2007-08-21 17:44:33,453 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] run: IdleRemover notifying pools, interval: 450000
and here is my client app:
anonymous wrote : import com.AVman.Audiorec.AVmanRemote;
| import com.AVman.domain.Audiorec;
|
| import javax.naming.InitialContext;
| import javax.naming.Context;
| import javax.naming.NamingException;
| import java.util.Properties;
| import javax.rmi.PortableRemoteObject;
|
| public class Client {
| public static void main(String [] args) {
| try {
| Context jndiContext = getInitialContext( );
| Object ref = jndiContext.lookup("java:AVman/com/AVman/Audiorec/AVmanRemote");
| AVmanRemote dao = (AVmanRemote)
| PortableRemoteObject.narrow(ref,AVmanRemote.class);
|
| Audiorec audiorec_1 = new Audiorec( );
| audiorec_1.setAudiorec_alias("Edirol red 1");
| audiorec_1.setBarcode_audiorec(1111117);
| audiorec_1.setSerial_audiorec("abcdefg");
| audiorec_1.setMedia_audiorec("sd card, 1gb included");
|
| dao.createAudiorec(audiorec_1);
|
| Audiorec audiorec_2 = dao.findAudiorec("Edirol red 1");
| System.out.println(audiorec_1.getAudiorec_alias( ));
| System.out.println(audiorec_1.getBarcode_audiorec( ));
| System.out.println(audiorec_1.getSerial_audiorec( ));
| System.out.println(audiorec_1.getMedia_audiorec( ));
|
| } catch (javax.naming.NamingException ne){ne.printStackTrace( );}
| }
|
| public static Context getInitialContext( )
| throws javax.naming.NamingException {
|
| Properties p = new Properties( );
| p.put(Context.INITIAL_CONTEXT_FACTORY,
| "org.jnp.interfaces.NamingContextFactory");
| p.put(Context.URL_PKG_PREFIXES,
| "org.jboss.naming:org.jnp.interfaces");
| p.put(Context.PROVIDER_URL, "jnp://localhost:1201");
| return new javax.naming.InitialContext(p);
| }
| }
running:
JBoss [Zion] 4.0.5.GA
xp pro sp2
oracle 10g xe
jdk 1.6.0
& all on same machine, no firewalll
this post refers to jboss remoting - http://www.jboss.org/?module=bb&op=viewtopic&t=90965 -could this be my issue? i'm fairly neew to jboss so dont wanna conflate this by trying to get another framework in Yet, unless, thats what i need to do.... ?
please help!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4076449#4076449
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4076449
18Â years, 8Â months
[JBoss Seam] - Re: The zen of seamgen'd Home/EntityHome
by tynor
I think we've worked some of this out. (correct me if I'm wrong!)
The getDefinedInstance() functions on the homes will never be set unless the page is called with an <s:link><f:param> corresponding to one of the 's in the FooEdit.page.xml -- those params will in turn call through EL to the various home objects, indirectly calling setId() which causes getDefinedInstance() to return a non-null object. Presumably, this is intended as a way to instantiate a new object with non-null values for these fields. (Gavin's post implies that its a way to pre-instantiate non-null foreign key fields so that they are not null at persist time).
However, because wire() is called for both newly created and read-from-database (managed) objects, setting those params can overwrite field values read from the db - (that doesn't seem to be something one would want to do very often - perhaps its just a side effect of the implementation not intended to every really be used).
Also, it's not clear why only xxx-to-one fields get this treatment - why not have support for setting String, int, etc. fields too?
We have customized some of our Home class createInstance() functions to set various default values for certain fields. It would be instructive to know when Seam developers would instead advise initializing these variables in wire() instead?
NOTE to Seam developers: it would be very helpful if you could add an example in a future seam release that uses and extends seam-gen generated EntityHomes and views as a way to document how they are intended to be used (in addition to adding some Javadoc to the Home and EntityHome classes :)). Currently, each of the examples uses a different approach to DAO/Home interface, and none of the examples use these seamgen home beans, so it's hard to see what the seamgen framework's intent is.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4076441#4076441
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4076441
18Â years, 8Â months