[EJB 3.0] - illegal access to loading collection
by mwalbrun
Hi all,
i have the following problem. I have an EJB 3.0 successfully running on windows. now i copied the project onto my mac with mac os x leopard and when i start it get the following exception
18:17:31,669 ERROR [LazyInitializationException] illegal access to loading collection
| org.hibernate.LazyInitializationException: illegal access to loading collection
| at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:341)
| at org.hibernate.collection.PersistentSet.add(PersistentSet.java:189)
| at de.optitool.domain.sys.Schedule.addEntry(Schedule.java:234)
| at de.optitool.domain.sys.ScheduleEntry.setSchedule(ScheduleEntry.java:316)
| 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:585)
| at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:42)
| at org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTuplizer.java:337)
| at org.hibernate.tuple.entity.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:200)
| at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:3566)
| at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:129)
| at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:854)
| at org.hibernate.loader.Loader.doQuery(Loader.java:729)
| at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
| at org.hibernate.loader.Loader.doList(Loader.java:2220)
| at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
| at org.hibernate.loader.Loader.list(Loader.java:2099)
| at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
| at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
| at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
| at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
| at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
| at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
| at de.optitool.session.biz.tp.OrderSessionBean.test(OrderSessionBean.java:76)
| 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:585)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
| at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
| at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
| at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
| at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:335)
| at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
| at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
| at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
| at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
| at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
| 18:17:44,151 ERROR [STDERR] javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: Exception occurred inside setter of de.optitool.domain.sys.ScheduleEntry.schedule
| 18:17:44,153 ERROR [STDERR] at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
| 18:17:44,155 ERROR [STDERR] at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:73)
| 18:17:44,156 ERROR [STDERR] at de.optitool.session.biz.tp.OrderSessionBean.test(OrderSessionBean.java:76)
| 18:17:44,157 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 18:17:44,158 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 18:17:44,159 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 18:17:44,159 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
| 18:17:44,160 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
| 18:17:44,161 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
| 18:17:44,162 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
| 18:17:44,163 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 18:17:44,164 ERROR [STDERR] at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
| 18:17:44,165 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 18:17:44,166 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
| 18:17:44,166 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 18:17:44,167 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
| 18:17:44,168 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 18:17:44,169 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
| 18:17:44,169 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
| 18:17:44,170 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 18:17:44,171 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
| 18:17:44,171 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 18:17:44,172 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
| 18:17:44,173 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 18:17:44,174 ERROR [STDERR] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
| 18:17:44,175 ERROR [STDERR] at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
| 18:17:44,175 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 18:17:44,176 ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
| 18:17:44,177 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 18:17:44,178 ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| 18:17:44,178 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 18:17:44,179 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:335)
| 18:17:44,180 ERROR [STDERR] at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
| 18:17:44,180 ERROR [STDERR] at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| 18:17:44,181 ERROR [STDERR] at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
| 18:17:44,182 ERROR [STDERR] at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
| 18:17:44,183 ERROR [STDERR] at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
| 18:17:44,183 ERROR [STDERR] at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
| 18:17:44,184 ERROR [STDERR] Caused by: org.hibernate.PropertyAccessException: Exception occurred inside setter of de.optitool.domain.sys.ScheduleEntry.schedule
| 18:17:44,185 ERROR [STDERR] at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:65)
| 18:17:44,186 ERROR [STDERR] at org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTuplizer.java:337)
| 18:17:44,187 ERROR [STDERR] at org.hibernate.tuple.entity.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:200)
| 18:17:44,188 ERROR [STDERR] at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:3566)
| 18:17:44,188 ERROR [STDERR] at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:129)
| 18:17:44,189 ERROR [STDERR] at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:854)
| 18:17:44,190 ERROR [STDERR] at org.hibernate.loader.Loader.doQuery(Loader.java:729)
| 18:17:44,190 ERROR [STDERR] at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
| 18:17:44,191 ERROR [STDERR] at org.hibernate.loader.Loader.doList(Loader.java:2220)
| 18:17:44,192 ERROR [STDERR] at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
| 18:17:44,192 ERROR [STDERR] at org.hibernate.loader.Loader.list(Loader.java:2099)
| 18:17:44,193 ERROR [STDERR] at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
| 18:17:44,194 ERROR [STDERR] at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
| 18:17:44,194 ERROR [STDERR] at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
| 18:17:44,195 ERROR [STDERR] at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
| 18:17:44,196 ERROR [STDERR] at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
| 18:17:44,196 ERROR [STDERR] at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
| 18:17:44,197 ERROR [STDERR] ... 36 more
| 18:17:44,198 ERROR [STDERR] Caused by: java.lang.reflect.InvocationTargetException
| 18:17:44,198 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 18:17:44,199 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 18:17:44,200 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 18:17:44,200 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
| 18:17:44,201 ERROR [STDERR] at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:42)
| 18:17:44,202 ERROR [STDERR] ... 52 more
| 18:17:44,202 ERROR [STDERR] Caused by: org.hibernate.LazyInitializationException: illegal access to loading collection
| 18:17:44,203 ERROR [STDERR] at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:341)
| 18:17:44,204 ERROR [STDERR] at org.hibernate.collection.PersistentSet.add(PersistentSet.java:189)
| 18:17:44,204 ERROR [STDERR] at de.optitool.domain.sys.Schedule.addEntry(Schedule.java:234)
| 18:17:44,205 ERROR [STDERR] at de.optitool.domain.sys.ScheduleEntry.setSchedule(ScheduleEntry.java:316)
| 18:17:44,206 ERROR [STDERR] ... 57 more
My two Entities are as follows...
package de.optitool.domain.sys;
|
| import java.util.ArrayList;
| import java.util.Calendar;
| import java.util.Collection;
| import java.util.Collections;
| import java.util.Comparator;
| import java.util.Date;
| import java.util.HashSet;
| import java.util.Iterator;
| import java.util.List;
| import java.util.Set;
|
| import javax.persistence.CascadeType;
| import javax.persistence.Column;
| import javax.persistence.Entity;
| import javax.persistence.FetchType;
| import javax.persistence.GeneratedValue;
| import javax.persistence.GenerationType;
| import javax.persistence.Id;
| import javax.persistence.OneToMany;
| import javax.persistence.Table;
| import javax.persistence.TableGenerator;
| import javax.persistence.Transient;
| import javax.persistence.Version;
|
| import de.optitool.common.exception.VetoException;
| import de.optitool.common.sys.ISchedule;
| import de.optitool.common.sys.IScheduleEntry;
| import de.optitool.common.sys.ScheduleEntryEndComparator;
| import de.optitool.common.sys.ScheduleEntryStartComparator;
|
| @Entity
| @Table(name="schedule")
| public class Schedule implements java.io.Serializable, ISchedule {
|
|
| private static final long serialVersionUID = 6197633623641866232L;
| private int scheduleId;
| private short jdoVersion;
| private Set<ScheduleEntry> scheduleEntries = new HashSet<ScheduleEntry>();
|
| public Schedule() {
| }
|
| public Schedule(Set<ScheduleEntry> scheduleEntries) {
| this.scheduleEntries = scheduleEntries;
| }
|
| @TableGenerator(name="schedule",
| table="jdo_keygen",
| pkColumnName="table_name",
| valueColumnName="last_used_id",
| pkColumnValue="schedule",
| allocationSize=10)
| @Id
| @GeneratedValue(strategy=GenerationType.TABLE, generator="schedule")
| @Column(name="schedule_id", unique=true, nullable=false)
| public int getScheduleId() {
| return this.scheduleId;
| }
|
| protected void setScheduleId(int scheduleId) {
| this.scheduleId = scheduleId;
| }
|
| @Version
| @Column(name="jdo_version", nullable=false)
| protected short getJdoVersion() {
| return this.jdoVersion;
| }
|
| protected void setJdoVersion(short jdoVersion) {
| this.jdoVersion = jdoVersion;
| }
|
| /**
| * @see net.uniopt.sys.ISchedule#getEntries()
| */
| @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="schedule")
| public Set<ScheduleEntry> getScheduleEntries() {
| return this.scheduleEntries;
| }
|
| public void setScheduleEntries(Set<ScheduleEntry> scheduleEntries) {
| this.scheduleEntries = scheduleEntries;
| }
|
|
| //Methods I do not know why they are in here
|
| /**
| * @param entry
| */
| public void entryChanged (IScheduleEntry entry) {
| // We do nothing here, at the moment.
| // setStartEndTime();
| }
|
| /**
| * @return First second that's contained by this schedule.
| */
| @Transient
| private Date calcStartTime() {
| // Get the list of entries sorted ascending by their begin
| List<IScheduleEntry> list = getEntries (new ScheduleEntryStartComparator());
| if (list == null || list.isEmpty()) return null;
|
| // Take the first one from the list
| IScheduleEntry item = (IScheduleEntry)list.get (0);
| Date d = item.getStartDate();
| if (d == null) return null;
|
| Calendar cres = Calendar.getInstance();
|
| // Set the date part first
| Calendar dc = Calendar.getInstance();
| dc.setTime (d);
| cres.set (Calendar.YEAR, dc.get (Calendar.YEAR));
| cres.set (Calendar.MONTH, dc.get (Calendar.MONTH));
| cres.set (Calendar.DATE, dc.get (Calendar.DATE));
|
| // Ignore milliseconds
| cres.set (Calendar.MILLISECOND, 0);
|
| // Set the time part, if startTime of the entry is null we set it to 00:00:00
| d = item.getStartTime();
| if (d == null) {
| cres.set (Calendar.MINUTE, 0);
| cres.set (Calendar.SECOND, 0);
| cres.set (Calendar.HOUR_OF_DAY, 0);
| } else {
| Calendar tc = Calendar.getInstance();
| tc.setTime (d);
| cres.set (Calendar.HOUR_OF_DAY, tc.get (Calendar.HOUR_OF_DAY));
| cres.set (Calendar.MINUTE, tc.get (Calendar.MINUTE));
| cres.set (Calendar.SECOND, tc.get (Calendar.SECOND));
| }
| return cres.getTime();
| }
|
| /**
| * @return Last second that's contained by this schedule
| */
| @Transient
| private Date calcEndTime() {
| // Get the list of entries sorted ascending by their end date
| List<IScheduleEntry> list = getEntries (new ScheduleEntryEndComparator());
| if (list == null || list.isEmpty()) return null;
|
| // Take the last one from the list
| IScheduleEntry item = (IScheduleEntry)list.get (list.size()-1);
| Date d = item.getEndDate();
| if (d == null) return null;
|
| Calendar cres = Calendar.getInstance();
|
| // Set the date part
| Calendar dc = Calendar.getInstance();
| dc.setTime (d);
| cres.set (Calendar.YEAR, dc.get (Calendar.YEAR));
| cres.set (Calendar.MONTH, dc.get (Calendar.MONTH));
| cres.set (Calendar.DATE, dc.get (Calendar.DATE));
|
| // Ignore milliseconds
| cres.set (Calendar.MILLISECOND, 0);
|
| // Set the time part, if endTime of entry is null we set it to 24:00:00
| d = item.getEndTime();
| if (d != null) {
| Calendar tc = Calendar.getInstance();
| tc.setTime (d);
| cres.set (Calendar.HOUR_OF_DAY, tc.get (Calendar.HOUR_OF_DAY));
| cres.set (Calendar.MINUTE, tc.get (Calendar.MINUTE));
| cres.set (Calendar.SECOND, tc.get (Calendar.SECOND));
| } else {
| cres.set (Calendar.MINUTE, 0);
| cres.set (Calendar.SECOND, 0);
| cres.set (Calendar.HOUR_OF_DAY, 24);
| }
| return cres.getTime();
| }
|
| /**
| * Create a Date object from the given date anyDate and
| * initialize the time part with the given seconds of day.
| * @param anyDate - date used to initialize the date part (y,m,d)
| * @param second - second of the day, used to initialize the time part (h,m,s)
| * @return - the date object just created
| */
| @Transient
| private Date generateTime (Date anyDate, int second) {
| if (anyDate == null) anyDate = new Date(); // if no date given we take today.
| Calendar calendar = Calendar.getInstance();
| calendar.setTime (anyDate);
| calendar.set (Calendar.HOUR_OF_DAY, second/3600);
| second %= 3600;
| calendar.set (Calendar.MINUTE, second/60);
| second %= 60;
| calendar.set (Calendar.SECOND, second);
| return calendar.getTime();
| }
|
| /**
| * @param entry
| * @return
| */
| @Transient
| protected boolean isCompatible (ScheduleEntry entry) {
| // TODO If this new entry completely overlaps another or another is completely overlapped
| // TODO by the new one false is to be returned!
| return true;
| }
| //Methods implemented by the Interface
|
| @Transient
| /**
| * @see net.uniopt.sys.ISchedule#getEntries()
| */
| public Set<IScheduleEntry> getEntries() {
| Set<IScheduleEntry> set = new HashSet<IScheduleEntry>();
| if (scheduleEntries != null && !scheduleEntries.isEmpty())
| set.addAll (scheduleEntries);
| return set;
| }
|
| /**
| * @see net.uniopt.sys.ISchedule#addEntry(net.uniopt.sys.IScheduleEntry)
| */
| @Transient
| public boolean addEntry (IScheduleEntry entry) {
| if (scheduleEntries == null)
| scheduleEntries = new HashSet<ScheduleEntry>(17);
| boolean added = entry instanceof ScheduleEntry ? scheduleEntries.add ((ScheduleEntry)entry) : false;
| if (added)
| entry.setSchedule (this);
| return added;
| }
|
| /**
| * Convinience method for {@link #createEntry(Date, int, Date, int, int)} with the note set to null
| * and the all days of the week selected.
| * @param startDate - Day the timeframe begins (time part is ignored).
| * @param startSecond - Second of the day the timeframe begins (every day).
| * @param endDate - Day the interval ends (time part is ignored).
| * @param endSecond - Second of the day the timeframe ends every day.
| * @param dowIndicator - a bitmap of day-of-the-week constants defined by the ISchedule interface.
| * @return The new entry or null if it cannot be created or is not compatible.
| * @throws VetoException
| *
| * @see net.uniopt.sys.ISchedule#createEntry(java.util.Date, int, java.util.Date, int)
| */
| @Transient
| public IScheduleEntry createEntry (Date startDate, int startSecond, Date endDate, int endSecond) throws VetoException {
| return createEntry (startDate, startSecond, endDate, endSecond, ISchedule.ALLDAYS, null);
| }
|
| /**
| * Convinience method for {@link #createEntry(Date, int, Date, int, int, String)} with the note set to null.
| * @param startDate - Day the timeframe begins (time part is ignored).
| * @param startSecond - Second of the day the timeframe begins (every day).
| * @param endDate - Day the interval ends (time part is ignored).
| * @param endSecond - Second of the day the timeframe ends every day.
| * @param dowIndicator - a bitmap of day-of-the-week constants defined by the ISchedule interface.
| * @return The new entry or null if it cannot be created or is not compatible.
| * @throws VetoException
| *
| * @see net.uniopt.sys.ISchedule#createEntry(java.util.Date, int, java.util.Date, int, int)
| */
| @Transient
| public IScheduleEntry createEntry (Date startDate, int startSecond, Date endDate, int endSecond, int dowIndicator) throws VetoException {
| return createEntry (startDate, startSecond, endDate, endSecond, dowIndicator, null);
| }
|
| /**
| * Create a new entry (timeframe) within this schedule.
| * If the new entry is not compatible with the existing ones null is returned.
| * (e.g., it completely overlaps an older one or is completely overlapped by an older one)
| * @param startDate - Day the timeframe begins (time part is ignored).
| * @param startSecond - Second of the day the timeframe begins (every day).
| * @param endDate - Day the interval ends (time part is ignored).
| * @param endSecond - Second of the day the timeframe ends every day.
| * @param dowIndicator - a bitmap of day-of-the-week constants defined by the ISchedule interface.
| * @param note - An arbitrary annotation.
| * @return The new entry or null if it cannot be created or is not compatible.
| * @throws VetoException
| *
| * @see net.uniopt.sys.ISchedule#createEntry(java.util.Date, int, java.util.Date, int, int, java.lang.String)
| */
| @Transient
| public IScheduleEntry createEntry (Date startDate, int startSecond, Date endDate, int endSecond, int dowIndicator, String note) throws VetoException {
| return createEntry (startDate,
| generateTime (startDate, startSecond),
| endDate,
| generateTime (endDate, endSecond),
| dowIndicator,
| note
| );
| }
|
| /**
| * @throws VetoException
| *
| * @see net.uniopt.sys.ISchedule#createEntry(java.util.Date, java.lang.Integer, java.util.Date, java.lang.Integer, int, java.lang.String)
| */
| @Transient
| public IScheduleEntry createEntry (Date startDate, Integer startSecond, Date endDate, Integer endSecond, int dowIndicator, String note) throws VetoException {
| int tStart = startSecond == null ? 0 : startSecond.intValue();
| int tEnd = endSecond == null ? 86400 : endSecond.intValue();
| ScheduleEntry entry = (ScheduleEntry)createEntry (startDate, tStart, endDate, tEnd, dowIndicator, note);
| return entry;
| }
|
| /**
| * Create a new entry (timeframe) within this schedule.
| * If the new entry is not compatible with the existing ones null is returned.
| * (e.g., it completely overlaps an older one or is completely overlapped by an older one)
| * @param startDate - Day the timeframe begins (time part is ignored).
| * @param startTime - Time of the day the timeframe begins (every day), i.e., the date-part is ignored
| * @param endDate - Day the interval ends (time part is ignored).
| * @param endTime - Time of the day the timeframe ends every day, i.e., the date-part is ignored
| * @param dow - a bitmap of day-of-the-week constants defined by the ISchedule interface.
| * @param note - An arbitrary annotation.
| * @return The new entry or null if it cannot be created or is not compatible.
| * @throws VetoException
| *
| * @see net.uniopt.sys.ISchedule#createEntry(java.util.Date, int, java.util.Date, int, int, java.lang.String)
| */
| @Transient
| public IScheduleEntry createEntry (Date startDate, Date startTime, Date endDate, Date endTime, int dow, String note) throws VetoException {
| ScheduleEntry entry = new ScheduleEntry();
| entry.setValues (startDate, startTime, endDate, endTime);
| entry.setDow (dow);
| entry.setNote (note);
| if (isCompatible (entry)) {
| entry.setSchedule (this);
| addEntry (entry);
| return entry;
| }
| return null;
| }
|
| /**
| * @see net.uniopt.sys.ISchedule#getEarliest()
| */
| @Transient
| public IScheduleEntry getEarliest () {
| List<IScheduleEntry> ents = new ArrayList<IScheduleEntry> (getEntries());
| if (ents.isEmpty()) return null;
| Collections.sort (ents, new ScheduleEntryStartComparator());
| return ents.get(0);
| }
|
| /**
| * @return The last moment managed by the schedule.
| *
| * @see net.uniopt.sys.ISchedule#getEndTime()
| */
| @Transient
| public Date getEndTime() {
| return calcEndTime();
| }
|
| /**
| * @see net.uniopt.sys.ISchedule#getEntries(java.util.Comparator)
| */
| @Transient
| public List<IScheduleEntry> getEntries (Comparator<IScheduleEntry> sortedBy) {
| Set<IScheduleEntry> c = getEntries();
| List<IScheduleEntry> sortedEntries = c == null ? new ArrayList<IScheduleEntry>() : new ArrayList<IScheduleEntry> (c);
| if (sortedBy!=null) Collections.sort (sortedEntries, sortedBy);
| return sortedEntries;
| }
|
| /**
| * Returns all schedule entries (timeframes), that contain the given point in time.
| * @param date - The date part of the point in time of interest
| * @param minute - The minute of the day of the moment of interest.
| * @return - All entries containing the given moment.
| *
| * @see net.uniopt.sys.ISchedule#getEntriesContaining(java.util.Date, int)
| */
| @Transient
| public List<IScheduleEntry> getEntriesContaining (Date date, int minute) {
| ArrayList<IScheduleEntry> list = new ArrayList<IScheduleEntry>();
| for (IScheduleEntry entry : getEntries()) {
| if (entry instanceof ScheduleEntry && ((ScheduleEntry)entry).contains (date, minute))
| list.add (entry);
| }
| return list;
| }
|
| /**
| * @see net.uniopt.sys.ISchedule#getLatest()
| */
| @Transient
| public IScheduleEntry getLatest() {
| List<IScheduleEntry> ents = new ArrayList<IScheduleEntry> (getEntries());
| if (ents.isEmpty()) return null;
| Collections.sort (ents, new ScheduleEntryEndComparator());
| return ents.get(0);
| }
|
| /**
| * @return The first moment that's part of the schedule.
| *
| * @see net.uniopt.sys.ISchedule#getStartTime()
| */
| @Transient
| public Date getStartTime() {
| return calcStartTime();
| }
|
| /**
| * @see net.uniopt.sys.ISchedule#isEmpty()
| */
| @Transient
| public boolean isEmpty() {
| return (scheduleEntries == null || scheduleEntries.isEmpty());
| }
|
| /**
| * @see net.uniopt.sys.ISchedule#removeAll()
| */
| @Transient
| public void removeAll() {
| Collection<IScheduleEntry> c = getEntries();
| if (c != null && !c.isEmpty()) {
| Iterator<?> it = c.iterator();
| while (it.hasNext()) removeEntry ((IScheduleEntry)it.next());
| }
| }
|
| /**
| * @see net.uniopt.sys.ISchedule#removeEntry(net.uniopt.sys.IScheduleEntry)
| */
| @Transient
| public boolean removeEntry (IScheduleEntry entry) {
| boolean removed = (scheduleEntries == null ? false : scheduleEntries.remove (entry));
| if (removed) entry.setSchedule (null);
| return removed;
| }
| }
package de.optitool.domain.sys;
|
| import java.util.Calendar;
| import java.util.Comparator;
| import java.util.Date;
|
| import javax.persistence.Column;
| import javax.persistence.Entity;
| import javax.persistence.FetchType;
| import javax.persistence.GeneratedValue;
| import javax.persistence.GenerationType;
| import javax.persistence.Id;
| import javax.persistence.JoinColumn;
| import javax.persistence.ManyToOne;
| import javax.persistence.Table;
| import javax.persistence.TableGenerator;
| import javax.persistence.Transient;
| import javax.persistence.Version;
|
| import de.optitool.common.exception.VetoException;
| import de.optitool.common.sys.ISchedule;
| import de.optitool.common.sys.IScheduleEntry;
| import de.optitool.common.util.TimeUtil;
|
| @Entity
| @Table(name="schedule_entry")
| public class ScheduleEntry implements java.io.Serializable, IScheduleEntry {
|
| private static final long serialVersionUID = 6000616020745378569L;
|
| private int scheduleEntryId;
| private Schedule schedule;
| private int down;
| private Date endDate;
| private Date endTime;
| private Date startDate;
| private Date startTime;
| private boolean up;
| private String note;
| private short jdoVersion;
|
| /** Days of the week this entry matters.*/
| private int dow=Schedule.WORKINGDAYS;
|
| public ScheduleEntry() {
| }
|
| public ScheduleEntry(Schedule schedule, int down, boolean up) {
| this.schedule = schedule;
| this.down = down;
| this.up = up;
| }
|
| public ScheduleEntry(Schedule schedule, int down, Date endDate, Date endTime, Date startDate,
| Date startTime, boolean up, String note) {
|
| this.schedule = schedule;
| this.down = down;
| this.endDate = endDate;
| this.endTime = endTime;
| this.startDate = startDate;
| this.startTime = startTime;
| this.up = up;
| this.note = note;
| }
|
| @TableGenerator(name="schedule_entry",
| table="jdo_keygen",
| pkColumnName="table_name",
| valueColumnName="last_used_id",
| pkColumnValue="schedule_entry",
| allocationSize=10)
| @Id
| @GeneratedValue(strategy=GenerationType.TABLE, generator="schedule_entry")
| @Column(name="schedule_entry_id", unique=true, nullable=false)
| public int getScheduleEntryId() {
| return this.scheduleEntryId;
| }
|
| protected void setScheduleEntryId(int scheduleEntryId) {
| this.scheduleEntryId = scheduleEntryId;
| }
|
| @ManyToOne(fetch=FetchType.LAZY)
| @JoinColumn(name="schedule_id", nullable=false)
| public Schedule getSchedule() {
| return this.schedule;
| }
|
| public void setSchedule(Schedule schedule) {
| this.schedule = schedule;
| }
|
| @Column(name="dow", nullable=false)
| public int getDown() {
| return this.down;
| }
|
| public void setDown(int down) {
| this.down = down;
| }
|
| @Column(name="end_date", length=19)
| public Date getEndDate() {
| return this.endDate;
| }
|
| public void setEndDate(Date endDate) {
| this.endDate = endDate;
| }
|
| @Column(name="end_time", length=19)
| public Date getEndTime() {
| return this.endTime;
| }
|
| public void setEndTime(Date endTime) {
| this.endTime = endTime;
| }
|
| @Column(name="start_date", length=19)
| public Date getStartDate() {
| return this.startDate;
| }
|
| public void setStartDate(Date startDate) {
| this.startDate = startDate;
| }
|
| @Column(name="start_time", length=19)
| public Date getStartTime() {
| return this.startTime;
| }
|
| public void setStartTime(Date startTime) {
| this.startTime = startTime;
| }
|
| @Column(name="u", nullable=false)
| public boolean isUp() {
| return this.up;
| }
|
| public void setUp(boolean up) {
| this.up = up;
| }
|
| @Column(name="note")
| public String getNote() {
| return this.note;
| }
|
| public void setNote(String note) {
| this.note = note;
| }
|
| @Version
| @Column(name="jdo_version", nullable=false)
| protected short getJdoVersion() {
| return this.jdoVersion;
| }
|
| protected void setJdoVersion(short jdoVersion) {
| this.jdoVersion = jdoVersion;
| }
|
| //Methods I do not know
| /**
| * Does this schedule entry (timeframe) contain the given point in time.
| * @param date - The date part (year,month,day) of the point in time.
| * @param minute - Minute of the day of the point in time.
| * @return Whether this timeframe contains the given point in time.
| */
| public boolean contains (Date date, int minute) {
| if (startDate != null && date.before (startDate)) return false;
| if (endDate != null && date.after (endDate)) return false;
| Calendar c = Calendar.getInstance();
| c.setTime (date);
| if ((TimeUtil.encode (c.get (Calendar.DAY_OF_WEEK)) & dow) == 0) return false;
|
| // If startTime is null it's assumed 0 a.m., so the given minute can't be before but still the same day
| if (startTime != null) {
| c.setTime (startTime);
| int min = c.get (Calendar.HOUR_OF_DAY) * 60 + c.get (Calendar.MINUTE);
| if (minute < min) return false;
| }
| // If endTime is null it's assumed midnight, so the given minute can't be after but still the same day
| if (endTime != null) {
| c.setTime (endTime);
| int min = c.get (Calendar.HOUR_OF_DAY) * 60 + c.get (Calendar.MINUTE);
| if (minute > min) return false;
| }
| return true;
| }
|
| /**
| * Checks two given date/time pairs if they would make a valid ScheduleEntry.
| * <br>
| * The following criteria is checked:
| * <ul>
| * <li> if both date parts are given, the startDate/startTime must be before endDate/endTime </li>
| * <li> if no date parts are given, startTime must be before endTime </li>
| * <li> if only one date part is given, there is no further restriction on time parts.
| * </ul>
| */
| protected boolean isValidScheduleEntry (Date startDate, Date startTime, Date endDate, Date endTime) {
| Date startDateTime = TimeUtil.combine (startDate, startTime);
| Date endDateTime = TimeUtil.combine (endDate, endTime);
|
| if ((startDateTime != null) && (endDateTime != null)) {
| // both Date parts given, startDateTime must be before endDateTime
| return (startDateTime.compareTo (endDateTime) <= 0);
| } else if ((startDate == null) && (endDate == null)) {
| if ((startTime != null) && (endTime != null)) {
| // no Date parts given, startTime must be before endTime
| Date startTimePart = TimeUtil.makeDate(null, startTime); // sets date part to 1.1.1970
| Date endTimePart = TimeUtil.makeDate(null, endTime); // sets date part to 1.1.1970
| return (startTimePart.compareTo (endTimePart) <= 0);
| }
| }
| return true;
| }
|
| //Implemented by the interface
|
| /**
| * Compare this with another ScheduleEntry using the given Comparator
| * @param entry
| * @return 0 if equal, 1 if this is later, -1 if this is earlier
| *
| * @see net.uniopt.sys.IScheduleEntry#compareTo(net.uniopt.sys.IScheduleEntry, java.util.Comparator)
| */
| @Transient
| public int compareTo (IScheduleEntry entry, Comparator<IScheduleEntry> comparator) {
| return comparator.compare (this, entry);
| }
|
| /**
| * @see net.uniopt.sys.IScheduleEntry#getDow()
| */
| @Transient
| public int getDow() {
| return dow;
| }
|
| /**
| * @see net.uniopt.sys.IScheduleEntry#getEndDateTime()
| */
| @Transient
| public Date getEndDateTime () {
| return TimeUtil.combine (getEndDate(), getEndTime());
| }
|
| /**
| * @see net.uniopt.sys.IScheduleEntry#getStartDateTime()
| */
| @Transient
| public Date getStartDateTime () {
| return TimeUtil.combine (getStartDate(), getStartTime());
| }
|
| /**
| * @see net.uniopt.sys.IScheduleEntry#setDates(java.util.Date, java.util.Date)
| */
| @Transient
| public void setDates (Date startDate, Date endDate) throws VetoException {
| setValues(startDate, this.startTime, endDate, this.endTime);
| }
|
| /**
| * @see net.uniopt.sys.IScheduleEntry#setDow(int)
| */
| @Transient
| public void setDow (int i) {
| if (dow != i) {
| dow = i;
| if( schedule != null ) schedule.entryChanged (this);
| }
| }
|
| /**
| * Sets the end date/time to the given values.
| * If time is null, the value "23:59:59" is used.
| *
| * @see net.uniopt.sys.IScheduleEntry#setEnd(java.util.Date, java.util.Date)
| */
| @Transient
| public void setEnd (Date date, Date time) throws VetoException {
|
| if (time == null) time = TimeUtil.makeTime(23,59,59);
|
| if ( !isValidScheduleEntry( startDate, startTime, date, time ) )
| {
| throw new VetoException ("Schedule End cannot be before Schedule Begin.");
| }
|
| endDate = date;
| endTime = time;
|
| if( schedule != null ) schedule.entryChanged (this);
| }
|
| /**
| * @see net.uniopt.sys.IScheduleEntry#setSchedule(net.uniopt.sys.ISchedule)
| */
| @Transient
| public void setSchedule (ISchedule other) {
| if (other != null && !(other instanceof Schedule))
| throw new RuntimeException ("Cannot set instance of \""+other.getClass().getName()+"\" as parent of a " + getClass().getName()+".");
|
| if (other != schedule) {
| if (schedule != null)
| schedule.removeEntry (this);
| schedule = (Schedule)other;
| if (schedule != null)
| schedule.addEntry (this);
| }
| }
|
| /**
| * Sets the start date/time to the given values.
| * If time is null, the value "00:00:00" is used.
| *
| * @see net.uniopt.sys.IScheduleEntry#setStart(java.util.Date, java.util.Date)
| */
| @Transient
| public void setStart(Date date, Date time) throws VetoException {
|
| if (time == null) time = TimeUtil.makeTime(0,0,0);
|
| if ( !isValidScheduleEntry( date, time, endDate, endTime ) )
| {
| throw new VetoException ("Schedule End cannot be before Schedule Begin.");
| }
|
| startDate = date;
| startTime = time;
|
| if( schedule != null ) schedule.entryChanged (this);
| }
|
| /**
| * @see net.uniopt.sys.IScheduleEntry#setTimes(java.util.Date, java.util.Date)
| */
| @Transient
| public void setTimes (Date startTime, Date endTime) throws VetoException {
| setValues(this.startDate, startTime, this.endDate, endTime);
| }
|
| /**
| * @see net.uniopt.sys.IScheduleEntry#setValues(java.util.Date, java.util.Date, java.util.Date, java.util.Date)
| */
| @Transient
| public void setValues (Date startDate, Date startTime, Date endDate, Date endTime) throws VetoException {
| Date oldStartDate = this.startDate;
| Date oldStartTime = this.startTime;
| Date oldEndDate = this.endDate;
| Date oldEndTime = this.endTime;
|
| setEnd(null, null); // To bypass the validation
| setStart(startDate, startTime); // should always work now.
|
| try {
| setEnd(endDate, endTime); // This time a validation is done.
| } catch (VetoException xc) {
| this.startDate = oldStartDate;
| this.startTime = oldStartTime;
| this.endDate = oldEndDate;
| this.endTime = oldEndTime;
| throw xc;
| }
| if( schedule != null ) schedule.entryChanged (this);
| }
| }
|
|
|
the method which invokes the loading looks like this
public void test () {
| Query query = em.createQuery("SELECT s FROM Schedule s LEFT JOIN FETCH s.scheduleEntries ");
|
| try {
| Set<Tour> resultSet = new HashSet<Tour>(query.getResultList());
| Iterator<?> iter = resultSet.iterator();
| while (iter.hasNext()) {
| Schedule schedule = (Schedule) iter.next();
| System.out.println(schedule.getScheduleId() + " " + schedule.getScheduleEntries().size());
| }
| } catch (Exception ex) {
| ex.printStackTrace();
| }
| }
|
So I am really confused because it works on windows but not on my mac...
This can´t be the topic or?
Thanks for your help!
regards
markus
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119750#4119750
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4119750
18 years, 6 months
[JBossWS] - Re: Writing a client - no examples for BindingProvider based
by mjhammel
"jeff norton" wrote : I use the same wsprovide and wsconsume targets that you do, but the client still seems to need the WSDL in order to create the service endpoint.
My client doesn't call Service.create() directly. Instead, I reference the client side classes generated by wsconsume:
SubscriberServicesService service = new SubscriberServicesService();
| ss = service.getSubscriberWSPort();
|
| /* Set NEW Endpoint Location */
| BindingProvider bp = (BindingProvider)ss;
| bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, crunchServer);
|
| /* Setup to authenticate with the server. */
| bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, subscriberID);
| bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, pw);
The SubscriberServicesService class is one of the classes created by wsconsume. In it you'll find a hard coded path to the WSDL file created by wsprovide. However, this class also has a constructor that can change the location of this file. So when you package your client for use by end users you include the WSDL file generated by wsprovide and reference it's installed location when you do:
SubscriberServicesService service = new SubscriberServicesService("installedLocation/WSDLfile", qname);
My problem is I still don't know what a qname is so I'm not sure how to figure that out at run time so I can update the WSDL location in this manner.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119744#4119744
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4119744
18 years, 6 months
[Installation, Configuration & DEPLOYMENT] - Cannot start JBoss Web Console in JBoss 5 Beta3
by rmoyers
Use http://localhost:8080/ to connec to Jboss 5. Click on 'JBoss Web Console', and receive the following in the Java Console (there was no activity on the JBoss log):
Java Plug-in 1.6.0_03
Using JRE version 1.6.0_03 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\rm01022
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
p: reload proxy configuration
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to
----------------------------------------------------
http://localhost:8080/web-console/Invoker
java.lang.NoClassDefFoundError: org/jboss/logging/Logger
at org.jboss.console.remote.Util.(Util.java:33)
at org.jboss.console.remote.AppletRemoteMBeanInvoker.invoke(AppletRemoteMBeanInvoker.java:64)
at org.jboss.console.navtree.ConsoleTreeModel.loadTree(ConsoleTreeModel.java:118)
at org.jboss.console.navtree.ConsoleTreeModel.(ConsoleTreeModel.java:73)
at org.jboss.console.navtree.AdminTreeBrowser.(AdminTreeBrowser.java:77)
at org.jboss.console.navtree.AppletBrowser.start(AppletBrowser.java:65)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119712#4119712
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4119712
18 years, 6 months
[JBossWS] - webservice class injecting EJB, nullpointerexception
by HTroeng
Shouldn't it be possible to inject an EJB into a jax-ws webservice class? I get a nullpointerexception when trying to use the EJB, it doesn't look like the ejb is injected into the webservice class?
Code:
Interface:
@WebService
public interface MyService {
public String echoService(String input);
}
Implementation:
@WebService(endpointInterface = "my.package.MyService")
@SOAPBinding(style = Style.RPC)
public class MyServiceImpl implements MyService {
@EJB
SurveillanceService surveillanceService;
@WebMethod(operationName="echoService")
public String echoService(String input) {
boolean isAvail = surveillanceService.isDatabaseAvailable();
return "Hi " + input + ", result from ejb: " + isAvail;
}
}
The EJB does work (confirmed, I use it in other places), It seems that it is something with the Webservice > EJB...
Thanks in advance
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119706#4119706
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4119706
18 years, 6 months
[JBoss Seam] - Re: Keep Trinidad table sort order
by brachie
Hi Pete,
thanks for the answer. I do not fully unterstand how to do what you suggested.
What I am doing is:
Conversational SFSB
| @DataModel
| private List<Mitarbeiter> mitarbeiters;
| ...
|
| @Factory(value = "mitarbeiters")
| public void getMitarbeiterList() {
| Criteria c = ((HibernateSessionProxy) entityManager.getDelegate())
| .createCriteria(Mitarbeiter.class);
| c.addOrder(Order.desc("nachname"));
| mitarbeiters = c.list();
| }
|
and in my template:
| <tr:table width="290px" value="#{mitarbeiters}" var="mitarbeiter" rows="5" styleClass="trTableDiv">
| <tr:column sortable="true" sortProperty="login">
| <f:facet name="header">Login</f:facet>
| <s:link value="#{mitarbeiter.login}" propagation="new"
| action="#{mitarbeiterMgr.selectMitarbeiter}">
| <f:param name="mitarbeiterId" value="#{mitarbeiter.id}" />
| </s:link>
| </tr:column>
| ...
| </tr:table>
|
After clicking the link the same page loads again with the details of mitarbeiter, but the sort order of the table is gone.
Ho do I access the EntityQuery or place the Criteria in another scope?
Alexander
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119702#4119702
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4119702
18 years, 6 months
[JBossWS] - Re: WSSE UsernameToken without HTTP basic auth?
by mikaeljl
So, adding:
reqContext.put(StubExt.PROPERTY_AUTH_TYPE, StubExt.PROPERTY_AUTH_TYPE_WSSE);
|
to the client side removed the http auth header.
Guess this is because the org.jboss.ws.core.client.RemotingConnectionImpl-createRemotingMetaData method is called before the WSSecurityDispatcher calls ctx.put(StubExt.PROPERTY_AUTH_TYPE, StubExt.PROPERTY_AUTH_TYPE_WSSE); ? By setting this property from the client this is avoided.
The problem now is that I can no longer the the login to work properly on the server side.
What should I put in web.xml ? I've tried with
<security-constraint>
| <web-resource-collection>
| <web-resource-name>ProtectedResource</web-resource-name>
| <url-pattern>/*</url-pattern>
| </web-resource-collection>
| <auth-constraint>
| <role-name>friend</role-name>
| </auth-constraint>
| </security-constraint>
| <!-- We do not want http basic authentication
| <login-config>
| <auth-method>BASIC</auth-method>
| <realm-name>JBossWS</realm-name>
| </login-config>
| -->
| <security-role>
| <role-name>friend</role-name>
| </security-role>
|
But that results in the application not being authorized, I've tried to remove the security-constraint but then I can no longer retrieve the current principal information from within my WS implementation...
I've tried to retrieve it using:
Subject caller = (Subject) PolicyContext.getContext(SUBJECT_CONTEXT_KEY);
|
and:
@Resource
| javax.xml.ws.WebServiceContext wsCtx;
| java.security.Principal principal = wsCtx.getUserPrincipal();
But both return null data.
How should I retrive the principal data when using wsse usernametoken?
I can see in the traces that the security information is picked up:
2008-01-14 16:54:37,113 TRACE [org.jboss.security.SecurityAssociation] getSubject, sc=org.jboss.security.SecurityAssociation$SubjectContext@1b6c763{principal=kermit,subject=null}
But how to retrieve it?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119700#4119700
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4119700
18 years, 6 months
[JBossWS] - Problems with german 'Umlaut'
by Ulf Wiegmann
Hallo,
I'm working for a SOA architectur project and I'm implementing JAX-WS 2.0 web services in the Contract-First way under JBoss 4.2.2.GA .
The service is implemented by an EJB3.0 SLSB, the client is an EJB3.0 SFSB, both runnung in the same container.
The WS-specific java classes will be generated by JBoss 4.2.2 tool wsconsume from the wsdl file for both sites
- service and client.
The problem is, that the UTF-8 decode/encode process doesn't work correctly for german 'umlaut' contained in a string, means that string parameters still contain the UTF-8 representation of an 'umlaut' after transfered to the java target string (in the same wrong way they will be displayed on this page: p.e. Müller , Schöler, Käse) ...
In the wsdl file I specified
<?xml version="1.0" encoding="UTF-8"?>
and
<binding ...>
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
...
soap:body use="literal"
...
But when I use the Eclipse Web Service Explorer instead of the JAX WS 2.0 generated Java client, then at least in the client-server direction all works correctly for the search arguments, meanwhile the search results still contain the UTF-8 representations
What happened?
Ulf
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119696#4119696
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4119696
18 years, 6 months
[JBossWS] - Re: Writing a client - no examples for BindingProvider based
by mjhammel
"jeff norton" wrote :
| What is your classpath? And what old jars did you need to remove? I have a similar problem getting a client to connect to a web service that has basic authentication enabled. On the service.create(wsdlURL, QName) call I get (my client worked fine before I enabled basic authentication):
|
| | org.jboss.ws.metadata.wsdl.WSDLException: Cannot parse wsdlLocation: http://localhost:8080/foo?wsdl
| |
|
To compile the client, my classpath includes the source to the client, the classes generated by wsconsume and the following:
<path id="client.wsconsume.classpath">
| <fileset dir="${jboss.lib.dir}/endorsed">
| <include name="xercesImpl.jar"/>
| </fileset>
| <fileset dir="${jboss.client.lib.dir}">
| <include name="*.jar"/>
| <exclude name="jaxws-rt.jar"/>
| </fileset>
| <fileset dir="${java.lib.dir}">
| <include name="tools.jar"/>
| </fileset>
| </path>
where
jboss.lib.dir = ${jboss.home}/lib
| jboss.client.lib.dir = ${jboss.home}/client
| java.lib.dir = ${java.home}/lib
I got rid of axis and mail libraries which were being used in the old build. I'm not using Axis in the new project (at least not yet). I also no longer reference an in-build copy of jboss-j2ee.jar (though this is still referenced from the jboss.client.lib.dir) and javax.servlet.jar which were used in the old build (note that I inherited some of this so wasn't clear on why some of those were being used in the first place).
I ran into your problem with not finding the WSDL location after switching to Basic Authentication. In order to get around this I don't try to retrieve the WSDL file from the server during the client build. I have the server side build generate the WSDL file for me using wsprovide, then the client side build reads that file instead of trying to retrieve the WSDL via a URL. My wsconsume looks like this now:
<wsconsume
| fork="true"
| verbose="true"
| destdir="${build.client.classes.dir}"
| sourcedestdir="${build.client.dir}"
| keep="true"
| wsdl="${build.server.dir}/resources/SubscriberServicesService.wsdl">
| <!-- wsdl="http://127.0.0.1:8080/Crunch?wsdl"> -->
| </wsconsume>
My wsprovide looks like this:
<wsprovide
| fork="false"
| keep="true"
| destdir="${build.server.dir}/wsdl"
| resourcedestdir="${build.server.dir}/resources"
| sourcedestdir="${build.server.dir}/source"
| genwsdl="true"
| verbose="true"
| sei="com.cei.crunch.server.ws.SubscriberServices.SubscriberServices">
| <classpath>
| <pathelement path="${build.server.classes.dir}/server"/>
| </classpath>
| </wsprovide>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119695#4119695
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4119695
18 years, 6 months
[JBossWS] - Re: Writing a client - no examples for BindingProvider based
by alessio.soldano@jboss.com
"mjhammel" wrote : "alessio.soldano(a)jboss.com" wrote : This is not your situation, you're not using the persistence context in a servlet, you need injection in a SLSB. And my previous post shows that it works.
|
| That may be, but then there is this discussion:
|
| http://www.jboss.com/index.html?module=bb&op=viewtopic&t=107353
|
| In any case, I've done everything I think I need to do and it still doesn't work. I'd be happy for someone to show me what I've done wrong, but barring that I'd still have to say, in my case, it doesn't work.
|
Once again, you're not trying to use injection in a servlet, you need it in SLSB web service endpoint, don't you? The thread you linked talks about injection in servlets.
This said, going back to your problem, I would suggest you to start from the code I posted in this thread and modify it step by step according to your need.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119690#4119690
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4119690
18 years, 6 months