[JBoss Seam] - Conversation times out, entity manager persists??
by whafrog
I have successfully avoided having the entity manager persist entity changes when the user quits a conversation on purpose, by coding as follows:
@End
| @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
| public String quit()
| {
| logger.debug("Quitting without saving");
| entityManager.clear();
| return PAGE_MAIN;
| }
|
However, when the conversation times out, the entity manager is flushed anyway. So I added the following to the starting method:
@Begin(join=true, flushMode=FlushModeType.MANUAL)
| @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
| public String startProcess()...
|
With flushMode set to true, in the method where I actually want persistence, I make sure to make a call to entityManager.flush();
Except any entity changes that are abandoned are still persisted after the conversation times out. What more must I do to keep the over zealous entity manager from persisting? And, larger question, why is this the default behavior?!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111344#4111344
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111344
18 years, 4 months
[Persistence, JBoss/CMP, Hibernate, Database] - XA-Datasource and MySQL Unknown Error
by jdbastin
I have a JBoss Seam application which uses two datasources, one Oracle and one MySQL, requiring the use of an xa-datasource. Everything worked fine when connecting to a MySQL 5 server but when I try to connect to a MySQL 4 server, I get the following error:
| [com.arjuna.ats.internal.jta.transaction.arjunacore.enliststarterror] [com.arjuna.ats.internal.jta.transaction.arjunacore.enliststarterror] TransactionImple.enlistResource - XAResource.start returned: [com.arjuna.ats.jta.utils.unknownerrorcode] Unknown error code:0 for < 131075, 26, 24, 1-1d060145:e81:475894cd:c81d060145:e81:475894cd:d2_
|
| com.mysql.jdbc.jdbc2.optional.MysqlXAException: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'XA START 0x312d31643036303134353a6538313a34373538393463643a6338
|
This used the 5.0.8 J/Connector driver since the 5.1.5 version causes JBoss to hang during startup. I have read in other forums that there have been xa-datasource issues related to the driver but I haven't found anything that specifically triggers that unknown error code. My datasource is defined as follows:
| <xa-datasource>
| <jndi-name>eventDBDatasource</jndi-name>
| <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
| <xa-datasource-property name="URL">${tm.event.db.url}</xa-datasource-property>
| <user-name>${tm.event.db.user}</user-name>
| <password>${tm.event.db.pass}</password>
| <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
| <track-connection-by-tx />
| <isSameRM-override-value>false</isSameRM-override-value>
| <no-tx-separate-pools>true</no-tx-separate-pools>
| <min-pool-size>5</min-pool-size>
| <max-pool-size>20</max-pool-size>
| <blocking-timeout-millis>5000</blocking-timeout-millis>
| <idle-timeout-minutes>15</idle-timeout-minutes>
| <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
| </xa-datasource>
|
|
Given I can't upgrade the MySQL server to 5.0, is there any configuration setting I can modify to get the XA SQL syntax to work with 4.0? I was hoping there was a config setting to make the SQL syntax generic enough so MySQL won't complain about it. Any help would be appreciated. Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111338#4111338
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111338
18 years, 4 months
[JBossWS] - Re: change HTTP status code in a WS fault
by derek.adams
The only way I could figure out to do it was to change the JBossWS source code in RequestHandlerImpl. It's a small change, but since it violates the "must return a 500 on fault" rule, I doubt it's going to get added as a perm fix. I wish there was a way to make flex work with the 500 error code :-( ... The fix is for the 2.0.0.GA source under org.jboss.wsf.stack.jbws.RequestHandlerImpl at line 287.. change it to..
if (httpResponse != null && code == null && isFault)
| {
| httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
| }
|
This way.. if the response code is set in a handler, it overrides the 500 response code. The only thing left to do is register a handler on the web service via the @HandlerChain annotation. The handler should have the following method...
/*
| * (non-Javadoc)
| *
| * @see javax.xml.ws.handler.Handler#close(javax.xml.ws.handler.MessageContext)
| */
| public void close(MessageContext context) {
| context.put(MessageContextJAXWS.HTTP_RESPONSE_CODE, new Integer(200));
| context.setScope(MessageContextJAXWS.HTTP_RESPONSE_CODE, Scope.APPLICATION);
| }
|
And.. voila.. it should work with Flex. Note that this will change all 500 responses from web services to 200s. A better approach might be to add code to the handler to check if it's Flex requesting the data (via the ServletRequst passed in the message context) and only change the code in that instance.
Hope that helps,
Derek
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111337#4111337
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111337
18 years, 4 months
[JBoss Seam] - Re: File upload to application folder
by nathandennis
pete, you said that a custom servlet is the best way to do this. i am working toward a high traffic environment and i need large amounts of space to store pictures. i was thinking of letting my upload function query my database for a suitable foreign server to store the picture on,,, and writing it down to the remote host.
here is my question. what is the problem with just letting apache deploy that content on the foreign host? wouldnt that be much quicker than executing more code?
these really arent images im worried about securing. i was thinking some really basic cookie authentication as more of a deterrent than a actually securing the data.
what do you think?? terabytes of pictures coming my way,,, how do i handle it and still be cost and performance effective?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111334#4111334
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111334
18 years, 4 months
[Security & JAAS/JBoss] - class cast exception
by jdsignature
Here is the issues:
the problem occurred from the customized login module to authenticate the user:
3:10:54,668 ERROR [CoyoteAdapter] An exception or error occurred in the container during the request processing
java.lang.ClassCastException: org.jboss.security.plugins.JaasSecurityManager
at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.authenticate(JBossSecurityMgrRealm.java:488)
at com.choicepoint.cpgs.shields.ShieldFormAuthenticator.authenticate(ShieldFormAuthenticator.java:162)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:416)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
Solutions to have JBoss fully JAVA EE Compliance: the JBoss container configurations must be modified as followings:
jboss-services.xml
<!-- The call by value mode. true if all lookups are unmarshalled using
the caller's TCL, false if in VM lookups return the value by reference.
-->
true
...
deploy/ear-deployer.xml
<!-- EAR deployer, remove if you are not using ear deployments -->
<!-- A flag indicating if ear deployments should have their own scoped
class loader to isolate their classes from other deployments.
-->
true
<!-- A flag indicating if the ear components should have in VM call
optimization disabled.
-->
true
deploy/jbossweb-tomcat55.sar/META-INF/jboss-service.xml
<!-- Get the flag indicating if the normal Java2 parent first class
loading model should be used over the servlet 2.3 web container first
model.
-->
true
true
<!-- A flag indicating if the JBoss Loader should be used. This loader
uses a unified class loader as the class loader rather than the tomcat
specific class loader.
-->
true
Can anybody provide any feedbacks on this topic, thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111331#4111331
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111331
18 years, 4 months