[Datasource Configuration] - Oracle timezone problems & JBoss
by Martin Novák
Martin Novák [http://community.jboss.org/people/martinnovak] created the discussion
"Oracle timezone problems & JBoss"
To view the discussion, visit: http://community.jboss.org/message/580959#580959
--------------------------------------------------------------
Hello, we have a database that contains a table with a column of type TIMESTAMP WITH LOCAL TIME ZONE. We have two applications, one runs on Glassfish and works well. But the other one runs on JBoss 4.2.3, and we are getting the following error:
Caused by: java.sql.SQLException: The database session time zone is not set
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:271)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:445)
at oracle.jdbc.driver.TimestampltzAccessor.getTimestamp(TimestampltzAccessor.java:298)
at oracle.jdbc.driver.OracleResultSetImpl.getTimestamp(OracleResultSetImpl.java:1060)
at oracle.jdbc.driver.OracleResultSet.getTimestamp(OracleResultSet.java:512)
at org.jboss.resource.adapter.jdbc.WrappedResultSet.getTimestamp(WrappedResultSet.java:979)
at org.hibernate.type.TimestampType.get(TimestampType.java:30)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:163)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:154)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2096)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
at org.hibernate.loader.Loader.getRow(Loader.java:1206)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
at org.hibernate.loader.Loader.doQuery(Loader.java:701)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
This error occurs just when we read from that field, not when we write to it. However the strange thing is that the reading works just fine on Glassfish and fails on JBoss. I have noticed that Glassfish uses directly OracleDataSource whereas JBoss does not. When I tried to use OracleDataSource on JBoss, the error was still the same. I also tried both OCI and THIN and there was no difference. It seems to me that this has something to do with Oracle JDBC formatting.
I have found on the internet some solutions that basically say that we should set the timezone on the oracle connection (OracleConnection) manually. This is what we don't want to do, actually. And I believe if reading from local timezone column works on Glassfish, it should work on JBoss as well. But I have no idea how to set it up. Has anyone came across to this problem?
thanks,
Martin
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/580959#580959]
Start a new discussion in Datasource Configuration at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 10 months
[Datasource Configuration] - Connection Pool Oracle 10g Jboss 4.2.3 GA problem
by Rajasundaram Gopalan
Rajasundaram Gopalan [http://community.jboss.org/people/rajasundaram] created the discussion
"Connection Pool Oracle 10g Jboss 4.2.3 GA problem"
To view the discussion, visit: http://community.jboss.org/message/579290#579290
--------------------------------------------------------------
Connection Pool when connections are available in the pool still it creates new connections. We checked the database sessions only 5 sessions are active but in the connection pool there are 20 connections.
Environment Jboss 4.2.3 GA
Oracle 10g
no-tx-support - oracle-ds.xml
<datasources>
<no-tx-datasource>
<jndi-name>DSNAME</jndi-name>
<connection-url>jdbc:oracle:thin:@HOST:1522:SERVICE_NAME</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>USER</user-name>
<password>PASS</password>
<min-pool-size>1</min-pool-size>
<max-pool-size>30</max-pool-size>
<query-timeout>60</query-timeout>
<track-statements>true</track-statements>
<idle-timeout-minutes>5</idle-timeout-minutes>
<!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
<valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name>
<!-- Checks the Oracle error codes and messages for fatal errors -->
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<!-- sql to call when connection is created -->
<new-connection-sql>select * from dual</new-connection-sql>
<!-- sql to call on an existing pooled connection when it is obtained from pool - the OracleValidConnectionChecker is prefered -->
<check-valid-connection-sql>select * from dual</check-valid-connection-sql>
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</no-tx-datasource>
</datasources>
Advance thanks for your help
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/579290#579290]
Start a new discussion in Datasource Configuration at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 10 months
[JBoss Web Services] - Attaching a WS-Security policy forces use of "Standard WSSecurity Endpoint" configuration
by Riccardo Serafin
Riccardo Serafin [http://community.jboss.org/people/barakka] created the discussion
"Attaching a WS-Security policy forces use of "Standard WSSecurity Endpoint" configuration"
To view the discussion, visit: http://community.jboss.org/message/581032#581032
--------------------------------------------------------------
Hello, I'm trying to use WS-Security with WS-Policy and a custom endpoint configuration in one of my services, but it seems that when the policy is parsed during deployment a standard endpoint configuration is forced. This is an extract of the relevant parts of my service declaration: {code} @WebService(name = "DeviceObservationConsumer_PortType", serviceName = "DeviceObservationConsumer_Service", targetNamespace = "urn:ihe:pcd:dec:2010", portName = "DeviceObservationConsumer_Port_Soap12") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) @BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING) @EndpointConfig(configFile = "META-INF/cmr-basic-endpoint-config.xml", configName = "CMR-basic") @PolicyAttachment( @Policy(policyFileLocation = "META-INF/cmr-basic-security-policy.xml", scope = PolicyScopeLevel.WSDL_BINDING)) public class DOCServiceBasicImpl extends DOCServiceUnsercureImpl { {code} As you can see, I'd like to use the CMR-basic endpoint config, which I've already setup to use the WS-Security handler, like this {code:xml} CMR-basic ##SOAP12_HTTP Seam SOAP Request Handler org.jboss.seam.webservice.SOAPRequestHandler WSSecurity Handler org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerServer {code:xml} And I'm trying to attach the following policy: {code:xml}
{code:xml} When the service is deployed, the following error is produced: {code} 18:19:23,415 INFO [org.jboss.ws.extensions.policy.metadata.PolicyMetaDataBuilder] Deploying Annotated Policy = META-INF/cmr-basic-security-policy.xml 18:19:23,590 ERROR [STDERR] org.jboss.ws.WSException: Cannot obtain config: Standard WSSecurity Endpoint 18:19:23,593 ERROR [STDERR] at org.jboss.ws.metadata.config.JBossWSConfigFactory.getConfig(JBossWSConfigFactory.java:165) 18:19:23,593 ERROR [STDERR] at org.jboss.ws.metadata.umdm.EndpointMetaData.initEndpointConfigMetaData(EndpointMetaData.java:874) 18:19:23,593 ERROR [STDERR] at org.jboss.ws.metadata.umdm.EndpointMetaData.createEndpointConfigMetaData(EndpointMetaData.java:841) 18:19:23,593 ERROR [STDERR] at org.jboss.ws.metadata.umdm.EndpointMetaData.setConfigNameInternal(EndpointMetaData.java:823) 18:19:23,593 ERROR [STDERR] at org.jboss.ws.metadata.umdm.EndpointMetaData.setConfigName(EndpointMetaData.java:801) 18:19:23,593 ERROR [STDERR] at org.jboss.ws.extensions.policy.deployer.domainAssertion.WSSecurityAssertionDeployer.deployServerSide(WSSecurityAssertionDeployer.java:69) 18:19:23,593 ERROR [STDERR] at org.jboss.ws.extensions.policy.deployer.PolicyDeployer.deployAssertionServerSide(PolicyDeployer.java:227) 18:19:23,593 ERROR [STDERR] at org.jboss.ws.extensions.policy.deployer.PolicyDeployer.deployAlternativeServerSide(PolicyDeployer.java:195) 18:19:23,594 ERROR [STDERR] at org.jboss.ws.extensions.policy.deployer.PolicyDeployer.deployServerside(PolicyDeployer.java:118) 18:19:23,594 ERROR [STDERR] at org.jboss.ws.extensions.policy.metadata.PolicyMetaDataBuilder.deployPolicyServerSide(PolicyMetaDataBuilder.java:288) 18:19:23,594 ERROR [STDERR] at org.jboss.ws.extensions.policy.metadata.PolicyMetaDataBuilder.deployPolicy(PolicyMetaDataBuilder.java:270) 18:19:23,594 ERROR [STDERR] at org.jboss.ws.extensions.policy.metadata.PolicyMetaDataBuilder.processPolicyAnnotations(PolicyMetaDataBuilder.java:132) 18:19:23,594 ERROR [STDERR] at org.jboss.ws.metadata.builder.jaxws.JAXWSWebServiceMetaDataBuilder.buildWebServiceMetaData(JAXWSWebServiceMetaDataBuilder.java:161) 18:19:23,594 ERROR [STDERR] at org.jboss.ws.metadata.builder.jaxws.JAXWSServerMetaDataBuilder.setupProviderOrWebService(JAXWSServerMetaDataBuilder.java:50) 18:19:23,594 ERROR [STDERR] at org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderEJB3.buildMetaData(JAXWSMetaDataBuilderEJB3.java:76) ... {code} which i believe is caused by the following code in WSSecurityAssertionDeployer {code} public void deployServerSide(PrimitiveAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion { ByteArrayOutputStream stream = new ByteArrayOutputStream(); if (extMetaData instanceof EndpointMetaData) { EndpointMetaData ep = (EndpointMetaData) extMetaData; WSSecurityConfiguration securityConfiguration; try { //GET XML of security assertion PrimitiveAssertionWriter.newInstance().writePrimitiveAssertion(assertion, stream); StringReader reader = new StringReader(stream.toString()); //Set security configuration securityConfiguration = WSSecurityOMFactory.newInstance().parse(reader); WSSecurityConfigFactory.newInstance().initKeystorePath(ep.getRootFile(), securityConfiguration); ep.getServiceMetaData().setSecurityConfiguration(securityConfiguration); //set up handler chain as defined in standard file ep.setConfigName("Standard WSSecurity Endpoint"); } catch (Exception e) { e.printStackTrace(); throw new UnsupportedAssertion(); } } } {code} which, instead of checking if the proper WSSecurity handler is installed, forces the use of "Standard WSSecurity Endpoint" configuration. Is this expected? Why can't I use my own policy configuration? Btw, the obvious workaround is to rename my endpoint configuration to "Standard WSSecurity Endpoint", but that is a bit annoying, as I have several configuration that requires WS-Security in combination with other WS-* standards that I use for my services, and this forces me to separate them in several configuration files to be able to replace the "Standard WSSecurity Endpoint" with what I need. Thanks, Riccardo.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/581032#581032]
Start a new discussion in JBoss Web Services at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 10 months
[EJB3] - EJBContainer doesn't deploy my SessionBean
by Julien Smadja
Julien Smadja [http://community.jboss.org/people/jsmadja] created the discussion
"EJBContainer doesn't deploy my SessionBean"
To view the discussion, visit: http://community.jboss.org/message/581031#581031
--------------------------------------------------------------
Hi everybody,
I'm trying to execute a simple JUnit Test Case with a stateless session bean. There is no problem when I deploy this jar in glassfish or in Jboss 6.
But, when I try to execute my test, the Jboss EJBContainer starts fine and my SessionBean failed to deploy.
Here the details :
My container initialization :
@BeforeClass
public static void initJBoss() throws NamingException {
container = EJBContainer.createEJBContainer();
context = container.getContext();
service = (IPersonService) context.lookup("PersonService/local");
}
My session bean definition :
@Stateless
@Local
public class PersonService implements IPersonService {
@PersistenceContext
EntityManager em;
public Person create(Person person) {
em.persist(person);
return person;
}
....
}
And now, the errors (no difference when I'm running through Eclipse or Maven 3) :
javax.ejb.EJBException: java.lang.reflect.InvocationTargetException
at org.jboss.ejb3.embedded.impl.standalone.JBossStandaloneEJBContainerProvider.createEJBContainer(JBossStandaloneEJBContainerProvider.java:134)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:97)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:79)
at com.xebia.ejbcontainer.service.PersonServiceTest.initJBoss(PersonServiceTest.java:29)
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:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:146)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
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:597)
at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
at $Proxy0.invoke(Unknown Source)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:145)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:87)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
Caused by: java.lang.reflect.InvocationTargetException
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:597)
at org.jboss.ejb3.embedded.impl.standalone.JBossStandaloneEJBContainerProvider.createEJBContainer(JBossStandaloneEJBContainerProvider.java:122)
... 25 more
Caused by: javax.ejb.EJBException: org.jboss.embedded.api.DeploymentException: org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
DEPLOYMENTS MISSING DEPENDENCIES:
Deployment "jboss.ejb3:application=cla,module=cla,component=PersonService,service=EjbEncFactory" is missing the following dependencies:
Dependency "jboss.naming:application=cla,component=PersonService,module=cla" (should be in state "Installed", but is actually in state "** NOT FOUND Depends on 'jboss.naming:application=cla,component=PersonService,module=cla' **")
Deployment "jboss.j2ee:jar=classes,name=PersonService,service=EJB3" is missing the following dependencies:
Dependency "jboss.ejb3:application=cla,component=PersonService,module=cla,service=EjbEncFactory" (should be in state "Installed", but is actually in state "Described")
Dependency "org.jboss.ejb.bean.instantiator/cla/cla/PersonService" (should be in state "Installed", but is actually in state "** NOT FOUND Depends on 'org.jboss.ejb.bean.instantiator*/cla/cla/PersonService*' **")
Deployment "jboss.j2ee:jar=classes,name=PersonService,service=EJB3,type=nointerface-view-jndi-binder" is missing the following dependencies:
Dependency "jboss.j2ee:jar=classes,name=PersonService,service=EJB3" (should be in state "Installed", but is actually in state "Instantiated")
Deployment "jboss.j2ee:jar=classes,name=PersonService,service=EJB3_endpoint" is missing the following dependencies:
Dependency "jboss.j2ee:jar=classes,name=PersonService,service=EJB3" (should be in state "Installed", but is actually in state "Instantiated")
DEPLOYMENTS IN ERROR:
Deployment "org.jboss.ejb.bean.instantiator/cla/cla/PersonService" is in error due to the following reason(s): ** NOT FOUND Depends on 'org.jboss.ejb.bean.instantiator/cla/cla/PersonService' **
Deployment "jboss.naming:application=cla,component=PersonService,module=cla" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.naming:application=cla,component=PersonService,module=cla' **
Deployment "jboss.ejb3:application=cla,component=PersonService,module=cla,service=EjbEncFactory" is in error due to the following reason(s): Described
Any idea ? What is the */cla/cla/PersonService* thing *?*
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/581031#581031]
Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 10 months
[EJB3] - @PrimaryKeyJoinColumn - exception
by Hubert Lyczek
Hubert Lyczek [http://community.jboss.org/people/lysy78] created the discussion
"@PrimaryKeyJoinColumn - exception"
To view the discussion, visit: http://community.jboss.org/message/581026#581026
--------------------------------------------------------------
Hello,
I've dicided to try one-to-one relation using @PrimaryKeyJoinColumn. But i cannot force it to work.
Environment:
- AS: jboss-6.0.0.Final
- java version "1.6.0_23"
Problem description:
I have two entities: Customer, Address. Relation between Customer and address is bidirectional one-to-one. The relation uses primary keys.
You can see created entity beans below:
@Entity
@Table(name="CUSTOMER")
public class Customer implements Serializable{
@Id
@Column(name="CUSTOMER_ID", nullable=false)
@GeneratedValue(strategy=GenerationType.AUTO)
private Integer customerId;
...
//bidirectional
@OneToOne(fetch=FetchType.EAGER, cascade=CascadeType.ALL, optional=true)
@PrimaryKeyJoinColumn
private Address address;
...
}
@Entity
@Table(name="ADDRESS")
public class
Address implements Serializable{
@Id
@Column(name="ADDRESS_ID", nullable=false)
@GeneratedValue(generator="foreignGenerator") @GenericGenerator(
name="foreignGenerator", strategy="foreign",
parameters={@Parameter(name="property", value="customer"
)}) private Integer addressId;
...
@OneToOne(mappedBy="address", fetch=FetchType.LAZY, optional=false)
private Customer customer;
...
}
As you see i'm using @GeneratedValue and @GenericGenerator to be sure that address_id will be the same as customer_id.
Unfortunately that doesn't work.
I tried to run code (from remote client):
Customer customer = new Customer();
... //set customer fields
Address address = new Address();
... //set addres fields
customer.setAddress(address);address.setCustomer(customer);
databaseManager.createCustomer(customer); //persist
This is implementation of method createCustomer.
public void
entityManager.persist(customer);
}
Unfortunately when i try to persist customer with address i get this exception:
Exception in thread "main" javax.ejb.EJBTransactionRolledbackException:
org.hibernate.id.IdentifierGenerationException: null id generated for:class hl.test.relations.entity.Address
CMTTxInterceptor.java:148)
at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.handleInCallerTx(
...
I thought that i would get the same id for Address as for Customer. But i got exeption and i don't know why.
Could you guys help me find out where is the reason of the exception and how to fix my code?
Thank you in advance
Hubert
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/581026#581026]
Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 10 months