[JBossWS] - Re: 1.0.2: Exception when client receives a JavaBean
by anatoly.osiko
I have found this feature of JBossWS empirically as well, whatever worked with the Axis based ws4jee stopped working .... JBossWS appears to be strictly adheres to XML Schema definitions. Which is good. The by definition defines not only the elements it contains, but also their order (compare with ). Therefore the missing element in the message raises the error (on schema validation I guess), unless it explicitly defined with nillable="yes" attribute.
In the latter case, the element would be inserted in the message as 'nil' element, of course.
So the above is the solution. But not exactly.
There is a subtle case with the primitive types. If you expect the JavaBean to contain a primitive type, e.g. int, then - don't, if it's declared as nillable. The primitive type element declared in the schema as nillable, will be generated as a Java object wrapper, e.g. Integer. As it should be. If your insist that property in JavaBean still be an int, then don't declare it nillable, but make sure it is always included in the resulting message.
Of course, the above doesn't effect xsd:string.
PS I wonder if there is a way to switch the schema validation off? May that will also increase the speed of JAXB processing.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961454#3961454
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961454
19 years, 9 months
[JBoss Seam] - ejb3trail persistence error
by mishelangelo
whenever i try running jsp files that use session beans to access and retrieve persistent (o/r) entities, i get exceptions usu with root cause: NullPointerException on the line where the an entity should have been initialized from a method call to a session bean.
| HTTP Status 500 -
|
| type Exception report
|
| message
|
| description The server encountered an internal error () that prevented it from fulfilling this request.
|
| exception
|
| org.apache.jasper.JasperException: Exception in JSP: /persistence/entitymanager/addfund.jsp:45
|
| 42:
| 43: <%
| 44: // Collection <Fund> funds = cal.getFunds();
| 45: Collection funds = cal.getFunds();
| 46: %>
| 47:
| 48: There are <b><%=funds.size()%></b> funds in the database.<br/>
|
|
| Stacktrace:
| org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
| org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
| org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
| org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
| javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
|
| root cause
|
| java.lang.NullPointerException
| org.apache.jsp.persistence.entitymanager.addfund_jsp._jspService(addfund_jsp.java:89)
| org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
| javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
| org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
| org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
| javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
|
|
I dont see anything wrong with
| 45: Collection funds = cal.getFunds();
|
in and of itself.... but what do i know.... :)
Does anyone have any idea why? I'm kinda like a total j2ee newbie
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961453#3961453
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961453
19 years, 9 months
[Beginners Corner] - Is there a way of configuring multiple application instances
by steven.kitchen
>From a standing start on J2EE, never mind JBoss.
We have a web service using a single SLSB to extract information through Hibernate. We want to be able to deploy separate instances of the same app. to JBoss (Live, Training) and potentially different versions (Live, Test next version). The conventional (non J2EE) approach would be to run an application in an environment that set its configuration, i.e. the environment changes, not the application deployment. Point 3 in section 5.2 Java Naming and Directory Interface? (JNDI) Naming Context of the J2EE 1.4 spec referred to in section 3.6. J2EE and JNDI - The Application Component Environment of the jboss4guide would seem to suggest that the ENC (java:comp/env) is the way to achieve this:
?The Deployer uses the tools provided by the container to initialize the environment
entries that are declared in the application component?s deployment descriptor.
The Deployer can set and modify the values of the environment
entries.?
However, the documentation uses jboss.xml and jboss-web.xml descriptors to set the ENC. As these would appear to have to be in the EAR or WAR, it requires a different EAR or WAR for each application instance, i.e. the application deployment is changed to change the environment. Can the setting of the ENC be moved out of the EAR or WAR?
The other approach I am considering is to use an MBean (again, not something I familiar with) for each application instance. I can envisage setting different Hibernate session factories on application instances using an MBean, but I can?t image how to deploy the required classes, and I can?t conceive of configuring the web application (which is not my area of expertise anyway).
So, which is the more viable approach to configuring application instances without changing the EAR: ENC or MBean, or is the whole approach misconceived and I should accept changing the EAR for different application instances.
I?d be grateful for any advice that can point me in the right direction.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961452#3961452
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961452
19 years, 9 months
[Management, JMX/JBoss] - Unable to Obtain JMX MBean for Servlet Info
by Martinator
Hi, I'm trying to pull servlet statistics from JMX. The process works great for ServerInfo as follows:
MBeanServer lBeanServer = org.jboss.mx.util.MBeanServerLocator.locateJBoss();
| ObjectName lBeanName = new ObjectName("jboss.system:type=ServerInfo");
| Object lAttribute = lBeanServer.getAttribute(lBeanName, "FreeMemory");
It will not work for getting servlet statistics:
MBeanServer lBeanServer = org.jboss.mx.util.MBeanServerLocator.locateJBoss();
| ObjectName lBeanName = new ObjectName("jboss.web:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/xxxxxx,j2eeType=Servlet,name=default");
| Object lAttribute = lBeanServer.getAttribute(lBeanName, "requestCount");
I reproduced the string exactly as it appears in the JBoss Console. When I run it it tells me that "default is not registered."
I'm running JBoss 3.2.4 and Java 1.4.2_03.
Can anyone help?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961451#3961451
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961451
19 years, 9 months
[JBoss Seam] - Re: @OneToMany Question
by Holger Prause
Hello
anonymous wrote :
| It sounds like you want a ManyToMany relation. If Tasks can have many TaskItems and a TaskItem can be associated with more than one Task this is a ManyToMany relation, not a OneToMany.
|
Hmm but the TaskItem dont have any information about the task it owns
(no getTask() method) and its not biderectional.I shoudl learn sth about database design.
Thx for giving me the right hint i changed my code to:
| @ManyToMany(
| targetEntity=TaskItem.class,
| cascade={CascadeType.PERSIST, CascadeType.MERGE}
| )
| @JoinTable(
| name="task_taskItems",
| joinColumns = { @JoinColumn( name="task_id", unique = false)},
| inverseJoinColumns = @JoinColumn( name="taskItem_id", unique = false)
| )
|
and now its working - no complaining anymore about duplicated entry.
Thank u very much, helped me a lot and sorry for posting in wrong forum.
Bye,
Holger
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961449#3961449
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961449
19 years, 9 months
[EJB 3.0] - Re: Problem using SequenceGenerator
by bryan_castillo
Ok, now I know whats going on.
To summarize, I thought that a generated id coming from a sequence in EJB would be the same as the physical value of the sequence. But the sequence generator actually takes the value from the database sequence and multiplies it by the allocationSize. As long as every program, (or chunk of code) using that sequence uses the same multiplier you will be safe. The SequenceHiLoGenerator keeps the last sequence number in memory and just increments the sequence number in memory, and pulls a new physical sequence when it uses allocationSize numbers since the last pull from the physical sequence.
If I want the generator to produce the same number as the sequence (so the code will not conflict with other non-java code using the sequence), than I can set the allocationSize to 1. Then I will not need a hibernate specific annotation.
This works for me:
| @Id
| @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="VNDR_ID_SEQ")
| @SequenceGenerator(name="VNDR_ID_SEQ", sequenceName="VRAP.VNDR_ID_SEQ", allocationSize=1)
| @Column(name="VNDR_ID")
| public int getId() {
| return id;
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961446#3961446
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961446
19 years, 9 months
[JBoss jBPM] - Re: JBPM-BPEL 1.1-beta1 and JBOSS AS 4.0.4 helloworldservice
by alex.guizar@jboss.com
I was using JDK 1.5.0_05. I upgraded to JDK 1.5.0_07 and I hit the IncompatibleClassException. It looks like they changed the behavior at some release after JDK 1.5.0_05. A note in the javax.xml.namespace.QName source code explains:
anonymous wrote : * Due to a historical defect, QName was released with multiple
| * serialVersionUID values even though its serialization was the
| * same.
| *
| * To workaround this issue, serialVersionUID is set with either
| * a default value or a compatibility value. To use the
| * compatiblity value, set the system property:
| *
| * com.sun.xml.namespace.QName.useCompatibleSerialVersionUID=1.0.
Running the tests with the aforementioned system property set fixes the incompatibility problem:
- Set the ANT_OPTS environment property to -Dcom.sun.xml.namespace.QName.useCompatibleSerialVersionUID=1.0 so that the ant batch file/shell script passes the system property to the JVM.
- Execute target run-test. You will notice JBossWS requires some Xerces class not included in the JDK, so you still need Xerces on the classpath.
- Replace BPEL_HOME/doc/examples/process.template.xml with the file attached to the jBPM BPEL beta 1 addendum wiki page.
- Execute run-test again. It should work this time.
Alternatively, you can use the endorsed standards override mechanism. Endorsing seems easier than the above procedure. I will recommend endorsing in future BPEL releases.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961444#3961444
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961444
19 years, 9 months