質問編集履歴

2

情報の追加

2019/03/07 10:23

投稿

makaroni
makaroni

スコア24

test CHANGED
File without changes
test CHANGED
@@ -20,10 +20,46 @@
20
20
 
21
21
 
22
22
 
23
- バッキングビーンの一部です
23
+ **バッキングビーン**
24
24
 
25
25
  ```java
26
26
 
27
+ package beans;
28
+
29
+
30
+
31
+ import entity.Images_Upimages;
32
+
33
+ import java.io.Serializable;
34
+
35
+ import java.util.List;
36
+
37
+ import db.*;
38
+
39
+ import java.io.ByteArrayInputStream;
40
+
41
+ import java.nio.file.Path;
42
+
43
+ import java.util.Map;
44
+
45
+ import javax.ejb.EJB;
46
+
47
+ import javax.enterprise.context.SessionScoped;
48
+
49
+ import javax.faces.context.ExternalContext;
50
+
51
+ import javax.faces.context.FacesContext;
52
+
53
+ import javax.faces.event.PhaseId;
54
+
55
+ import javax.inject.Named;
56
+
57
+ import org.primefaces.model.DefaultStreamedContent;
58
+
59
+ import org.primefaces.model.StreamedContent;
60
+
61
+
62
+
27
63
  @Named
28
64
 
29
65
  @SessionScoped
@@ -56,8 +92,146 @@
56
92
 
57
93
  }
58
94
 
95
+
96
+
97
+ public List<Images_Upimages> getAll(){
98
+
99
+ return iudb.getAll();
100
+
101
+ }
102
+
103
+
104
+
105
+ public StreamedContent getPic() {
106
+
107
+ FacesContext context = FacesContext.getCurrentInstance();
108
+
109
+ if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {
110
+
111
+ return new DefaultStreamedContent();
112
+
113
+ } else {
114
+
115
+ ExternalContext sv = context.getExternalContext();
116
+
117
+ Map<String, String> map = sv.getRequestParameterMap();
118
+
119
+ String key = map.get("Id");
120
+
121
+
122
+
123
+ Images_Upimages e = (Images_Upimages)(iudb.find(Integer.valueOf(key)));
124
+
125
+
126
+
127
+ ByteArrayInputStream in = new ByteArrayInputStream(e.getPicture());
128
+
129
+ DefaultStreamedContent ds = new DefaultStreamedContent(in);
130
+
131
+ return ds;
132
+
133
+ }
134
+
135
+ }
136
+
137
+
138
+
139
+ public String getText() {
140
+
141
+ return text;
142
+
143
+ }
144
+
145
+
146
+
147
+ public void setText(String text) {
148
+
149
+ this.text = text;
150
+
151
+ }
152
+
153
+
154
+
155
+ public Path getFile() {
156
+
157
+ return file;
158
+
159
+ }
160
+
161
+
162
+
163
+ public void setFile(Path file) {
164
+
165
+ this.file = file;
166
+
167
+ }
168
+
169
+
170
+
171
+ public Integer getGood() {
172
+
173
+ return good;
174
+
175
+ }
176
+
177
+
178
+
179
+ public void setGood(Integer good) {
180
+
181
+ this.good = good;
182
+
183
+ }
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+ }
192
+
193
+
194
+
59
195
  ```
60
196
 
197
+ **Chromeでのconsole**
198
+
199
+ ![![イメージ説明](f7f7cc3d75308783035296ba0718794d.png)
200
+
201
+
202
+
203
+ **スタックトレース(途中)**
204
+
205
+ > java.lang.IllegalStateException: Exception attempting to inject Remote ejb-ref name=beans.Bb/upimages,Remote 3.x interface =entity.Images_Upimages,ejb-link=null,lookup=,mappedName=,jndi-name=entity.Images_Upimages,refType=Session into class beans.Bb: Lookup failed for 'java:comp/env/beans.Bb/upimages' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
206
+
207
+ at org.glassfish.weld.services.InjectionServicesImpl.aroundInject(InjectionServicesImpl.java:175)
208
+
209
+ at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:46)
210
+
211
+ at org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:65)
212
+
213
+ at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:109)
214
+
215
+ at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:150)
216
+
217
+ at org.jboss.weld.util.bean.IsolatedForwardingBean.create(IsolatedForwardingBean.java:44)
218
+
219
+ at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
220
+
221
+ at org.jboss.weld.context.PassivatingContextWrapper$AbstractPassivatingContextWrapper.get(PassivatingContextWrapper.java:76)
222
+
223
+ at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:740)
224
+
225
+ at org.jboss.weld.el.AbstractWeldELResolver.lookup(AbstractWeldELResolver.java:107)
226
+
227
+ at org.jboss.weld.el.AbstractWeldELResolver.getValue(AbstractWeldELResolver.java:90)
228
+
229
+ at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:188)
230
+
231
+
232
+
233
+
234
+
61
235
  バッキングビーン無しでxhtmlを書くと問題なく実行できます。
62
236
 
63
237
 

1

2019/03/07 10:23

投稿

makaroni
makaroni

スコア24

test CHANGED
File without changes
test CHANGED
@@ -66,4 +66,4 @@
66
66
 
67
67
  このエラーでかなり足止めを食らっているのでできれば早急に
68
68
 
69
- 回答ほうよろしくお願いします。
69
+ 回答ほうよろしくお願いします。