[JBoss Seam] - Hibernate MappingException with javassist altered class
by alllle
I think this one definitely needs some insights from the Seam team.
I have to use a Hibernate mapping file instead of EJB3 Entity class in order to take advantage of my existing project code.
When persisting a Seam annotated POJO, which is mapped in the Hibernate mapping file, I receives a MappingException: Unknown entity: com....MyPojoClass_$$_javassist_1
Trace into the Hibernate code, I found out the following:
1. The mapping of my class MyPojoClass is loaded properly after examining the Hibernate entityPersisters map.
2. When retrieving the class name, Hibernate gets a name of MyPojoClass_$$_javassist_1 instead of just MyPojoClass. This cause the Hibernate to throw exception as it can not find this class name in its entityPersisters map.
Why javassist alters the classname it returns from the object.getClass().getName() call?
This is a road blocker and I can't not seem to bypass this error. Please help!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4113560#4113560
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4113560
18 years, 4 months
[JBoss Seam] - Re: FlushModeType.MANUAL in conversation
by kai222
I solved it myself by manually switching the entityManager.setFlushMode just before the query invocation:
| ...
| private boolean emailExists() {
| entityManager.setFlushMode(javax.persistence.FlushModeType.COMMIT);
| List<String> existing = (List<String>)
| entityManager.createQuery("from MyUser u where u.email = :email)")
| .setParameter("email", selectedUser.getEmail())
| .getResultList();
| if(existing.size() != 0) {
| facesMessages.add("#{messages['NewEmailExists']}" + selectedUser.getEmail());
| return true;
| }
| return false;
| }
| ...
|
Switching to COMMIT for an EntityManager disables automatic synchronization before queries.
Please note that it is the javax.persistence.FlushModeType class, not from Seam.
This is not the most elegant way but it fixes my problem now. I would highly appreciate the opinion of an expert...
Is the dysfunction of org.jboss.seam.annotations.FlushModeType.MANUAL a bug in Seam?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4113559#4113559
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4113559
18 years, 4 months
[JBossWS] - howto: soap header wsdl required=true
by johper
Tried wsconsume, dont know how to populate ws call with soap header required auth info? This Auth info is passed explicit with stubs generated by Axis2.
Description:
MS WSDL part:
=============
- <wsdl:operation name="GetCustomer">
<soap:operation soapAction="http://ibs.entriq.net/Customers/ICustomersService/GetCustomer" style="document" />
- <wsdl:input>
<soap:header wsdl:required="true" message="i0:AuthHeader_Message" part="AuthenticationHeader" use="literal" />
<soap:header wsdl:required="true" message="i0:CacheControlHeader_Message" part="CacheControlHeader" use="literal" />
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
- <wsdl:fault name="AuthenticationFaultFault">
<soap:fault name="AuthenticationFaultFault" use="literal" />
</wsdl:fault>
- <wsdl:fault name="IBSFaultFault">
<soap:fault name="IBSFaultFault" use="literal" />
</wsdl:fault>
- <wsdl:fault name="SystemFaultFault">
<soap:fault name="SystemFaultFault" use="literal" />
</wsdl:fault>
- <wsdl:fault name="PermissionFaultFault">
<soap:fault name="PermissionFaultFault" use="literal" />
</wsdl:fault>
</wsdl:operation>
wsconsume:
===========
wsconsume -k -v -p com.ibs6proxy.customers http://ibsinterprit/ASM/ALL/Customers.svc?wsdl
wsconsume gen Java Interface:
=============================
@WebMethod(operationName = "GetCustomer", action = "http://ibs.entriq.net/Customers/ICustomersService/GetCustomer")
@WebResult(name = "GetCustomerResult", targetNamespace = "http://ibs.entriq.net/Customers")
@RequestWrapper(localName = "GetCustomer", targetNamespace = "http://ibs.entriq.net/Customers", className = "com.ibs6proxy.customers.GetCustomer")
@ResponseWrapper(localName = "GetCustomerResponse", targetNamespace = "http://ibs.entriq.net/Customers", className = "com.ibs6proxy.customers.GetCustomerResponse")
@Action(input = "http://ibs.entriq.net/Customers/ICustomersService/GetCustomer", output = "http://ibs.entriq.net/Customers/ICustomersService/GetCustomerResponse", fault = {
@FaultAction(className = ICustomersServiceGetCustomerAuthenticationFaultFaultFaultMessage.class, value = "http://ibs.entriq.net/Customers/ICustomersService/GetCustomerAuthenticati..."),
@FaultAction(className = ICustomersServiceGetCustomerIBSFaultFaultFaultMessage.class, value = "http://ibs.entriq.net/Customers/ICustomersService/GetCustomerIBSFaultFault"),
@FaultAction(className = ICustomersServiceGetCustomerSystemFaultFaultFaultMessage.class, value = "http://ibs.entriq.net/Customers/ICustomersService/GetCustomerSystemFaultF..."),
@FaultAction(className = ICustomersServiceGetCustomerPermissionFaultFaultFaultMessage.class, value = "http://ibs.entriq.net/Customers/ICustomersService/GetCustomerPermissionFa...")
})
public Customer getCustomer(
@WebParam(name = "customerId", targetNamespace = "http://ibs.entriq.net/Customers")
Integer customerId)
throws ICustomersServiceGetCustomerAuthenticationFaultFaultFaultMessage, ICustomersServiceGetCustomerIBSFaultFaultFaultMessage, ICustomersServiceGetCustomerPermissionFaultFaultFaultMessage, ICustomersServiceGetCustomerSystemFaultFaultFaultMessage
;
Java client code:
=================
com.ibs6proxy.customers.CustomersService cs = new com.ibs6proxy.customers.CustomersService();
com.ibs6proxy.customers.ICustomersService iCustomersService = cs.getBasicHttpBindingICustomersService();
// Get BindingProvider.
//javax.xml.ws.BindingProvider bp = (javax.xml.ws.BindingProvider) iCustomersService;
//bp.getRequestContext().put("AuthenticationHeader", ah2);
//System.out.println("AuthenticationHeader set ...");
// get customer.
com.ibs6proxy.customers.Customer customer = iCustomersService.getCustomer(10840);
This is the exception:
----------------------
com.ibs6proxy.customers.ICustomersServiceGetCustomerAuthenticationFaultFaultFaultMessage: The current identity is not a
BusinessIdentity. No user authenticated.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at org.jboss.ws.metadata.umdm.FaultMetaData.toServiceException(FaultMetaData.java:384)
at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.getSOAPFaultException(SOAPFaultHelperJAXWS.java:128)
at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.throwFaultException(SOAP11BindingJAXWS.java:109)
at org.jboss.ws.core.CommonSOAPBinding.unbindResponseMessage(CommonSOAPBinding.java:553)
at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:371)
at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:243)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:164)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)
at $Proxy25.getCustomer(Unknown Source)
at WS.main(WS.java:46)
Signature for same method generated by Axis2 (auth param passed explicit) works fine:
=====================================================================================
public com.ibs6proxy.customers.CustomersServiceStub.GetCustomerResponse GetCustomer(
com.ibs6proxy.customers.CustomersServiceStub.GetCustomer getCustomer,
com.ibs6proxy.customers.CustomersServiceStub.AuthenticationHeader29 authenticationHeader84,
com.ibs6proxy.customers.CustomersServiceStub.CacheControlHeader24 cacheControlHeader85)
C# .NET client working fine:
=============================
CustomersService client = new CustomersService();
AuthenticationHeader authHeader = new AuthenticationHeader();
authHeader.UserName = "test";
authHeader.Proof = "test";
authHeader.Dsn = "Training";
client.AuthenticationHeaderValue = authHeader;
Customer customer = client.GetCustomer(10840, true);
MessageBox.Show("from service:" + customer.InternetUserId.ToString());
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4113550#4113550
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4113550
18 years, 4 months
[JBoss Seam] - Couple of basic questions to help understand Seam
by alllle
I just started using Seam. With the great potential it offers, I do run into some problems, partly due to my specific configuration, and partly due to that I missing some basic understanding of its concept.
Here are some questions I have and any help is appreciated:
1. How to use, and what is the purpose of defining a scope in the component class?
When using a component as an attribute of the Action component in webapp, the attribute component will either be given an explicit scope, or it will be the same as the scope of the Action component. These overwrites the scope defined for the component, doesn't it? If so, what do I need to consider when defining the default scope of the component?
2. Action specified in pages.xml for the page is not invoked?
In pages.xml I specified:
| <page view-id="/firstpage.xhtml" action="actionComponent.begin">
| <description>Create new Itemdescription>
| ....
| [/page]
|
I assumes that the actionComponent.begin() method will be invoked before the page is rendered. However, it's not the case. It was never invoked. What did I do wrong?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4113540#4113540
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4113540
18 years, 4 months