[Persistence, JBoss/CMP, Hibernate, Database] - Re: Could not find datasource message in client JPA although
by ezanih
Sorry, Jaziran..it's my fault..I should have explained more clearly.
Ok here's the big picture:-
For now everything (server and client and db) is run on one PC - which is my PC running WinXP. The production version will have clients and server on separate PCs with a remote interface but that's later. I am using JDK5.14, Eclipse Ganymede and JBoss GA 4.2.2 and OracleXE.
I want to create a JPA entity app first, get it working and then test it with a Java Application client. The whole app is much larger (a bidding auction involving JBoss ESB, jBPM and JRules among others),but for starters, I am just interested in getting the main engine working. So I start with the JPA entities routine and I just want to get to the point where the entities can be inserted/added, modified, deleted and searched (now through a Java Application client but later through a stateless EJB3 simply by adding the @Stateless annotation once the Java App client works.
My server-side or JPA Entity project is called BiddingTest and consists only of Bidder.java, a simple bidder entity class with Bidder ID and Bidder name as the fields (as listed above). I used Enterprise Application Project wizard from Eclipse to create this server-side and linked it to an EAR5 project called BiddingTestEAR.
Initially I did my client app as another Java class within the server-side but it did not make sense so I created a separate Application Client project in Eclipse and referenced it to the above server-side project. I referenced this client side too, to the same EAR5 project,BiddingTestEAR as above. The name of the client project is called BiddingClient and there is only one class with main() in it, its name is BidClient.java.
In BiddingTest module/project, I have persistence.xml with a unit name of "BiddingTest". In my oracle-ds.xml file under server\default\deploy, I have :
| <jta-data-source>java:/OracleXE1_DS</jta-data-source>
|
so my javax.sqlDataSource's JNDI name is OracleXE1_DS.
The JBoss container has its own unique customization so you have to add jboss-client.xml and application-client.xml to the client project's META-INF directory. I also have my jndi.properties file here but I duplicated the properties code in BidClient.java.
In the EAR module, BiddingTestEAR, under its META-INF folder I have my application.xml file.
I linked BiddingTestEAR to the JBoss 4.2.2 Server in Eclipse and when I started the server, the server-side BiddingTest (comprising of the entity Bidder.java class) deploys OK and I can see the BIDDER table schema created in my OracleXE db. However of course, its contents are blank (it has no records).
So I then fired up my client application by running it as a Java Application and it has given me a string of errors since my first posting on this forum. The adventure has taken me all the way to understanding that :-
(a) You need to get the right combination of Hibernate components from the Hibernate Compability Matrix
(b) You need to add jbossclient-all.jar and a string of specific jars to the classpath of the client (no beginner would no this the first time !!!)
(c) You need to have application-client.xml and jboss-client.xml in the client's META-INF
So although my server side entity creating table program (BiddingTest) is working, I am unable to insert records (for starters!) from a client program (BiddingClient). My jta datasource is called OracleXE1_DS.
Up to this point in time, I am confused as to this portion of the code :-
| InitialContext cx = new InitialContext();
|
I know this initializes the java naming in JBoss.
But then I don't know what to "lookup" after the code above. Do I look up the JNDI-bound datasource name as such (which I defined in my persistence.xml and my oracle-ds.xml) :-
| DataSource obj = (DataSource) ctx.lookup("java:OracleXE1_DS");
|
or do I lookup my Java App client project name (nothing to do with datasource) as such :-
| Object obj = ctx.lookup("java:BiddingClient");
|
I know that my entity class is called Bidder.java. So instead of the above 2 code snippets, do i do this instead :-
| Bidder bidder = (Bidder) ctx.lookup(Bidder.class.getName());
|
Up to this point, I have gotten rid of that annoying "Unable to find datasource" error message and I am only getting "BiddingClient not bound" and "OracleXE1_DS not bound" so it is just a case of getting the JNDI naming right for the client or probably the datasource.
All the code to this project are as I have posted from the beginning should you wish to refer.
This should be an easy project as it is just simple JPA entity creation but I guess running it as a Java EE on JBoss adds a layer of complexity!
Please help! Where am I going wrong ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4199441#4199441
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4199441
17 years, 3 months
[JBoss jBPM] - process variable persistance
by aspider
I define several process variable in process
I found that if variable type is String value, the persistance in table jbpm_variableinstance is OK , I can read their value from the way as below codes.
if variable type is other types, such as Boolean/List, the result is always null.
Boolean type is in table jbpm_variableinstance is S type, same as String type variable, having T/F value.
While List type is B type in table, having null value.
Whats the problem? And how to save this kind of process varible.
Thanks a lot.
| ProcessInstance pi = jbpmContext.getProcessInstance(new Long("xxxx"));
| String originator = (String)pi.getContextInstance().getVariable("originator");
| BooleanisDelegated = (Boolean)pi.getContextInstance().getVariable("isDelegated");
| List delegators = (List)pi.getContextInstance().getVariable("delegators");
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4199440#4199440
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4199440
17 years, 3 months
[JBossWS] - java.lang.ClassCastException: org.jboss.ws.core.jaxws.spi.Se
by rodosa
Hello!
I've a problem. I've two jboss. Jboss 4.0.5 and Jboss jBPM 3.2.3. The Jboss 4.0.5 access to jBPM web services but .... when the session beans of jBPM try to access to WS of JBoss 4.0.4, the following exception it's thown:
| 01:11:30,437 ERROR [STDERR] java.lang.ClassCastException: org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl cannot be cast to javax.xml.ws.spi.ServiceDelegate21
| 01:11:30,437 ERROR [STDERR] at javax.xml.ws.Service.<init>(Service.java:82)
| 01:11:30,437 ERROR [STDERR] at com.ideit.modules.cmmi.requirements.session.ProductWS_Service.<init>(ProductWS_Service.java:40)
| 01:11:30,437 ERROR [STDERR] at com.ideit.modules.cmmi.jbpm.requirements.session.JbpmSessionBean.createInstance(JbpmSessionBean.java:140)
| 01:11:30,437 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 01:11:30,453 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 01:11:30,453 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 01:11:30,453 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
| 01:11:30,453 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
| 01:11:30,453 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
| 01:11:30,468 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
| 01:11:30,468 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 01:11:30,468 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
| 01:11:30,468 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 01:11:30,468 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
| 01:11:30,468 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 01:11:30,468 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
| 01:11:30,468 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
| 01:11:30,468 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 01:11:30,468 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
| 01:11:30,468 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 01:11:30,468 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
| 01:11:30,468 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 01:11:30,468 ERROR [STDERR] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
| 01:11:30,468 ERROR [STDERR] at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
| 01:11:30,468 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 01:11:30,468 ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
| 01:11:30,468 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 01:11:30,468 ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| 01:11:30,468 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 01:11:30,468 ERROR [STDERR] at org.jboss.wsf.container.jboss42.InvocationHandlerEJB3.invoke(InvocationHandlerEJB3.java:103)
| 01:11:30,468 ERROR [STDERR] at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:220)
| 01:11:30,468 ERROR [STDERR] at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:408)
| 01:11:30,468 ERROR [STDERR] at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:272)
| 01:11:30,468 ERROR [STDERR] at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:189)
| 01:11:30,468 ERROR [STDERR] at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:122)
| 01:11:30,468 ERROR [STDERR] at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
| 01:11:30,468 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
| 01:11:30,468 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
| 01:11:30,468 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| 01:11:30,468 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| 01:11:30,468 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| 01:11:30,468 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| 01:11:30,468 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
| 01:11:30,468 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
| 01:11:30,468 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
| 01:11:30,468 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
| 01:11:30,468 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
| 01:11:30,468 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
| 01:11:30,468 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
| 01:11:30,468 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
| 01:11:30,468 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
| 01:11:30,468 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
| 01:11:30,468 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
| 01:11:30,468 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
| 01:11:30,468 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
|
I build a junit class that acces to the WS deployed in jboss 4.0.5, and this work. I suposse that it could be a problem of libraries but I don't know how to fix it. Could someone help me??
Thank you very much
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4199436#4199436
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4199436
17 years, 3 months