[EJB 3.0] - Re: mappedBy reference an unknown target entity property
by smix007
Hello,
you use @idClass. Whereas in my code I use @Embeddable and @EmbeddedId I thus seek a solution with my problem of joint for the following code:
@Embeddable
| public class TermProjPK implements Serializable {
| private String auiw;
| @Column(name = "AUIS", nullable = false)
| private String auis;
public class TermProj implements Serializable {
| @EmbeddedId
| private TermProjPK termProjPK;
| //jointure avec la table TermSource
| @ManyToOne
| @JoinColumn (name = "AUIW")
| private TermSource auiw;
| public TermSource getAuiw() {
| return auiw;
| }
|
| public void setAuiw(TermSource auiw) {
| this.auiw = auiw;
| }
|
|
| //jointure avec la table SnomedInter
| @ManyToOne
| @JoinColumn (name = "AUIS")
| private SnomedInter auis;
| public SnomedInter getAuis() {
| return auis;
| }
|
| public void setAuis(SnomedInter auis) {
| this.auis = auis;
| }
| @Column(name = "MODIF")
| private String modif;
|
| @Column(name = "SRC", nullable = false)
| private String src;
public class TermSource implements Serializable {
| @Id
| @Column(name = "AUIW", nullable = false)
| private String auiw;
| @OneToMany(mappedBy="AUIW")
| private Collection<TermProj> termProjs;
|
| public Collection<TermProj> getTermProjs() {
| return termProjs;
| }
|
| public void setTermProjs(Collection<TermProj> termProjs) {
| this.termProjs = termProjs;
| }
public class SnomedInter implements Serializable {
| @Id
| @Column(name = "AUIS", nullable = false)
| private String auis;
| @OneToMany(mappedBy="AUIS")
| private Collection<TermProj> termProjs;
|
| public Collection<TermProj> getTermProjs() {
| return termProjs;
| }
|
| public void setTermProjs(Collection<TermProj> termProjs) {
| this.termProjs = termProjs;
| }
I have the error message according to
org.hibernate.AnnotationException: mappedBy reference an unknown property: ejb.entity.TermProj.AUIS in ejb.entity.SnomedInter.AUIS
| ,
thank you in advance
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991294#3991294
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3991294
18 years, 1 month
[JBoss Seam] - EJB3StandaloneBootstrap - java.lang.IllegalArgumentExceptio
by eiswind70
I try to set up some Junit tests for our SEAM Project. I struggle now even with the CVS relase from 20061204 with the following exception :
java.lang.RuntimeException: java.lang.RuntimeException: Unable to create a KernelInitializer based on the specified KernelConfig
at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.boot(EJB3StandaloneBootstrap.java:391)
at org.jboss.seam.core.Ejb.startup(Ejb.java:41)
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:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:102)
at org.jboss.seam.Component.callComponentMethod(Component.java:1759)
at org.jboss.seam.Component.callCreateMethod(Component.java:1707)
at org.jboss.seam.Component.newInstance(Component.java:1696)
at org.jboss.seam.contexts.Lifecycle.startup(Lifecycle.java:153)
at org.jboss.seam.contexts.Lifecycle.endInitialization(Lifecycle.java:127)
at org.jboss.seam.init.Initialization.init(Initialization.java:408)
at com.hp.junit.SeamTestCase.setUpSeam(SeamTestCase.java:42)
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:585)
at org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
at org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.RuntimeException: Unable to create a KernelInitializer based on the specified KernelConfig
at org.jboss.kernel.KernelFactory.createKernelInitializer(KernelFactory.java:139)
at org.jboss.kernel.KernelFactory.assembleNewKernel(KernelFactory.java:81)
at org.jboss.kernel.KernelFactory.newInstance(KernelFactory.java:48)
at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.bootstrap(AbstractBootstrap.java:122)
at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:87)
at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.createKernel(EJB3StandaloneBootstrap.java:422)
at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.boot(EJB3StandaloneBootstrap.java:375)
... 34 more
Caused by: java.lang.NullPointerException
at org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactoryImpl.getTypeInfo(IntrospectionTypeInfoFactoryImpl.java:221)
at org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory.getTypeInfo(IntrospectionTypeInfoFactory.java:44)
at org.jboss.classadapter.plugins.reflect.ReflectClassAdapterFactory.getClassAdapter(ReflectClassAdapterFactory.java:46)
at org.jboss.kernel.plugins.config.AbstractKernelConfig.getBeanInfo(AbstractKernelConfig.java:57)
at org.jboss.kernel.plugins.config.property.PropertyKernelConfig.getImplementation(PropertyKernelConfig.java:140)
at org.jboss.kernel.plugins.config.property.PropertyKernelConfig.createKernelInitializer(PropertyKernelConfig.java:108)
at org.jboss.kernel.KernelFactory.createKernelInitializer(KernelFactory.java:133)
... 40 more
this is my code for the unit test environment (stolen from the TestNG SeamTest)
| @Before public void setUpSeam(){
| application = new MockApplication();
| application.setStateManager( new SeamStateManager( application.getStateManager() ) );
| application.setNavigationHandler( new SeamNavigationHandler( application.getNavigationHandler() ) );
| //don't need a SeamVariableResolver, because we don't test the view
| phases = createPhaseListener();
|
| servletContext = new MockServletContext();
| initServletContext( servletContext.getInitParameters() );
| new Initialization(servletContext).init();
| Lifecycle.setServletContext(servletContext);
|
| //conversationStates = new HashMap<String, ConversationState>();
|
| }
|
can anyone point me a direction ? I have completely no idea !
Thx
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991290#3991290
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3991290
18 years, 1 month
[Messaging, JMS & JBossMQ] - Singleton MDB being run in two threads
by antont
using: jboss 4.0.3SP1 (on linux) and 4.0.4 and 4.0.5 GAs (on winxp)
I have configured a MDB to be a singleton as instructed in the FAQ, with the <configuration-name>Singleton Message Driven Bean</configuration-name> directive in jboss.xml .
When configured so, that MDB is being run in max. two threads in parallel, instead of one. If I remove the singleton configuration, it starts to use up to X threads.
As a test case I have a MDB that receives messages from a queue, and waits 10 seconds as to simulate long-running processing, and prints Thread.currentThread.getId() before and after that loop. The messages are sent by a Quartz job, but I think that is irrelevant because only thing that matters for MDB execution is that messages are put to the queue. Debug output from a test case shows that even tho configured as a singleton it runs in two parallel threads. In this example I use a test servlet to quickly schedule 3 message sendings to occur after 1 second, and then we see that two threads are used to execute those commands:
15:31:11,734 INFO [STDOUT] Scheduling Job ..
| 15:31:12,218 INFO [STDOUT] Job scheduled now, to be run in 1 seconds ..
| 15:31:12,234 INFO [STDOUT] Scheduling Job ..
| 15:31:12,234 INFO [STDOUT] Job scheduled now, to be run in 1 seconds ..
| 15:31:12,328 INFO [STDOUT] Scheduling Job ..
| 15:31:12,328 INFO [STDOUT] Job scheduled now, to be run in 1 seconds ..
| 15:31:12,906 INFO [TaskexecCommandRunnerBean] Starting dummy task exec (waits for 10 secs) in thread 70
| 15:31:13,593 INFO [TaskexecCommandRunnerBean] Starting dummy task exec (waits for 10 secs) in thread 37
| 15:31:22,906 INFO [TaskexecCommandRunnerBean] .. done in thread 70
| 15:31:22,921 INFO [TaskexecCommandRunnerBean] Starting dummy task exec (waits for 10 secs) in thread 70
| 15:31:23,593 INFO [TaskexecCommandRunnerBean] .. done in thread 37
| 15:31:32,921 INFO [TaskexecCommandRunnerBean] .. done in thread 70
|
When I change nothing else, but comment out the singleton config (<!-- configuration-name>Singleton Message Driven Bean</configuration-name-->), redeploy and execute the same thing, the behaviour changes correctly. In this example I schedule 5 executions, and they are all executed in parallel in their own threads:
| 15:41:32,609 INFO [STDOUT] Scheduling Job ..
| 15:41:32,625 INFO [STDOUT] Job scheduled now, to be run in 1 seconds ..
| 15:41:32,906 INFO [STDOUT] Scheduling Job ..
| 15:41:32,906 INFO [STDOUT] Job scheduled now, to be run in 1 seconds ..
| 15:41:33,296 INFO [STDOUT] Scheduling Job ..
| 15:41:33,296 INFO [STDOUT] Job scheduled now, to be run in 1 seconds ..
| 15:41:33,609 INFO [STDOUT] Scheduling Job ..
| 15:41:33,625 INFO [STDOUT] Job scheduled now, to be run in 1 seconds ..
| 15:41:33,750 INFO [TaskexecCommandRunnerBean] Starting dummy task exec (waits for 10 secs) in thread 109
| 15:41:33,984 INFO [STDOUT] Scheduling Job ..
| 15:41:33,984 INFO [STDOUT] Job scheduled now, to be run in 1 seconds ..
| 15:41:34,015 INFO [TaskexecCommandRunnerBean] Starting dummy task exec (waits for 10 secs) in thread 118
| 15:41:34,359 INFO [TaskexecCommandRunnerBean] Starting dummy task exec (waits for 10 secs) in thread 127
| 15:41:34,875 INFO [TaskexecCommandRunnerBean] Starting dummy task exec (waits for 10 secs) in thread 136
| 15:41:35,046 INFO [TaskexecCommandRunnerBean] Starting dummy task exec (waits for 10 secs) in thread 145
| 15:41:43,750 INFO [TaskexecCommandRunnerBean] .. done in thread 109
| 15:41:44,015 INFO [TaskexecCommandRunnerBean] .. done in thread 118
| 15:41:44,359 INFO [TaskexecCommandRunnerBean] .. done in thread 127
| 15:41:44,875 INFO [TaskexecCommandRunnerBean] .. done in thread 136
| 15:41:45,046 INFO [TaskexecCommandRunnerBean] .. done in thread 145
|
Am I overlooking / misunderstanding something, or is this a bug?
One reason why I did not post this as a bug report (yet) is that there seems to be a known issue with EJB3 and JMS producing similar behaviour, http://jira.jboss.org/jira/browse/JBAS-3327 "maxSessions=1 in JMS activation spec creates multiple MDBs" and that bug report is closed as 'wont fix' because of some on-going work with ejb3s or something (i did not read the discussion too closely).
Can it be that this is resulting from that known jboss issue, even though I am not using EJB3? The linux server here with 4.0.3 SP1 produces the same behaviour even though it does not have ejb3 things installed. On a development winxp laptop I have reproduced this with both 4.0.4 and 4.0.5 GAs, without ejb3.
When using EJB3 and the @ActivationConfigProperty(propertyName = "MaxSession", propertyValue = "1") I get what JBAS-3327 describes, i.e. 2 threads (and n+1 with other values). And yes I tried putting a 0 there too which resulted in no MDBs being invoked :) (after reading the discussion regarding the bug i know why)
Is this a known issue? I could not find any solution on this forum or elsewhere. Is there anything I can do to make it working, is it working correctly for others?
hoping that the question / report is clear,
~Toni
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991289#3991289
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3991289
18 years, 1 month
[JBoss Seam] - <si:selectItems ...>
by toni
Hi,
I read the wiki on how to use the <si:selectItems> several times, looked at the examples, but I still run into the following excepiton:
javax.faces.FacesException: value must be iteratable
But I'm returning a List, which is iteratable. I'm using JBoss 4.04GA, with Seam 1.0.1 GA and 1.1.1beta2 of selectItems.
Does somebody see anything wrong with code here:
The function to build the List:
----------------------------------------
@SuppressWarnings("unchecked")
@Factory("clients")
public List buildClients()
{
List client = entityManager.createQuery("from Client").getResultList();
return client;
}
The JSP snippet, which causes the exception
---------------------------------------------------
<h:selectOneMenu value="#{clientsActionBean.client}" required="false">
<si:selectItems value="#{clients}" var="c" label="#{c.name}" noSelectionLabel="Please Select..."/>
</h:selectOneMenu>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991287#3991287
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3991287
18 years, 1 month